ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:metatype

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:dictionary:metatype [2017/04/30 21:58] mnewnhamv5:dictionary:metatype [2021/03/09 10:41] (current) – [Usage] dregad
Line 8: Line 8:
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The function ''metaType()'' accepts as an argument a database specific datatype, usually the result of a call to [[v5:reference:recordset:fetchfield|fetchField()]] and returns an ADOdb datatype, which provides a mapping to allow cross-database compatibility. The compatible fields are explained [[v5:dictionary:dictionary_index#Summary_Of_Types|Here]]+ 
 +The function ''metaType()'' accepts as an argument a native, database-specific type.  
 +This is usually the result of a call to [[v5:reference:recordset:fetchfield|fetchField()]]and can be given either as a string, or an ADOFieldObject. 
 + 
 +It returns an [[v5:dictionary:dictionary_index#Summary_Of_Types|ADOdb standard datatype]], which provides a mapping to allow cross-database compatibility. 
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 15: Line 20:
 */ */
  
-print $db->metaType('VARCHAR');+print $db->metaType('VARCHAR');  // Returns 'C' 
 /* /*
-* Returns 'C+ Using a Field Object from a recordset 
-*/+ */ 
 +$rs = $db->execute('SELECT id FROM table'); 
 +$field = $rs->fetchField(0); 
 +print $rs->metaType($field->type); // Returns 'I
 +print $rs->metaType($field);       // Returns 'I'
 </code> </code>
 +
v5/dictionary/metatype.1493582282.txt.gz · Last modified: 2017/04/30 21:58 by mnewnham