| 1 | package DBIO::Sybase::Introspect::Tables; | ||||||||||||
| 2 | # ABSTRACT: Introspect Sybase ASE tables and views | ||||||||||||
| 3 | |||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | |||||||||||||
| 8 | |||||||||||||
| 9 | 0 | ▶ | sub fetch { | ||||||||||
|
Subroutine
fetch: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 10 | 0 | my ($class, $dbh, $schema) = @_; | |||||||||||
| 11 | 0 | ▶ | $schema //= 'dbo'; | ||||||||||
|
Condition0%0/2
$schema //= "dbo"
MC/DC0%0/1
$schema //= "dbo"
$schema
Truth table0%0/2
A
A= $schema
| |||||||||||||
| 12 | |||||||||||||
| 13 | 0 | my $sth = $dbh->prepare(q{ | |||||||||||
| 14 | SELECT table_name, table_type | ||||||||||||
| 15 | FROM INFORMATION_SCHEMA.TABLES | ||||||||||||
| 16 | WHERE table_schema = ? | ||||||||||||
| 17 | ORDER BY table_name | ||||||||||||
| 18 | }); | ||||||||||||
| 19 | 0 | $sth->execute($schema); | |||||||||||
| 20 | |||||||||||||
| 21 | 0 | my %tables; | |||||||||||
| 22 | 0 | ▶ | while (my $row = $sth->fetchrow_hashref) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | 0 | ▶ | my $type = lc($row->{table_type} // ''); | ||||||||||
|
Condition0%0/2
$row->{"table_type"} // ""
MC/DC0%0/1
$row->{"table_type"} // ""
$row->{"table_type"}
Truth table0%0/2
A
A= $row->{"table_type"}
| |||||||||||||
| 24 | 0 | ▶ | my $kind = $type =~ /view/ ? 'view' : 'table'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | $tables{ $row->{table_name} } = { | ||||||||||||
| 26 | table_name => $row->{table_name}, | ||||||||||||
| 27 | 0 | kind => $kind, | |||||||||||
| 28 | schema => $schema, | ||||||||||||
| 29 | }; | ||||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 0 | return \%tables; | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 1 | 1; | |||||||||||
| 36 | |||||||||||||
| 37 | __END__ | ||||||||||||
| 38 | |||||||||||||
| 39 | =pod | ||||||||||||
| 40 | |||||||||||||
| 41 | =encoding UTF-8 | ||||||||||||
| 42 | |||||||||||||
| 43 | =head1 NAME | ||||||||||||
| 44 | |||||||||||||
| 45 | DBIO::Sybase::Introspect::Tables - Introspect Sybase ASE tables and views | ||||||||||||
| 46 | |||||||||||||
| 47 | =head1 VERSION | ||||||||||||
| 48 | |||||||||||||
| 49 | version 0.900001 | ||||||||||||
| 50 | |||||||||||||
| 51 | =head1 DESCRIPTION | ||||||||||||
| 52 | |||||||||||||
| 53 | Fetches Sybase ASE table and view metadata via C<INFORMATION_SCHEMA.TABLES>. | ||||||||||||
| 54 | Skips system tables. | ||||||||||||
| 55 | |||||||||||||
| 56 | =head1 METHODS | ||||||||||||
| 57 | |||||||||||||
| 58 | =head2 fetch | ||||||||||||
| 59 | |||||||||||||
| 60 | my $tables = DBIO::Sybase::Introspect::Tables->fetch($dbh, $schema); | ||||||||||||
| 61 | |||||||||||||
| 62 | Returns a hashref keyed by table name. Each value has: C<table_name>, | ||||||||||||
| 63 | C<kind> (C<table> or C<view>), C<schema>. | ||||||||||||
| 64 | |||||||||||||
| 65 | =head1 AUTHOR | ||||||||||||
| 66 | |||||||||||||
| 67 | DBIO & DBIx::Class Authors | ||||||||||||
| 68 | |||||||||||||
| 69 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 70 | |||||||||||||
| 71 | Copyright (C) 2026 DBIO Authors | ||||||||||||
| 72 | Portions Copyright (C) 2005-2025 DBIx::Class Authors | ||||||||||||
| 73 | Based on DBIx::Class, heavily modified. | ||||||||||||
| 74 | |||||||||||||
| 75 | This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 76 | the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 77 | |||||||||||||
| 78 | =cut | ||||||||||||