NAME

DBIO::Oracle::Introspect - Introspect an Oracle database via all_* views

VERSION

version 0.900000

DESCRIPTION

DBIO::Oracle::Introspect reads the live state of an Oracle database via the all_* data dictionary views (all_tables, all_tab_columns, all_indexes, all_constraints, etc.). It is the source side of the test-deploy-and-compare strategy used by DBIO::Oracle::Deploy.

my $intro = DBIO::Oracle::Introspect->new(
    dbh => $dbh,
    schema => 'MYUSER',
);
my $model = $intro->model;

Model shape:

{
    tables       => { $name => { ... } },
    columns      => { $table => [ { ... }, ... ] },
    indexes      => { $table => { $name => { ... } } },
    foreign_keys => { $table => [ { ... }, ... ] },
    primary_keys => { $table => [ $col, ... ] },
    unique_constraints => { $table => [ [ $name => \@cols ], ... ] },
}

The Oracle introspection is built on the all_* data dictionary views, providing sequence detection via trigger inspection, LOB type handling, and other Oracle-specific behaviors.

ATTRIBUTES

schema

Schema (user) name to introspect. Defaults to the current connected user (via SELECT USER FROM DUAL).

METHODS

table_columns_info

my \%info = %{ $intro->table_columns_info($key) };

Hashref of normalized per-column metadata. The Oracle override adds the sequence field (populated from BEFORE INSERT trigger inspection) on top of the canonical data_type / size / is_nullable / default_value / is_auto_increment fields.

table_pk_info

my \@pk_cols = @{ $intro->table_pk_info($key) };

Ordered list of primary key column names. The Oracle introspector populates PKs in a separate primary_keys section (keyed by table), not as is_pk flags on the columns -- so the canonical default, which walks the columns section, would return an empty list. This override reads the dedicated section.

table_fk_info

my \@fks = @{ $intro->table_fk_info($key) };

Each FK is a hashref in the normalized contract shape. The Oracle override adds is_deferrable to attrs -- the canonical implementation drops it, and the Oracle storage layer (ALTER SESSION SET CONSTRAINTS = DEFERRED) needs to know whether a constraint is DEFERRABLE.

view_definition

SQL text of the view definition, or undef. Read from all_views (a LONG column, so LongReadLen is raised for the fetch).

NORMALIZED CONTRACT

The canonical DBIO::Introspect::Base contract methods (table_keys, table_columns, table_uniq_info, table_is_view) are inherited unchanged -- the Oracle model uses bare table names as keys and a unique_constraints section, both of which match the canonical shape. The four methods below override the base to surface Oracle-specific data that the canonical model would drop.

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 209:

Unknown directive: =seealso