NAME

DBIO::Informix::Types - Canonical Informix type vocabulary

VERSION

version 0.900007

DESCRIPTION

DBIO::Informix::Types is the single source of truth for the Informix type vocabulary. It maps both ends of the introspect/deploy round-trip:

  • the Informix syscolumns.coltype number (already taken modulo 256) to a logical type name (logical_for_coltype, with size_for_coltype for the size), used by DBIO::Informix::Introspect::Columns;

  • a logical type name to the Informix SQL type string emitted in DDL (ddl_type), used by DBIO::Informix::DDL.

The logical type name is the shared contract between the two sides. Keeping both mappings here means a new type is added in one place, not two.

METHODS

logical_for_coltype

my $logical = logical_for_coltype($coltype, $collength, $extended_id);

Maps an Informix coltype number (taken modulo 256) to a logical type name. A DATETIME comes out with its qualifiers decoded from $collength (datetime year to second); a fixed-length opaque type (coltype 41) is told apart by $extended_id (boolean, blob, clob). Returns 'unknown' for an unmapped coltype.

qualifier_for_coltype

my $q = qualifier_for_coltype($coltype, $collength);   # 'YEAR TO DAY'

The qualifier of a DATETIME ($coltype 10) or INTERVAL (14) column, decoded from $collength, as the SQL writes it after the type or after a literal (DATETIME(2026-01-01) YEAR TO DAY). The first field of an INTERVAL carries its leading precision (DAY(3) TO DAY, YEAR(4) TO MONTH): collength holds the number of digits of the whole value in its high byte, the later fields are two digits each and a fraction its own. Undef for another type or a code it does not know.

size_for_coltype

my $size = size_for_coltype($coltype, $collength);

The size of the introspected model from syscolumns.collength, or undef for a type without one: the maximum of a varchar/nvarchar (collength is min * 256 + max), the length of a char, nchar or lvarchar, and [precision, scale] of a decimal or money (collength is precision * 256 + scale; scale 255 is a floating decimal(p) and gives [precision]).

ddl_type

my $sql_type = ddl_type($logical, $size);

Maps a logical type name to the Informix SQL type string for DDL. Sized types (varchar, char, lvarchar, ...) render as TYPE($size), defaulting to 255 when no size is given. decimal/numeric take $size as a [precision, scale] arrayref and render as TYPE(precision,scale). Unknown logical types pass through unchanged (preserving their original case).

lob_kind

lob_kind($data_type, $size);   # 'text', 'binary' or undef

'text' for a column written as TEXT (text, clob, mediumtext, longtext, a string without a size), 'binary' for a BYTE (blob, bytea, binary, varbinary, byte), undef for everything else. Informix takes neither of the two in a comparison (-615), and a parameter for them is bound with an explicit type ("bind_attribute_by_data_type" in DBIO::Informix::Storage).

is_numeric_type

is_numeric_type($data_type);

True when a column of this data_type holds a number (the integer types, serial, decimal, numeric, money, the floating point types). The storage refuses a bound value that is no number for such a column.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.