On Mon, 2002-07-01 at 05:15, HOPKINSON, Jonathan, FM GR wrote: > I'm having problems with a statement handle running Perl 5.6 with Sybase. In > short the loop below works first time through then falls over second time > round with the following messages > > ct_param() failed! at profile_handler line 952. > ct_param() failed! at profile_handler line 953. > ct_param() failed! at profile_handler line 954. > > Mon Jul 1 13:02:54 2002: $product = IRSW > Mon Jul 1 13:02:54 2002: $system_code = 1079 > Mon Jul 1 13:02:54 2002: $branch_id = 17608107 > > Mon Jul 1 13:02:54 2002: Could not execute statement handle > OpenClient message: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (16) > Message String: ct_send(): user api layer: external error: This routine > cannot be called while results are pending for a command that has been sent > to the server. > > > The code works without problem when the select produces no result set. He > seems to think there is more data to be retrieved even when if fetch'd the > only record. Can anyone help?
Call $sth->finish *or* call $sth->fetch in a loop until it returns
false. Even if there is only one row you need to execute the next fetch
to notify the driver that no more rows are available, which will clear
up the buffers.
Ideally, with Sybase you should code fetch loops like this:
do {
while($data = $sth->fetch) { # or fetchrow_arrayref, etc)
....
}
} while($sth->{syb_more_results});
The reason is that a query may return more than one result set. Although
that isn't the case with your select it does happen any time you execute
a stored procedure.
Michael
--
Michael Peppler / [EMAIL PROTECTED] / http://www.mbay.net/~mpeppler
[EMAIL PROTECTED] / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!
signature.asc
Description: This is a digitally signed message part
