You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be nice to be able to use DBI with a mocked sqlite file.
The following sample is failing on ping and does not see the file as created.
Not sure how easy it would be to fix it.
note that it seems that we can write/read to it, probably because it fall back to in memory
#!perluse Test::More;
use Test::MockFile;
use DBI;
my$f = q[/tmp/mydb.sqlite];
unlink$f;
# Comment me to run unmockedmy$mocked = Test::MockFile->file( $f );
my$dbh = DBI->connect("dbi:SQLite:dbname=$f","","", {
AutoCommit=> 1,
RaiseError=> 1,
});
ok $dbh->ping, 'ping';
ok $dbh->do( <<EOS ), 'create table';
CREATE TABLE groups ( id INTEGER PRIMARY KEY, name TEXT NOT NULL)EOSmy$sth = $dbh->prepare("INSERT INTO groups VALUES (?, ?)");
ok $sth->execute(1=>q[group one] );
note explain [ $dbh->selectall_array("select * from groups") ];
ok -f$f, 'sqlite file created';
output
╰─> perl test.pl
not ok 1 - ping
# Failed test 'ping'
# at test.pl line 21.
ok 2 - create table
ok 3
# [
# [
# 1,
# 'group one'
# ]
# ]
not ok 4 - sqlite file created
note: consider running DBI_TRACE=2 perl test.pl
The text was updated successfully, but these errors were encountered:
Would be nice to be able to use DBI with a mocked sqlite file.
The following sample is failing on
ping
and does not see the file as created.Not sure how easy it would be to fix it.
note that it seems that we can write/read to it, probably because it fall back to in memory
output
note: consider running
DBI_TRACE=2 perl test.pl
The text was updated successfully, but these errors were encountered: