====== metaColumnNames ====== ~~NOTOC~~ == 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''. ----------------------- ==== Casing ==== For associative arrays, the keys of the array are the column names in **upper case**. For both numeric and associative arrays, the values of the array are the column names in the **natural case** of the database. For a full description of column information, use the function [[v5:dictionary:metacolumns|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 [[http://www.postgresql.org/docs/9.4/static/catalog-pg-attribute.html|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 */