ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:metacolumns

This is an old revision of the document!


metaColumns

This page is under construction

The portability of the returned data is currently questionable, in terms of field types and field name normalization. Later releases of ADOdb may change the returned values for specific drivers. As a Meta function, this function should return portable information.

obj[] metaColumns(
     string $tableName,
     optional bool $normalize=false
     )

Description

The function metaColumns() returns an array of ADOFieldObject objects, each representing a description of each field of the requested table or view in the passed value $tableName. Each database returns a core set of descriptions, plus additional information. See the driver documentation for more information.

The formatting of the array cannot be controlled by ADODB_ASSOC_CASE or setFetchMode(), the following casing occurs:

  • Field name (array key) - Upper Case
  • Information keys - Lower Case
  • Information - Lower Case

Core Fields

The following fields are returned by all drivers:

Usage

/*
 * Assume DB2 connection
 */
$ar = $db->MetaColumns('ACT');
print_r($ar);
/*
 * Returns
Array
(
    [ACTNO] => ADOFieldObject Object
        (
            [name] => ACTNO
            [max_length] => 2
            [type] => I
            [not_null] =>
            [scale] => 0
            [primary_key] => 1
        )
 
    [ACTKWD] => ADOFieldObject Object
        (
            [name] => ACTKWD
            [max_length] => 6
            [type] => C
            [not_null] =>
            [scale] =>
            [primary_key] =>
        )
 
    [ACTDESC] => ADOFieldObject Object
        (
            [name] => ACTDESC
            [max_length] => 20
            [type] => C
            [not_null] =>
            [scale] =>
            [primary_key] =>
        )
 
)
*/
v5/dictionary/metacolumns.1439337563.txt.gz · Last modified: 2017/04/21 11:28 (external edit)