Surprising DBD::Oracle error raised

2014-02-04 Thread David Nicol
$price_sth-execute;
my ($o_file_price) = $price_sth-fetchrow_array();
if ($price_sth-fetch) {
$this-log_error('ERROR: scalar select returned second row at
%s line %d', __FILE__, __LINE__);
}


I expected the fetch to return undef, but it throws an Oracle error.
My best ignorant guess here is that fetchrow_array does some cleanup
on one-row datasets, but that isn't documented.

Advise?


-- 
The one L lama, he's a priest
The two L llama, he's a beast
And I will bet my silk pyjama
There isn't any three L lllama. -- Ogden Nash


Re: Surprising DBD::Oracle error raised

2014-02-04 Thread John D Groenveld
In message CAFwScO-0DchsbSLPSmR9JY+KmBUF3BfUREH9XdDSVgEAo=p...@mail.gmail.com
, David Nicol writes:
$price_sth-execute;
my ($o_file_price) = $price_sth-fetchrow_array();
if ($price_sth-fetch) {
$this-log_error('ERROR: scalar select returned second row at
%s line %d', __FILE__, __LINE__);
}


I expected the fetch to return undef, but it throws an Oracle error.

What does your DBI_TRACE reveal?

John
groenv...@acm.org


Re: Surprising DBD::Oracle error raised

2014-02-04 Thread David Nicol
the error message claimed I hadn't executed the statement.
I changed it to

if (eval { $price_sth-fetch}) {
$this-log_error('ERROR: scalar select returned second row at
%s line %d', __FILE__, __LINE__);
}

but I think I'll change it again to

if ($price_sth-{Active} and $price_sth-fetch) {
$this-log_error('ERROR: scalar select returned second row at
%s line %d', __FILE__, __LINE__);
}

but if that's the right thing to do, the documentation (in
DBD::Oracle) should mention it in fetchrow_array's section IMO.




-- 
The one L lama, he's a priest
The two L llama, he's a beast
And I will bet my silk pyjama
There isn't any three L lllama. -- Ogden Nash