- 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:dictionary:metacolumnnames

# metaColumnNames

##### Syntax

    string[] metaColumnNames(
         string $tableName,
         optional bool $numericIndices=false,
         optional bool $usePostgresAttnum=false
         )

## Description

The function `metaColumnNames()` accepts a string parameter, a table name in the database that is currently attached, and returns either an associative array of the columns in the table, or a numeric array based on the value of `$numericIndices`. The keys of the array are the column names in upper case and the values are the column names in lower case. For a full description of column information, use the function metaColumns() instead.

### $numericIndices

If the optional 2nd argument is passed as true, the indexes are returned as a numeric index based on the natural order of the fields in the table. There is no definitive order of column names returned, it may be based on alphabetical order or possibly the order in which the columns were added to the table.

## Postgres Only Option

For Postgres databases only, a 3rd parameter is available to use the Postgres Column Number as the key.

# Usage

    $ar = $db->metaColumnNames('test');
    print_r($ar);
    /*
     * Returns:
    COLUMN_1=>column_1,
    COLUMN_2=>column_2,
    COLUMN_3=>column_3
    */

    $ar = $db->metaColumnNames('test',true);
    print_r($ar);
    /*
     * Returns:
    0=>column_1,
    1=>column_2,
    2=>column_3
    */

v5/dictionary/metacolumnnames.txt · Last modified: 2016/01/12 17:06 by mnewnham

### Page Tools

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