# Can this fail without throwing an exception anyways???
my $rv = $sth->execute();
$self->throw_exception(
$sth->errstr || $sth->err || 'Unknown error: execute() returned false, but error flags were not set...'
) if !$rv;
####
use 5.014;
use strict;
use warnings;
use DBI;
use Test::More;
my @connect_info = (
"dbi:Sybase:server=xxx;database=xxx",
'xxx',
':)',
{ RaiseError => 1 },
);
# @connect_info = ("dbi:SQLite2:dbname=dbfile","","");
my $dbh = DBI->connect( @connect_info );
isa_ok $dbh, 'DBI::db';
my $sql = 'SELECT 1';
test_query( $sql );
test_query( $sql );
sub test_query {
my ($sql) = @_;
my $sth = $dbh->prepare_cached( $sql );
isa_ok $sth, 'DBI::st';
my $r = $sth->execute();
{
no warnings 'uninitialized';
ok defined( $r ), "defined: '$r'";
}
ok $sth->finish(), '$sth->finish';
return;
}
done_testing;
##
##
ok 1 - The object isa DBI::db
ok 2 - The object isa DBI::st
ok 3 - defined: '-1'
ok 4 - $sth->finish
ok 5 - The object isa DBI::st
not ok 6 - defined: ''
# Failed test 'defined: '''
# at t/dbi-bug-pm.t line 35.
ok 7 - $sth->finish
1..7
# Looks like you failed 1 test of 7.
##
##
ok 1 - The object isa DBI::db
ok 2 - The object isa DBI::st
ok 3 - defined: '0E0'
ok 4 - $sth->finish
ok 5 - The object isa DBI::st
ok 6 - defined: '0E0'
ok 7 - $sth->finish
1..7