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 [2016/01/13 02:06] – ↷ Page moved from dictionary:metatype to v5:dictionary:metatype 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 [[reference:fetchfield|fetchField()]] and returns an ADOdb datatype, which provides a mapping to allow cross-database compatibility. The compatible fields are explained [[dictionary:data_dictionary#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 ===== 
 +<code php> 
 +/* 
 +* Connection to mysql database 
 +*/ 
 + 
 +print $db->metaType('VARCHAR');  // 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> 
v5/dictionary/metatype.1452647175.txt.gz · Last modified: 2017/04/21 11:27 (external edit)