NAME
DBIO::Sybase::Introspect::Columns - Introspect Sybase ASE columns
VERSION
version 0.900007
DESCRIPTION
Fetches column metadata from the ASE system catalog: syscolumns joined to sysobjects / sysusers (owner) and systypes, plus syscomments for the text of column defaults. SAP ASE has no INFORMATION_SCHEMA views.
METHODS
fetch
my $columns = DBIO::Sybase::Introspect::Columns->fetch($dbh, $schema, $tables);
Given the tables hashref from DBIO::Sybase::Introspect::Tables, returns a hashref keyed by table name. Each value is an arrayref of column hashrefs in colid order with keys: column_name, data_type, not_null, default_value, is_pk, pk_position, is_auto_increment, and size where it applies.
The values are read so they re-render through DBIO::Sybase::DDL exactly as the DDL that created the column wrote them -- both sides of DBIO::Sybase::Deploy's test-deploy-and-compare are introspected, so any drift between catalog value and rendering is a phantom diff:
data_typeis thesystypesname found throughsyscolumns.usertype-- the declared type (int,bigint,numeric).syscolumns.typewould report the nullable storage variant (intn,numericn) for every nullable column.not_nullisstatus & 8clear;is_auto_incrementisstatus & 0x80.sizeissyscolumns.lengthfor character types -- halved for the UTF-16unichar/univarchar, and divided by@@ncharsizefornchar/nvarchar, whose length is the declared size times the byte width of the server's default character set (1 underiso_1, 3 underutf8) -- the byte length forbinary/varbinary,[prec, scale]fornumeric/decimal, and absent otherwise (atext/imagecolumn's length of 16 is the page pointer, not a width).default_valuecomes from thesyscommentstext behindsyscolumns.cdefault(DEFAULT 'x', orcreate default d as ...for a bound default). A single-quoted literal becomes its bare value with''unescaped -- "sybase_default_clause" in DBIO::Sybase::DDL quotes it again -- and anything else (getdate()) becomes a SCALAR ref, which that function emits verbatim. The column type decides like it does there: on a numeric column an unquoted number (DEFAULT 0,DEFAULT -1.5) is the bare literal, and a quoted text (DEFAULT '0', as other DDL writers emit it, and aVARCHARconstant every defaultedINSERTtrips over) is a SCALAR ref carrying the quotes, so a diff against the desired0sees the difference and replaces it.
is_pk / pk_position are left at 0 here: the primary key is the PK-constraint index (sysindexes.status & 2048), which DBIO::Sybase::Introspect::Indexes reads, and DBIO::Sybase::Introspect marks the columns from it.
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.