v5:reference:adodb_assoc_case
This is an old revision of the document!
ADODB_ASSOC_CASE
See Also
Note
As of version ADOdb 6.0, ADODB_ASSOC_CASE is deprecated. Its functionality is replaced by the more controllable metaCasing
options.
You can control the associative fetch case for certain drivers which behave differently. For the sybase, oci8po, mssql, odbc and ibase drivers and all drivers derived from them, ADODB_ASSOC_CASE will by default generate recordsets where the field name keys are lower-cased. Use the constant ADODB_ASSOC_CASE to change the case of the keys. There are 3 possible values:
The constant must be declared before including adodb.inc.php
Constants
Name | Value | Description |
---|---|---|
ADODB_ASSOC_CASE_LOWER | 0 | lowercase field names |
ADODB_ASSOC_CASE_UPPER | 1 | uppercase field names |
ADODB_ASSOC_CASE_NATIVE (Default) | 2 | use native-case field names |
Usage
DEFINE(ADODB_ASSOC_CASE,0); require "adodb/adodb.inc.php"; /* * connection assumed */ $SQL = "SELECT accountNo,accountName FROM table"; $data = $db->getAll($SQL); print_r($data); /* * Response is: [0]=>array('accountno'=>1, 'accountname'=>'The First Account' ), [1]=>array('accountno'=>2, 'accountname'=>'The Second Account' ) ) */
or:
DEFINE(ADODB_ASSOC_CASE,1); require "adodb/adodb.inc.php"; /* * connection assumed */ $SQL = "SELECT accountNo,accountName FROM table"; $data = $db->getAll($SQL); print_r($data); /* * Response is: [0]=>array('ACCOUNTNO'=>1, 'ACCOUNTNAME'=>'The First Account' ), [1]=>array('ACCOUNTNO'=>2, 'ACCOUNTNAME'=>'The Second Account' ) ) */
or:
DEFINE(ADODB_ASSOC_CASE,3); require "adodb/adodb.inc.php"; /* * connection assumed */ $SQL = "SELECT accountNo,accountName FROM table"; $data = $db->getAll($SQL); print_r($data); /* * Response is: [0]=>array('accountNo'=>1, 'accountName'=>'The First Account' ), [1]=>array('accountNo'=>2, 'accountName'=>'The Second Account' ) ) */
v5/reference/adodb_assoc_case.1441590512.txt.gz · Last modified: 2017/04/21 11:32 (external edit)