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