ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:metatype

metaType

Syntax
string metaType(
       mixed $dataType
       )

Description

The function metaType() accepts as an argument a native, database-specific type. This is usually the result of a call to fetchField(), and can be given either as a string, or an ADOFieldObject.

It returns an ADOdb standard datatype, which provides a mapping to allow cross-database compatibility.

Usage

/*
* 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'
v5/dictionary/metatype.txt · Last modified: 2021/03/09 10:41 by dregad