Oracle/Introspect/Tables.pm

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