File Coverage

blib/lib/Parse/Dia/SQL/Const.pm
Criterion Covered Total %
statement 18 24 75.0
branch 0 2 0.0
condition n/a
subroutine 6 8 75.0
pod 4 4 100.0
total 28 38 73.6


line stmt bran cond sub pod time code
1             package Parse::Dia::SQL::Const;
2              
3             # $Id: Const.pm,v 1.8 2009/04/01 07:31:10 aff Exp $
4              
5             =pod
6              
7             =head1 NAME
8              
9             Parse::Dia::SQL::Const - Constants and lookup methods
10              
11             =head1 SYNOPSIS
12              
13             use Parse::Dia::SQL::Const;
14             my $const = Parse::Dia::SQL::Const->new();
15             my @rdbms = $const->get_rdbms();
16              
17             =head1 DESCRIPTION
18              
19             This module contains constants and related lookup methods.
20              
21             =cut
22              
23              
24 4     4   8268 use warnings;
  4         6  
  4         101  
25 4     4   12 use strict;
  4         4  
  4         70  
26              
27 4     4   12 use lib q{lib};
  4         7  
  4         29  
28 4     4   1362 use Parse::Dia::SQL::Logger;
  4         18  
  4         701  
29              
30             # List of supported relational database management systems
31             my @RDBMS = qw (
32             db2
33             html
34             informix
35             ingres
36             innodb
37             mssql
38             mysql-innodb
39             mysql-myisam
40             oracle
41             postgres
42             sas
43             sqlite3
44             sqlite3fk
45             sybase
46             );
47              
48             my %OUTPUT_CLASS = (
49             'db2' => 'Parse::Dia::SQL::Output::DB2',
50             'html' => 'Parse::Dia::SQL::Output::HTML',
51             'informix' => 'Parse::Dia::SQL::Output::Informix',
52             'ingres' => 'Parse::Dia::SQL::Output::Ingres',
53             'innodb' => 'Parse::Dia::SQL::Output::InnoDB',
54             'mssql' => 'Parse::Dia::SQL::Output::MSSQL',
55             'mysql-innodb' => 'Parse::Dia::SQL::Output::MySQL::InnoDB',
56             'mysql-myisam' => 'Parse::Dia::SQL::Output::MySQL::MyISAM',
57             'oracle' => 'Parse::Dia::SQL::Output::Oracle',
58             'postgres' => 'Parse::Dia::SQL::Output::Postgres',
59             'sas' => 'Parse::Dia::SQL::Output::SAS',
60             'sqlite3' => 'Parse::Dia::SQL::Output::SQLite3',
61             'sqlite3fk' => 'Parse::Dia::SQL::Output::SQLite3fk',
62             'sybase' => 'Parse::Dia::SQL::Output::Sybase',
63             );
64              
65             # Each statement type must be generated in correct order
66             my @SMALL_PACK_GEN_SEQ = qw (
67             pre
68             post
69             table
70             pk
71             columns
72             index
73             typemap
74             macropre
75             macropost
76             );
77              
78              
79             =head2 new
80              
81             The constructor. No arguments.
82              
83             =cut
84              
85             sub new {
86 2     2 1 1192 my ( $class, %param ) = @_;
87 2         2 my $self = {};
88              
89 2         7 bless( $self, $class );
90 2         8 return $self;
91             }
92              
93             =head2 get_rdbms
94              
95             Return list of supported databases.
96              
97             =cut
98              
99             sub get_rdbms {
100 2     2 1 702 my $self = shift;
101 2         10 return @RDBMS;
102             }
103              
104             =head2 get_small_pack_gen_seq
105              
106             Return list with sequence for small packages processing.
107              
108             =cut
109              
110             sub get_small_pack_gen_seq {
111 0     0 1   my $self = shift;
112 0           return @SMALL_PACK_GEN_SEQ;
113             }
114              
115              
116             =head2 get_class_name
117              
118             Database to class lookup. Used by Output->new.
119              
120             =cut
121              
122             sub get_class_name {
123 0     0 1   my ($self, $db) = @_;
124 0 0         if (exists($OUTPUT_CLASS{$db})) {
125 0           return $OUTPUT_CLASS{$db};
126             } else {
127 0           return;
128             }
129             }
130              
131             1;
132              
133             __END__