NAME

DBIO::Firebird::Introspect - Introspect a Firebird database via rdb$ system tables

VERSION

version 0.900000

DESCRIPTION

DBIO::Firebird::Introspect reads the live state of a Firebird database via the rdb$* system tables and returns a unified model hashref. It is the source side of the test-deploy-and-compare strategy used by DBIO::Firebird::Deploy.

my $intro = DBIO::Firebird::Introspect->new(dbh => $dbh);
my $model = $intro->model;
# $model->{tables}, $model->{columns}, $model->{indexes},
# $model->{unique_constraints}, $model->{foreign_keys}

The model is built lazily on first access and has five top-level sections: tables, columns, indexes, unique_constraints, and foreign_keys (views are surfaced within the tables section, not as a separate top-level key). On top of it, this class implements the normalized generation contract from DBIO::Introspect::Base so it can act as a DBIO::Generate source.

THE INTROSPECTED MODEL

The model hashref returned by "model" is the shared substrate of this distribution: produced here by the Introspect::* helpers, consumed by DBIO::Firebird::Diff (table/column/index comparison) and by the "NORMALIZED CONTRACT" methods below (the DBIO::Generate source). It has exactly five top-level sections — tables, columns, indexes, unique_constraints, and foreign_keys — each a hashref keyed by table name (Firebird has no schemas, so keys are bare, un-qualified relation names).

tables

{ $table_name => { table_name => $name, kind => 'table' | 'view' } }

columns

{ $table_name => [ \%column, ... ] }   # in rdb$field_position order

Each column hashref:

  • column_name — the column name.

  • data_type — the bare SQL type (e.g. 'integer', 'decimal', 'varchar'). Size/precision is not folded in here; it lives in size.

  • sizeundef, a scalar length (varchar/char), or an [ precision, scale ] pair (decimal/numeric). Rendered to SQL via "render_size" in DBIO::Firebird::Type.

  • not_null1 if the column is NOT NULL, else 0 (from rdb$null_flag).

  • default_value — the column default expression, or undef.

  • is_pk / pk_position — primary-key membership and 0-based position (rdb$field_position).

indexes

{ $table_name => { $index_name => { index_name, is_unique, columns => [...] } } }

Indexes backed by PRIMARY KEY / UNIQUE constraints are excluded — they belong to the table definition, not an explicit CREATE INDEX.

unique_constraints

{ $table_name => [ [ $constraint_name, \@column_names ], ... ] }

UNIQUE constraints (distinct from the CREATE UNIQUE INDEX objects in indexes), sorted by constraint name. Source of the table_uniq_info contract method.

foreign_keys

{ $table_name => [ \%fk, ... ] }

Each FK hashref: fk_id, from_table, from_columns, to_table, to_columns, and the referential actions on_update, on_delete, match (from rdb$ref_constraints).

NORMALIZED CONTRACT

The DBIO::Generate generation contract (table_keys, table_columns, table_columns_info, table_pk_info, table_uniq_info, table_fk_info, table_is_view) is inherited unchanged from DBIO::Introspect::Base: the model built by "_build_model" follows the canonical single-schema shape (see "CANONICAL MODEL" in DBIO::Introspect::Base) that those default implementations read, so no Firebird-specific override is needed. In particular unique_constraints is the authoritative source for table_uniq_info, and FK remote_schema is always undef (Firebird has no schemas).

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 152:

Unknown directive: =seealso