ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:adodb_assoc_case

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
v5:reference:adodb_assoc_case [2018/07/01 23:26] – fix define() in examples peterddv5:reference:adodb_assoc_case [2019/05/08 13:17] – Rewrite and reformat, based also on 'Associative Key Case' page of 'Working With Fields' tutorial dregad
Line 1: Line 1:
-====== ADODB_ASSOC_CASE =====+====== ADODB_ASSOC_CASE ======
 ~~NOTOC~~ ~~NOTOC~~
  
-The constant must be declared **before** including  adodb.inc.php. It is not possible to change the casing of recordset keys during a procedure+When returning data in **associative //[[v5:reference:connection:setfetchmode|fetch mode]]//**, the ''ADODB_ASSOC_CASE'' constant gives control over the casing of the retrieved recordsets' fields
  
-The constant ''ADODB_ASSOC_CASE'' controls the key casing of retrieved recordsets when the [[v5:reference:connection:setfetchmode|fetch mode]] is set to associative. The default behavior for retrieval is controlled by the DBMS. When writing portable code, it is important to choose a default behavior and always use it.+It must be declared **before** inclusion of the ADOdb libraries (''adodb.inc.php'')and being a constant it is of course not possible to change its value later on
  
- Use the constant ADODB_ASSOC_CASE to change the case of the keysThere are 3 possible values:+Note that this setting has no effect on the casing of the actual data.
  
-===== 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| 
 + 
 +<WRAP tip> 
 +The default behavior, ''ADODB_CASE_NATIVE'', lets the DBMS control the fields' casing (i.e. ADOdb returns them exactly as they are defined by the DBMS). However, when writing portable code, it is strongly recommended to choose a default behavior and stick to it, as there is no consistent casing across databases and some DBMS may returned mixed-case keys. 
 +</WRAP>
  
 ===== Usage ===== ===== Usage =====
v5/reference/adodb_assoc_case.txt · Last modified: 2022/06/08 16:14 by dregad