DBIx::Connector::Driver::SQLite - SQLite-specific connection interface


DBIx-Connector documentation Contained in the DBIx-Connector distribution.

Index


Code Index:

Name

Top

DBIx::Connector::Driver::SQLite - SQLite-specific connection interface

Description

Top

This subclass of DBIx::Connector::Driver provides SQLite-specific implementations of the following methods:

savepoint
release
rollback_to

Note that they only work with SQLite 3.6.8 or higher; older versions of SQLite will fallback on the exception-throwing implementation of these methods in DBIx::Connector::Driver.

Authors

Top

This module was written and is maintained by:

David E. Wheeler <david@kineticode.com>

Copyright and License

Top


DBIx-Connector documentation Contained in the DBIx-Connector distribution.

package DBIx::Connector::Driver::SQLite;

use strict;
use warnings;
use base 'DBIx::Connector::Driver';
our $VERSION = '0.45';

BEGIN {
    # Only install support for savepoints if SQLite supports them.
    my ($x, $y, $z) = split /[.]/ => $DBD::SQLite::sqlite_version || 0;
    return unless $x >= 3 && $y >= 6 && $z >= 8;
    eval q{
                sub savepoint {
                        my ($self, $dbh, $name) = @_;
                        $dbh->do("SAVEPOINT $name");
                }

                sub release {
                        my ($self, $dbh, $name) = @_;
                        $dbh->do("RELEASE SAVEPOINT $name");
                }

                sub rollback_to {
                        my ($self, $dbh, $name) = @_;
                        $dbh->do("ROLLBACK TO SAVEPOINT $name");
                }
        };
    die $@ if $@;
}

1;
__END__