25 lines
726 B
PHP
Executable File
25 lines
726 B
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
function pdo_field_type($pdoResult, $field_offset) {
|
|
static $types;
|
|
|
|
// Utilisation de PDO pour obtenir des informations sur le champ
|
|
$columnMeta = $pdoResult->getColumnMeta($field_offset);
|
|
$type_id = $columnMeta['native_type'];
|
|
|
|
// Initialisation des types si ce n'est pas déjà fait
|
|
if (!isset($types)) {
|
|
$types = array();
|
|
$constants = get_defined_constants(true);
|
|
foreach ($constants['pdo'] as $c => $n) {
|
|
if (preg_match('/^PDO_.*TYPE_(.*)/', $c, $m)) {
|
|
$types[$n] = $m[1];
|
|
}
|
|
}
|
|
}
|
|
|
|
// Retourner le type du champ si trouvé, sinon NULL
|
|
return array_key_exists($type_id, $types) ? $types[$type_id] : NULL;
|
|
}
|
|
?>
|