Name
type_info (NEW )
Synopsis
@type_info = $dbh->type_info($data_type);
Warning: This method is experimental and may change.
Returns
a
list of hash references holding information about one or more
variants of $data_type
. The list is ordered by
DATA_TYPE
first and then by how closely each type
maps to the corresponding ODBC SQL datatype, closest first. If called
in a scalar context then only the first (best) element is returned.
If $data_type
is undefined or
SQL_ALL_TYPES
, then the list will contain hashes
for all datatype variants supported by the database and driver.
If $data_type
is an array reference, then
type_info
returns the information for the
first type in the array that has any matches.
The keys of the hash follow the same letter case conventions as the rest of the DBI (see "Naming Conventions and Name Space”). The following items should exist:
- TYPE_NAME (string)
Datatype name for use in
CREATE
TABLE
statements, etc.- DATA_TYPE (integer)
SQL datatype number.
- COLUMN_SIZE (integer)
For numeric types, this is either the total number of digits (if the
NUM_PREC_RADIX
value is10
) or the total number of bits allowed in the column (ifNUM_PREC_RADIX
is2
).For string types, this is the maximum size of the string in bytes.
For date and interval types, this is the maximum number of characters needed to display the value.
- LITERAL_PREFIX (string)
Characters used to prefix a literal. A typical prefix is "
'
" for characters, or possibly "0x
" for binary values passed as hexadecimal. NULL (undef ...
Get Programming the Perl DBI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.