v5:userguide:learn_fields:associative_key_case
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
v5:userguide:learn_fields:associative_key_case [2016/03/18 01:11] – created mnewnham | v5:userguide:learn_fields:associative_key_case [2019/05/08 13:36] (current) – [Associative Key Case] dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <- v5: | + | <- v5: |
~~NOTOC~~ | ~~NOTOC~~ | ||
====== 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 '' |
- | ^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(ADODB_ASSOC_CASE, | ||
- | 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(ADODB_ASSOC_CASE, | ||
- | 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.1458259893.txt.gz · Last modified: 2017/04/21 11:40 (external edit)