File: TableInfo.pm

package info (click to toggle)
libdbd-firebird-perl 0.91-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 680 kB
  • sloc: perl: 4,085; ansic: 2,262; makefile: 14
file content (27 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (3)
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
use strict;

package DBD::Firebird::TableInfo;

sub factory {
    my (undef, $dbh) = @_;
    my ($vers, $klass);

    $vers = $dbh->func('version', 'ib_database_info')->{version};

    $dbh->trace_msg("TableInfo factory($dbh [$vers])");

    if ($vers =~ /firebird (\d\.\d+)/i and $1 >= 2.1) {
        $klass = 'DBD::Firebird::TableInfo::Firebird21';
    } else {
        $klass = 'DBD::Firebird::TableInfo::Basic';
    }

    eval "require $klass";
    if ($@) {
        $dbh->set_err(1, "DBD::Firebird::TableInfo factory: $@");
        return undef;
    }
    $klass->new() if $klass;
}

1;