ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:learn_dictionary:metacolumns

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:userguide:learn_dictionary:metacolumns [2016/03/16 03:06] mnewnhamv5:userguide:learn_dictionary:metacolumns [2016/03/20 15:05] (current) – [MetaColumns] mnewnham
Line 1: Line 1:
-<- v5:userguide:learn_dictionary:metatypes|MetaTypes ^ v5:userguide:learn_dictionary:start_lesson|Start Of Lesson ^ v5:userguide:learn_dictionary:metatables|MetaTables ->+<- v5:userguide:learn_dictionary:metatypes|MetaTypes ^ v5:userguide:learn_dictionary:start_lesson|Start Of Lesson ^ v5:userguide:learn_dictionary:other_metafunctions|Other MetaFunctions ->
 ~~NOTOC~~ ~~NOTOC~~
 ====== MetaColumns ====== ====== MetaColumns ======
-The metaColumns method returns an array of [[v5:dictionary:adoFieldObject|adoFieldObject]] object that represents the attributes of the columns of a specified table.+The metaColumns method returns an array of [[v5:dictionary:adoFieldObject|adoFieldObject]] objects that represent the attributes of the columns of a specified table.
 <code php> <code php>
 $m = $db->metaColumns('my_table'); $m = $db->metaColumns('my_table');
Line 27: Line 27:
   $db->metaType($object->type);   $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**  +For example, in the example above, the 'actnamefield 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 ===== ===== metaColumnNames =====
-This method returns just the column names from the table.+This method [[v5:dictionary:metacolumnnames|metaColumnNames()]] returns just the column names from the table. 
 +<code php> 
 + 
 +$ar = $db->metaColumnNames('test'); 
 +print_r($ar); 
 +/* 
 + * Returns: 
 +COLUMN_1=>column_1, 
 +COLUMN_2=>column_2, 
 +COLUMN_3=>column_3 
 +*/ 
 +</code>
v5/userguide/learn_dictionary/metacolumns.1458093990.txt.gz · Last modified: 2017/04/21 11:40 (external edit)