|
|
sybperl-l Archive
Up Prev Next
From: Aravind Subramanian <aravind at genome dot wi dot mit dot edu>
Subject: Stored Procs / SQL syntax error catching in DBI/DBD::Sybase
Date: Sep 9 1998 12:42AM
The code snippet below enters into an infinite loop (in the inner
do-while block) when the sql that these results were obtained from had a
syntax error
For example, if the sql statement sent a stored procedure a varchar
where it should have used a decimal, the code does not exit the
fetchrow_hashref controlled block. This is not seen on all instances of
syntactically incorrect SQL and is never seen with correct SQL.
I'd appreciate any insight on what I might be doing wrong
Thanks
aravind
do
{
++$i;
my %rshash;
print "**********************\n";
print "Result set $i\n";
my $hash = $sth->fetchrow_hashref();
my @colids = keys %$hash;
foreach (@colids) { $rshash{$_} = []; }
do
{
my $cnt = 0;
foreach my $key (keys %$hash)
{
$cnt++;
print "key = $key: value = $$hash{$key} count is
$cnt ";
push (@{$rshash{$key}}, $$hash{$key});
}
} while ($hash = $sth->fetchrow_hashref());
push (@result_sets, \%rshash);
push (@error_sets, _process_error($sth)) if ($sth->err)
} while ($sth->{syb_more_results}); # Warning! DBD::Sybase
extension!
|