X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FTest%2FSQLite.pm;h=5023e8cdfd496e5a8fc1cdfdf6248402c3de375a;hb=8fcf21b3a6e010f16ff278b9170a14a0858da388;hp=02d300d09938563e0796e6017b7e1bfb41290fdd;hpb=ea2e61bf5bb7187dc5e56513cd66c272d71d5074;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Test/SQLite.pm b/lib/DBIx/Class/Test/SQLite.pm index 02d300d..5023e8c 100644 --- a/lib/DBIx/Class/Test/SQLite.pm +++ b/lib/DBIx/Class/Test/SQLite.pm @@ -2,7 +2,7 @@ package DBIx::Class::Test::SQLite; =head1 NAME -DBIx::Class::Test::SQLite - Base class for DBIx::Class tests, shamelessly ripped from Class::DBI::Test::SQLite +DBIx::Class::Test::SQLite - Base class for running Class::DBI tests against DBIx::Class compat layer, shamelessly ripped from Class::DBI::Test::SQLite =head1 SYNOPSIS @@ -22,26 +22,30 @@ DBIx::Class::Test::SQLite - Base class for DBIx::Class tests, shamelessly ripped =head1 DESCRIPTION -This provides a simple base class for DBIx::Class tests using SQLite. -Each class for the test should inherit from this, provide a create_sql() -method which returns a string representing the SQL used to create the -table for the class, and then call set_table() to create the table, and -tie it to the class. +This provides a simple base class for DBIx::Class::CDBICompat tests using +SQLite. Each class for the test should inherit from this, provide a +create_sql() method which returns a string representing the SQL used to +create the table for the class, and then call set_table() to create the +table, and tie it to the class. =cut use strict; -use base 'DBIx::Class'; +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/PK::Auto::SQLite CDBICompat Core DB/); + use File::Temp qw/tempfile/; my (undef, $DB) = tempfile(); END { unlink $DB if -e $DB } -my @DSN = ("dbi:SQLite:dbname=$DB", '', '', { AutoCommit => 1 }); +my @DSN = ("dbi:SQLite:dbname=$DB", '', '', { AutoCommit => 1, RaiseError => 1 }); __PACKAGE__->connection(@DSN); __PACKAGE__->set_sql(_table_pragma => 'PRAGMA table_info(__TABLE__)'); __PACKAGE__->set_sql(_create_me => 'CREATE TABLE __TABLE__ (%s)'); +__PACKAGE__->storage->dbh->do("PRAGMA synchronous = OFF"); =head1 METHODS @@ -62,11 +66,13 @@ sub set_table { sub _create_test_table { my $class = shift; - my @vals = $class->sql__table_pragma->select_row; - $class->sql__create_me($class->create_sql)->execute unless @vals; + my @vals = $class->sql__table_pragma->select_row; + $class->sql__create_me($class->create_sql)->execute unless @vals; } -=head2 create_sql (abstract) +=head2 create_sql + +This is an abstract method you must override. sub create_sql { return q{