Firebird/Introspect/Tables.pm

filter: Statementstmt 41.1% 7 / 17 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 40.0% 10 / 25 CC 3 SCAR 20.3
CC
3
Cov
33%
fetch
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.6
« Firebird/Diff/Index.pm ↑ Summary Firebird/Diff/Table.pm »
1 package DBIO::Firebird::Introspect::Tables;
2 # ABSTRACT: Introspect Firebird tables and views via rdb$tables
3  
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8  
9 0 ▶sub fetch {
Subroutine fetch: not called CC=3 SCAR=24.8
Pod documented
10 0 my ($class, $dbh) = @_;
11  
12 0 my $sth = $dbh->prepare(q{
13 SELECT rdb$relation_name, rdb$view_source
14 FROM rdb$relations
15 WHERE rdb$system_flag = 0
16 AND rdb$relation_type IN (0, 1)
17 ORDER BY rdb$relation_name
18 });
19 0 $sth->execute;
20  
21 0 my %tables;
22 0 ▶ while (my $row = $sth->fetchrow_hashref) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $row = $sth->fetchrow_hashref) 0 0 0
23 0 my $name = $row->{'rdb$relation_name'};
24 0 $name =~ s/\s+$//;
25 0 ▶ my $kind = defined $row->{'rdb$view_source'} ? 'view' : 'table';
Branch: 1 branch
BranchTrueFalseTotal
defined $row->{'rdb$view_source'} ? : 0 0 0
26 0 $tables{$name} = {
27 table_name => $name,
28 kind => $kind,
29 };
30 }
31  
32 0 return \%tables;
33 }
34  
35 3 1;
36  
37 __END__
38  
39 =pod
40  
41 =encoding UTF-8
42  
43 =head1 NAME
44  
45 DBIO::Firebird::Introspect::Tables - Introspect Firebird tables and views via rdb$tables
46  
47 =head1 VERSION
48  
49 version 0.900001
50  
51 =head1 DESCRIPTION
52  
53 Fetches Firebird table and view metadata via C<rdb$relations>.
54  
55 =head1 METHODS
56  
57 =head2 fetch
58  
59 my $tables = DBIO::Firebird::Introspect::Tables->fetch($dbh);
60  
61 Returns a hashref keyed by table name. Each value has: C<table_name>,
62 C<kind> (C<table> or C<view>).
63  
64 =head1 AUTHOR
65  
66 DBIO & DBIx::Class Authors
67  
68 =head1 COPYRIGHT AND LICENSE
69  
70 Copyright (C) 2026 DBIO Authors
71 Portions Copyright (C) 2005-2025 DBIx::Class Authors
72 Based on DBIx::Class, heavily modified.
73  
74 This is free software; you can redistribute it and/or modify it under
75 the same terms as the Perl 5 programming language system itself.
76  
77 =cut
« Firebird/Diff/Index.pm ↑ Summary Firebird/Diff/Table.pm »