Tripletail

 view release on metacpan or  search on metacpan

lib/Tripletail/DB/Dbh.pm  view on Meta::CPAN

package Tripletail::DB::Dbh;
use strict;
use warnings;
use Hash::Util qw(lock_hash);

sub new {
    my $class   = shift;
    my $setname = shift;
    my $dbname  = shift;

    my $this = bless {} => $class;
    $this->{setname } = $setname;
    $this->{inigroup} = $dbname;
    $this->{dbh     } = undef; # DBI-dbh
    $this->{type    } = undef; # set on connect().

    $this;
}

sub getSetName {
    return shift->{setname};
}

sub getGroup {
    return shift->{inigroup};
}

sub getDbh {
    return shift->{dbh};
}

sub ping {
    my $this = shift;

    if ($this->{dbh}) {
        return $this->{dbh}->ping;
    }
    else {
        return;
    }
}

sub getLastInsertId {
    my $this = shift;

    my $type = $this->{type};
    die __PACKAGE__."#getLastInsertId: $type is not supported. (${type}はサポートされていません)";
}

sub quote {
    my $this = shift;
    my $str  = shift;

    if (!defined $str) {
        die __PACKAGE__."#quote: arg[1] is not defined. (第1引数が指定されていません)\n";
    }
    elsif (ref $str) {
        die __PACKAGE__."#quote: arg[1] is a reference. [$str] (第1引数がリファレンスです)\n";
    }

    return $this->{dbh}->quote($str);
}

sub symquote {
    my $this = shift;
    my $str  = shift;

    if (!defined $str) {
        die __PACKAGE__."#symquote: arg[1] is not defined. (第1引数が指定されていません)\n";
    }
    elsif (ref $str) {



( run in 1.863 second using v1.01-cache-2.11-cpan-5511b514fd6 )