I'm finding I frequently need to convert the DBI type metadata
from a result set into a string representation (either for display purposes,
or to generate additional queries).
Is there a need/desire to add a new $sth metadata item
TYPE_STRING that would contain that info, eg,
$sth->{TYPE}->[0] == SQL_INTEGER => $sth->{TYPE_STRING}->[0] = 'INTEGER'
$sth->{TYPE}->[0] == SQL_DECIMAL,
$sth->{PRECISION}->[0] == 10,
$sth->{SCALE}->[0] == 2 => $sth->{TYPE_STRING}->[0] = 'DECIMAL(10,2)'
etc.
This appears to be one of those things that could have a default
implemention at the DBI layer, but overridden by the driver. This is a bit
more convenient than reconstructing things from type_info(), esp. since
precision/scale would already be supplied.
Since I've coded this translation about a dozen times
now, I could probably whip up a patch to DBI for the default.
(Probably based on type_info(), if driver provides it, else just
a best guess)
Opinions ? Have I overlooked something like this thats already in the DBI ?
Dean Arnold
Presicient Corp.
www.presicient.com