v5:reference:adodb_assoc_case
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:reference:adodb_assoc_case [2018/07/01 23:26] – fix define() in examples peterdd | v5:reference:adodb_assoc_case [2022/06/08 16:14] (current) – [Usage] fix code samples to reflect correct initialization of ADODB_ASSOC_CASE dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== ADODB_ASSOC_CASE ===== | + | ====== ADODB_ASSOC_CASE |
~~NOTOC~~ | ~~NOTOC~~ | ||
- | The constant must be declared | + | When returning data in **associative // |
- | The constant '' | + | It must be declared **before** initializing |
+ | Being a constant, it is of course not possible | ||
- | | + | Note that this setting has no effect on the casing |
- | ===== Constants | + | <WRAP info> |
+ | Until ADOdb 5.20.14, the documentation contained several references to a global variable named '' | ||
+ | |||
+ | **As of 5.20.15, the only supported method to set fields case is the '' | ||
+ | </ | ||
+ | |||
+ | ===== Possible values | ||
^Name^Value^Description^ | ^Name^Value^Description^ | ||
|ADODB_ASSOC_CASE_LOWER|0|lowercase field names| | |ADODB_ASSOC_CASE_LOWER|0|lowercase field names| | ||
|ADODB_ASSOC_CASE_UPPER|1|uppercase field names| | |ADODB_ASSOC_CASE_UPPER|1|uppercase field names| | ||
- | |ADODB_ASSOC_CASE_NATIVE (Default)|2|use native-case field names| | + | |ADODB_ASSOC_CASE_NATIVE (Default)|2|native-case field names| |
+ | |||
+ | With the default behavior, '' | ||
+ | |||
+ | <WRAP tip> | ||
+ | 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 ===== | ===== Usage ===== | ||
<code php> | <code php> | ||
- | define(' | + | require " |
- | require " | + | define(' |
+ | $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; | ||
- | /* | + | $db = ADONewConnection(' |
- | * connection assumed | + | $db-> |
- | */ | + | |
+ | print_r($db-> | ||
+ | |||
+ | /* Response is: | ||
- | $sql = " | ||
- | $data = $db-> | ||
- | print_r($data); | ||
- | /* | ||
- | * Response is: | ||
| | ||
' | ' | ||
Line 34: | Line 47: | ||
' | ' | ||
) | ) | ||
- | ) | ||
- | |||
*/ | */ | ||
</ | </ | ||
or: | or: | ||
+ | |||
<code php> | <code php> | ||
- | define(' | + | require " |
- | require " | + | define(' |
+ | $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; | ||
- | /* | + | $db = ADONewConnection(' |
- | * connection assumed | + | $db-> |
- | */ | + | |
+ | print_r($db-> | ||
+ | |||
+ | /* Response is: | ||
- | $sql = " | ||
- | $data = $db-> | ||
- | print_r($data); | ||
- | /* | ||
- | * Response is: | ||
| | ||
' | ' | ||
Line 59: | Line 70: | ||
' | ' | ||
) | ) | ||
- | ) | ||
- | |||
*/ | */ | ||
</ | </ | ||
Line 67: | Line 76: | ||
<code php> | <code php> | ||
- | define(' | + | require " |
- | require " | + | define(' |
+ | $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; | ||
- | /* | + | $db = ADONewConnection(' |
- | * connection assumed | + | $db-> |
- | */ | + | |
+ | print_r($db-> | ||
+ | |||
+ | /* Response is: | ||
- | $sql = " | ||
- | $data = $db-> | ||
- | print_r($data); | ||
- | /* | ||
- | * Response is: | ||
| | ||
' | ' | ||
Line 85: | Line 93: | ||
' | ' | ||
) | ) | ||
- | ) | ||
- | |||
*/ | */ | ||
</ | </ |
v5/reference/adodb_assoc_case.1530480392.txt.gz · Last modified: 2018/07/01 23:26 by peterdd