- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:reference:adodb_assoc_case

# ADODB_ASSOC_CASE

##### See Also

metacasing

The constant must be declared before including adodb.inc.php. It is not possible to change the casing of recordset keys during a procedure.

The constant `ADODB_ASSOC_CASE` controls the key casing of retrieved recordsets when the 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.

Use the constant ADODB_ASSOC_CASE to change the case of the keys. There are 3 possible values:

## Constants

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

## Usage

    DEFINE(ADODB_ASSOC_CASE,0);
    require "adodb/adodb.inc.php";

    /*
     * connection assumed
    */

    $SQL = "SELECT accountNo,accountName FROM table";
    $data = $db->getAll($SQL);
    print_r($data);
    /*
     * Response is:
     [0]=>array('accountno'=>1,
                'accountname'=>'The First Account'
                ),
     [1]=>array('accountno'=>2,
                'accountname'=>'The Second Account'
                )
                )

    */

or:

    DEFINE(ADODB_ASSOC_CASE,1);
    require "adodb/adodb.inc.php";

    /*
     * connection assumed
    */

    $SQL = "SELECT accountNo,accountName FROM table";
    $data = $db->getAll($SQL);
    print_r($data);
    /*
     * Response is:
     [0]=>array('ACCOUNTNO'=>1,
                'ACCOUNTNAME'=>'The First Account'
                ),
     [1]=>array('ACCOUNTNO'=>2,
                'ACCOUNTNAME'=>'The Second Account'
                )
                )

    */

or:

    DEFINE(ADODB_ASSOC_CASE,3);
    require "adodb/adodb.inc.php";

    /*
     * connection assumed
    */

    $SQL = "SELECT accountNo,accountName FROM table";
    $data = $db->getAll($SQL);
    print_r($data);
    /*
     * Response is:
     [0]=>array('accountNo'=>1,
                'accountName'=>'The First Account'
                ),
     [1]=>array('accountNo'=>2,
                'accountName'=>'The Second Account'
                )
                )

    */

v5/reference/adodb_assoc_case.txt · Last modified: 2016/01/17 15:44 by 66.249.75.217

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top