NAME

DBIO::Informix::Introspect::ForeignKeys - Introspect Informix foreign keys

VERSION

version 0.900007

DESCRIPTION

Fetches foreign key metadata via sysconstraints (constrtype = 'R') and sysreferences. Column numbers are resolved to names: the referencing side through sysconstraints.idxname -> sysindexes.part1..16 -> syscolumns.colno of the child table; the referenced side through sysreferences.primary -> that constraint's idxname -> sysindexes -> syscolumns of the table sysreferences.ptabid. Only the tables passed in are read, in the database named by $schema (validated, \w+).

Measured against Informix 15.0.1: the sysreferences columns matchtype, updrule, delrule exist and answer as documented (N, R, and R or C). They are documented (HCL OneDB SQL reference, sysreferences, https://help.hcl-software.com/onedb/1.0.1/sqr/ids_sqr_055.html): delrule is C (cascading delete) or R (restrict, the default); updrule and matchtype are reserved and always show R and N. The result keys are the raw match, upd_rule and del_rule; DBIO::Informix::Introspect maps them to the canonical on_update and on_delete.

METHODS

fetch

my $fks = DBIO::Informix::Introspect::ForeignKeys->fetch($dbh, $schema, $tables);

Returns a hashref keyed by table name. Each value is an arrayref of foreign key hashrefs with keys: fk_name, from_columns, to_table, to_columns, match, upd_rule, del_rule.

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.