1 package DBIx::Class::Storage::DBI::SQLite;
9 use base qw/DBIx::Class::Storage::DBI::MultiDistinctEmulation/;
11 sub _dbh_last_insert_id {
12 my ($self, $dbh, $source, $col) = @_;
13 $dbh->func('last_insert_rowid');
20 ## Where is the db file?
21 my $dsn = $self->connect_info()->[0];
23 my $dbname = $1 if($dsn =~ /dbname=([^;]+)/);
26 $dbname = $1 if($dsn =~ /^dbi:SQLite:(.+)$/i);
28 $self->throw_exception("Cannot determine name of SQLite db file")
29 if(!$dbname || !-f $dbname);
31 # print "Found database: $dbname\n";
32 my $dbfile = file($dbname);
33 # my ($vol, $dir, $file) = File::Spec->splitpath($dbname);
34 my $file = $dbfile->basename();
35 $file = strftime("%y%m%d%h%M%s", localtime()) . $file;
36 $file = "B$file" while(-f $file);
38 my $res = copy($dbname, $file);
39 $self->throw_exception("Backup failed! ($!)") if(!$res);
48 DBIx::Class::PK::Auto::SQLite - Automatic primary key class for SQLite
52 # In your table classes
53 __PACKAGE__->load_components(qw/PK::Auto Core/);
54 __PACKAGE__->set_primary_key('id');
58 This class implements autoincrements for SQLite.
62 Matt S. Trout <mst@shadowcatsystems.co.uk>
66 You may distribute this code under the same terms as Perl itself.