NAME

DBIO::Sybase::Introspect - Introspect a Sybase ASE database via its system catalog

VERSION

version 0.900007

DESCRIPTION

DBIO::Sybase::Introspect reads the live state of a Sybase ASE database from its system catalog -- sysobjects, syscolumns, systypes, syscomments, sysindexes (with index_col()) and sysreferences. SAP ASE ships no INFORMATION_SCHEMA views (that is SQL Server and the ANSI catalog); a query against them is Msg 208 on ASE 16.0. It is both sides of the test-deploy-and-compare strategy used by DBIO::Sybase::Deploy: the live database and the temporary one the desired schema is deployed into are read by this class alike, so every value it reports must come out the same for two deployments of the same DDL.

my $intro = DBIO::Sybase::Introspect->new(dbh => $dbh);
my $model = $intro->model;

Model shape (canonical — single-schema, un-qualified keys):

{
    tables       => { $name => { ... } },
    columns      => { $table => [ { ... }, ... ] },
    indexes      => { $table => { $name => { ... } } },
    foreign_keys => { $table => [ { constraint_name, from_columns,
                                    to_table, to_columns,
                                    on_update, on_delete } ] },
    views        => { $name => { view_name, definition, depends_on } },
}

A view is listed in tables (kind view) with its columns, and in views with the text after AS and the views it reads from (DBIO::Sybase::Introspect::Views).

The FK rows in foreign_keys are pre-grouped per constraint (one entry per FK, with from_columns / to_columns as arrayrefs) so the default "table_fk_info" in DBIO::Introspect::Base contract method applies unchanged. Each entry also carries constraint_name -- the live, server-assigned name -- so the diff layer can DROP/ALTER a foreign key by its real name instead of a generated one (see ADR 0021; constraint_name is FK metadata, not a compared attribute).

ATTRIBUTES

schema

Schema name to introspect. Defaults to dbo.

METHODS

view_definition

SQL text of the view definition (the SELECT), or undef. Read from syscomments, where ASE keeps the whole CREATE VIEW statement split over rows of at most 255 characters; the rows are joined and the CREATE VIEW ... AS head is stripped.

SEE ALSO

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.