}
sub _sqlite_dbfilename {
- return "t/var/DBIxClass.db";
+ my $self = shift;
+ my %args = @_;
+ return "t/var/DBIxClass.db" if $args{sqlite_use_file} or $ENV{"DBICTEST_SQLITE_USE_FILE"};
+ return ":memory:";
}
sub _database {
my $self = shift;
- my $db_file = $self->_sqlite_dbfilename;
+ my %args = @_;
+ my $db_file = $self->_sqlite_dbfilename(%args);
unlink($db_file) if -e $db_file;
unlink($db_file . "-journal") if -e $db_file . "-journal";
my %args = @_;
my $schema;
-
+
if ($args{compose_connection}) {
$schema = DBICTest::Schema->compose_connection(
- 'DBICTest', $self->_database
+ 'DBICTest', $self->_database(%args)
);
} else {
$schema = DBICTest::Schema->compose_namespace('DBICTest');
$schema->storage_type($args{storage_type});
}
if ( !$args{no_connect} ) {
- $schema = $schema->connect($self->_database);
+ $schema = $schema->connect($self->_database(%args));
$schema->storage->on_connect_do(['PRAGMA synchronous = OFF'])
unless $self->has_custom_dsn;
}
my $args = shift || {};
if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
-
-#$schema->create_ddl_dir([qw/MySQL/], $schema->VERSION, '.', undef, $args);
-$schema->deploy($args);
-
+ $schema->deploy($args);
} else {
open IN, "t/lib/sqlite.sql";
my $sql;
[ 1, 2 ],
[ 1, 3 ],
]);
-
- # $schema->populate('TreeLike', [
- # [ qw/id parent name/ ],
- # [ 0, 0, 'root' ],
- # [ 1, 0, 'foo' ],
- # [ 2, 1, 'bar' ],
- # [ 5, 1, 'blop' ],
- # [ 3, 2, 'baz' ],
- # [ 4, 3, 'quux' ],
- # [ 6, 2, 'fong' ],
- # ]);
+
+ $schema->populate('TreeLike', [
+ [ qw/id parent name/ ],
+ [ 1, undef, 'root' ],
+ [ 2, 1, 'foo' ],
+ [ 3, 2, 'bar' ],
+ [ 6, 2, 'blop' ],
+ [ 4, 3, 'baz' ],
+ [ 5, 4, 'quux' ],
+ [ 7, 3, 'fong' ],
+ ]);
$schema->populate('Track', [
[ qw/trackid cd position title/ ],