Я думал, что смогу поделиться тем, что у меня есть. Поскольку native_type и pdo_type возвращают такие резко отличающиеся значения, я использую «len», чтобы попытаться проверить строки на наличие текста и текста, поскольку все, что меньше 255, это var char, int или boolean. Кроме того, pdo_type имеет только 5 возможных значений.
//PDO data types
$types = array(
PDO::PARAM_BOOL => 'bool',
PDO::PARAM_NULL => 'null',
PDO::PARAM_INT => 'int',
PDO::PARAM_STR => 'string',
PDO::PARAM_LOB => 'blob',
PDO::PARAM_STMT => 'statement' //Not used right now
);
//Get meta
$column = $result->getColumnMeta(1);
//If the column lenght isn't set - default to ZERO
$column['len'] = isset($column['len']) ? $column['len'] : 0;
//HACK: If it is longer than 255 chars then it is a text area
if($column['len'] > 255) {
$column['type'] = 'text';
} else {
$column['type'] = $types[$column['pdo_type']];
}