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