v5:userguide:learn_fields:associative_key_case
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
v5:userguide:learn_fields:associative_key_case [2018/07/01 23:19] – fix define() in examples peterdd | v5:userguide:learn_fields:associative_key_case [2019/05/08 13:34] – [Associative Key Case] dregad | ||
---|---|---|---|
Line 3: | Line 3: | ||
====== Associative Key Case ====== | ====== Associative Key Case ====== | ||
- | If returning data in associative mode, it is important to choose early in the project whether to use upper case or lower case keys. Once that decision has been made, a consistent result can be expected. ADOdb controls the casing of the keys using a constant | + | If returning data in associative mode, it is important to choose early in the project whether to use upper case or lower case keys. Once that decision has been made, a consistent result can be expected. ADOdb controls the casing of the keys using the '' |
The constant must be defined // | The constant must be defined // | ||
- | There are 3 possible values: | + | There are 3 possible values: |
- | ===== Constants ===== | + | See [[v5: |
- | ^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| | + | |
- | <code php> | ||
- | define(' | ||
- | require " | ||
- | |||
- | $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; | ||
- | |||
- | $sql = ' | ||
- | |||
- | print_r($db-> | ||
- | |||
- | /* | ||
- | * Returns | ||
- | * | ||
- | array(0=> | ||
- | ' | ||
- | ' | ||
- | | ||
- | ) | ||
- | */ | ||
- | </ | ||
- | |||
- | If we now set the value of ADODB_ASSOC_CASE to upper case, we obtain the following effect: | ||
- | |||
- | <code php> | ||
- | define(' | ||
- | require " | ||
- | |||
- | $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; | ||
- | |||
- | $sql = ' | ||
- | |||
- | print_r($db-> | ||
- | |||
- | /* | ||
- | * Returns | ||
- | * | ||
- | array(0=> | ||
- | ' | ||
- | ' | ||
- | | ||
- | ) | ||
- | */ | ||
- | </ | ||
- | |||
- | * Note that setting the value of this variable has no effect on the casing of the values of the array | ||
- | * Use of **// | ||
- | * | ||
- | |||
- | |||
- |
v5/userguide/learn_fields/associative_key_case.txt · Last modified: 2019/05/08 13:36 by dregad