summaryrefslogtreecommitdiff
path: root/lib/Test/Database/Driver/SQLite.pm
blob: 5e21e5c990b777f6ac606dfaf57b57ee80deb796 (plain)
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
package Test::Database::Driver::SQLite;
$Test::Database::Driver::SQLite::VERSION = '1.112';
use strict;
use warnings;

use Test::Database::Driver;
our @ISA = qw( Test::Database::Driver );

use DBI;
use File::Spec;

sub is_filebased {1}

sub _version { return DBI->connect( $_[0]->driver_dsn() )->{sqlite_version}; }

sub dsn {
    my ( $self, $dbname ) = @_;
    return $self->make_dsn(
        dbname => File::Spec->catdir( $self->base_dir(), $dbname ) );
}

sub drop_database {
    my ( $self, $dbname ) = @_;
    my $dbfile = File::Spec->catfile( $self->base_dir(), $dbname );
    unlink $dbfile;
}

'SQLite';

__END__

=head1 NAME

Test::Database::Driver::SQLite - A Test::Database driver for SQLite

=head1 SYNOPSIS

    use Test::Database;
    my @handles = Test::Database->handles( 'SQLite' );

=head1 DESCRIPTION

This module is the L<Test::Database> driver for L<DBD::SQLite>.

=head1 SEE ALSO

L<Test::Database::Driver>

=head1 AUTHOR

Philippe Bruhat (BooK), C<< <book@cpan.org> >>

=head1 COPYRIGHT

Copyright 2008-2010 Philippe Bruhat (BooK), all rights reserved.

=head1 LICENSE

This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut