NAME
DBIO::Informix::Storage - Base Storage Class for Informix Support
VERSION
version 0.900007
DESCRIPTION
Storage driver for IBM Informix databases. Implements autoincrement column retrieval via the ix_sqlerrd statement handle attribute, savepoint support, deferred foreign key checks via SET CONSTRAINTS, and datetime formatting using DateTime::Format::Strptime. Uses the SkipFirst SQL limit dialect and double-quote quoting. DDL is transactional (in a logged database), so a failing deploy is rolled back whole.
METHODS
deploy_setup
No-op stub to satisfy the DBIO::Storage::DBI interface. Informix does not require special setup for deployments.
_connect
Sets DELIMIDENT=y in the environment for the duration of the connect. The storage quotes identifiers with ", and Informix reads a double-quoted token as an identifier only when DELIMIDENT is set at connect time; without it every quoted statement is a -201 syntax error.
Also sets DBDATE=MDY4/ for the connect and hides DBCENTURY and GL_DATE. The client reads these when it connects and then formats and reads every DATE that way, but the storage writes and parses a DATE as %m/%d/%Y; under a caller's DBDATE=DMY4. the ninth of November would be stored as the eleventh of September, and a day above 12 refused. With the format pinned, a DATE goes in and comes back as the same day whatever the caller's DBDATE, DBCENTURY or GL_DATE hold. The caller's environment is left as it was.
_exists_value_sql
The statement behind results_exist (ADR 0037): core's CASE WHEN EXISTS with FROM systables WHERE tabid = 1 appended, the one-row selection every Informix database has. Together with the declared supports_exists_query capability.
_set_operation_keyword
UNION, UNION ALL, INTERSECT and EXCEPT are core's ANSI spelling. intersect_all and except_all are refused (ADR 0039): Informix answers INTERSECT ALL and EXCEPT ALL with SQL -201.
_random_function
Refuses. Informix has no random-number function (SQL -674 for RANDOM(), RAND() and DBMS_RANDOM), so $rs->rand throws, saying why.
_explain_query
Refuses (ADR 0040 section 7). Informix writes a plan only to the file sqexplain.out on the server (SET EXPLAIN), where no statement of the connection can read it back, so $rs->explain throws before any statement is issued.
_connect_params_dsn
The DSN of connection parameters (ADR 0057): dbi:Informix:database or, with a host, dbi:Informix:database@host, where the host is the DBSERVERNAME of the sqlhosts file. A port is refused -- it belongs to the sqlhosts entry -- as is a missing dbname.
_bind_host_into_dsn
The seam of a DBIO::AccessBroker::HostBound view: replaces (or adds) the server of dbi:Informix:database[@server]. A view with a port and any other form of DSN decline.
last_insert_id
Returns the last autoincrement value inserted into the database, retrieved from the ix_sqlerrd attribute of the most recently executed statement handle.
bind_attribute_by_data_type
A TEXT or BYTE column takes a parameter only when the statement is told the type: an UPDATE ... SET t = ? with a plain parameter dies with -608 (Illegal attempt to convert Text/Byte blob type). text and the like are bound as SQL_LONGVARCHAR, blob and the like as SQL_LONGVARBINARY (measured, Informix 15.0.1, DBD::Informix 2018.1031).
with_deferred_fk_checks
$storage->with_deferred_fk_checks(sub { ... });
Runs the supplied coderef with all foreign key constraints set to DEFERRED. Constraints are restored to IMMEDIATE after the coderef, before the commit (which is when the deferred checks run), and the enclosing transaction is committed.
connect_call_datetime_setup
Used as:
on_connect_call => 'datetime_setup'
In connect_info to set the DATETIME format.
Sets the environment variable (for the rest of the process):
GL_DATETIME="%Y-%m-%d %H:%M:%S.%F5"
The DATE format is not set here: the client reads DBDATE, DBCENTURY and GL_DATE when it connects, so the storage pins the format during the connect itself (see "_connect") and leaves those variables of the caller untouched.
The DATETIME data type supports up to 5 digits after the decimal point for second precision, depending on how you have declared your column. The full possible precision is used.
The column declaration for a DATETIME with maximum precision is:
column_name DATETIME YEAR TO FRACTION(5)
The DATE data type stores the date portion only, and it MUST be declared with:
data_type => 'date'
in your Result class.
You will need the DateTime::Format::Strptime module for inflation to work.
Statements rewritten or refused before the DBD
_gen_sql_bind looks at the statement the SQL maker wrote:
a
/* ... */comment is removed (a?in it is counted as a placeholder by DBD::Informix, -254;{ ... }and--comments and/*+ ... */optimizer directives are left alone);INSERT INTO t DEFAULT VALUES, which Informix does not know (-201), becomesINSERT INTO t (id) VALUES (0)for a source with an auto-increment column (aSERIALtakes the next value for 0), elseINSERT INTO t (c) VALUES (NULL)for its first nullable column;a value bound against a TEXT or BYTE column of a
SELECTis refused with a DBIO::Exception that names table and column: Informix allows neither in a comparison (-615, Blobs are not allowed in this expression), not even cast to a character type (-9634).
SEE ALSO
DBIO::Informix - Informix schema component
DBIO::Storage::DBI - Base DBI storage class
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.