Re: [CDBI] Re: ANNOUNCE: Ima::DBI 0.35 released
Brad Bowman <[email protected]> Tue, 12 Jun 2007 22:12:27 +1000
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Matt S Trout wrote:
> On Tue, Jun 12, 2007 at 10:07:55AM +1000, Brad Bowman wrote:
>> I ended up looking at the prepare_cached handling in Ima::DBI and CDBI
>> while trying to work around DBD::SQLite's schema error:
>> "DBD::SQLite::db selectrow_array failed: database schema has changed(1)"
>
> I'd love a test case against DBD::SQLite for this.
It seems a bit tricky to catch these errors are they're from the
bowels of dbdimp.c, eval { } doesn't work.
Depending on the purpose and portability needs of the tests, something
could be hacked up with redirects. I'm not sure what else to try,
any suggestions?
The attached test currently passes, but still produces the error
message on stderr. I'm trying this within DBD-SQLite-1.13.
Brad
--
That one's own district is unsophisticated and unpolished is a great
treasure. Imitating another style is simply a sham.
-- Hagakure http://bereft.net/hagakure/
_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
bsb_schema_change.t
(text/troff, 590 B)
$|++;
use strict;
use warnings;
use Test;
BEGIN { plan tests => 5 }
use DBI;
my $dbname = "foo$$";
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "");
ok($dbh);
$dbh->{AutoCommit} = 1;
$dbh->do("CREATE TABLE f (f1, f2, f3)");
my $sth = $dbh->prepare_cached("SELECT f.f1, f.* FROM f");
ok($sth);
$dbh->do("ANALYZE"); # invalidate prepared statement handles
my $sth2 = $dbh->prepare_cached("SELECT f.f1, f.* FROM f");
ok($sth2);
my $ret = eval { $sth2->execute(); "ok" };
ok($@, '');
ok($ret, 'ok');
$sth2->finish;
undef $sth2;
$dbh->disconnect;
END {
unlink $dbname;
}