- v5:userguide:learn_dictionary:metatypes|MetaTypes ^ v5:userguide:learn_dictionary:start_lesson|Start Of Lesson ^ v5:userguide:learn_dictionary:other_metafunctions|Other MetaFunctions ->
~~NOTOC~~
====== MetaColumns ======
The metaColumns method returns an array of [[v5:dictionary:adoFieldObject|adoFieldObject]] objects that represent the attributes of the columns of a specified table.
$m = $db->metaColumns('my_table');
print_r($m);
adoFieldObject Object
(
[name] => actno
[max_length] => 8
[type] => INT
)
adoFieldObject Object
(
[name] => actname
[max_length] => 30
[type] => VARCHAR
)
Note that the type of the data returned is the [[v5:dictionary:actualtype|actualType]]. In order to retrieve the **//metaType//** , the value must be passed to:
$db->metaType($object->type);
For example, in the example above, the 'actname' field is of a type **//VARCHAR//** . If we pass this to ''metaType()'', it returns the value **C**
===== Extended Attributes =====
Some drivers return an extended set of attributes that represent DBMS specific functionality. For example, the IBM DB2 driver returns the normal 3 attributes above plus the following 3:
[not_null] =>
[scale] =>
[primary_key] =>
If you are writing portable applications you should not rely on these attributes to be available across all databases.
===== metaColumnNames =====
This method [[v5:dictionary:metacolumnnames|metaColumnNames()]] returns just the column names from the table.
$ar = $db->metaColumnNames('test');
print_r($ar);
/*
* Returns:
COLUMN_1=>column_1,
COLUMN_2=>column_2,
COLUMN_3=>column_3
*/