alpha_full/admin/publier/scriptsExports/functionField.php
2026-04-06 22:58:51 +02:00

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;
}
?>