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 [2016/01/18 00:44] – ↷ Links adapted because of a move operation 66.249.75.217 | 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~~ | ||
- | <WRAP right box round> | ||
- | == See Also == | ||
- | [[v5: | ||
- | </ | ||
- | The constant must be declared **before** including | ||
- | The constant '' | + | When returning data in **associative //[[v5: |
- | | + | 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 | ||
+ | |||
+ | <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 '' | ||
+ | </ | ||
- | ===== Constants | + | ===== 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(ADODB_ASSOC_CASE, | + | require " |
- | require "adodb/adodb.inc.php"; | + | 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 37: | Line 47: | ||
' | ' | ||
) | ) | ||
- | ) | ||
- | |||
*/ | */ | ||
</ | </ | ||
or: | or: | ||
+ | |||
<code php> | <code php> | ||
- | DEFINE(ADODB_ASSOC_CASE, | + | require " |
- | require "adodb/adodb.inc.php"; | + | 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 62: | Line 70: | ||
' | ' | ||
) | ) | ||
- | ) | ||
- | |||
*/ | */ | ||
</ | </ | ||
Line 70: | Line 76: | ||
<code php> | <code php> | ||
- | DEFINE(ADODB_ASSOC_CASE, | + | require " |
- | require "adodb/adodb.inc.php"; | + | 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 88: | Line 93: | ||
' | ' | ||
) | ) | ||
- | ) | ||
- | |||
*/ | */ | ||
</ | </ |
v5/reference/adodb_assoc_case.1453074270.txt.gz · Last modified: 2017/04/21 11:32 (external edit)