v6:reference:adodb_assoc_case
ADOConnectionDefinitions::assocCase
Data Type
INTEGER
Default Value
2 (ADODB_ASSOC_CASE_NATIVE)
When returning data in associative fetch mode, the $assocCase class variable gives control over the casing of the retrieved recordsets' fields.
Note that this setting has no effect on the casing of the actual data.
Possible values
| 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 | native-case field names |
With the default behavior, ADODB_ASSOC_CASE_NATIVE, ADOdb does not perform any transformation on field names, and returns them exactly as they are defined by the DBMS.
When writing portable code, it is strongly recommended to choose either upper or lower case. Relying on the native case default will likely cause compatibility issues, as there is no consistent casing across databases and some DBMS may returned mixed-case keys.
Usage
$acd = new \ADOdb\database\drivers\mysqli\ADOConnectionDefinitions $acd->assocCase = $acd::ASSOC_CASE_LOWER; // $db Connection assumed print_r($db->getAll("SELECT accountNo, accountName FROM table")); /* Response is: [0]=>array('accountno'=>1, 'accountname'=>'The First Account' ), [1]=>array('accountno'=>2, 'accountname'=>'The Second Account' ) */
v6/reference/adodb_assoc_case.txt · Last modified: by 127.0.0.1
