X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FSQLite.pm;h=95122b1edabfe13453d82f7d5e93273dc2453518;hb=4225194590a09e29451ba825c34483f98c1a0c03;hp=5e125c9c8cd8196dfc3dd76387d9a6b355c5999c;hpb=d2f21b377c36ca386492605c7b2c571eed09c0f6;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/SQLite.pm b/lib/DBIx/Class/Storage/DBI/SQLite.pm index 5e125c9..95122b1 100644 --- a/lib/DBIx/Class/Storage/DBI/SQLite.pm +++ b/lib/DBIx/Class/Storage/DBI/SQLite.pm @@ -2,12 +2,14 @@ package DBIx::Class::Storage::DBI::SQLite; use strict; use warnings; + +use base qw/DBIx::Class::Storage::DBI/; +use mro 'c3'; + use POSIX 'strftime'; use File::Copy; use File::Spec; -use base qw/DBIx::Class::Storage::DBI/; - sub _dbh_last_insert_id { my ($self, $dbh, $source, $col) = @_; $dbh->func('last_insert_rowid'); @@ -45,6 +47,24 @@ sub backup return $backupfile; } +sub deployment_statements { + my $self = shift;; + my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_; + + $sqltargs ||= {}; + + my $sqlite_version = $self->_get_dbh->{sqlite_version}; + + # numify, SQLT does a numeric comparison + $sqlite_version =~ s/^(\d+) \. (\d+) (?: \. (\d+))? .*/${1}.${2}/x; + + $sqltargs->{producer_args}{sqlite_version} = $sqlite_version; + + $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest); +} + +sub datetime_parser_type { return "DateTime::Format::SQLite"; } + 1; =head1 NAME @@ -54,7 +74,7 @@ DBIx::Class::Storage::DBI::SQLite - Automatic primary key class for SQLite =head1 SYNOPSIS # In your table classes - __PACKAGE__->load_components(qw/PK::Auto Core/); + use base 'DBIx::Class::Core'; __PACKAGE__->set_primary_key('id'); =head1 DESCRIPTION