PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Problems with dbretdata
Date: May 5 1998 4:30PM

David Waldo writes:
 > 
 > We are calling the 'sql' utility method and then calling dbretdata.
 > Is there a problem with this usage?

Yes.

The sql() utility function "eats" up all the results, so calling
dbretdata() after sql() returns will not return any data at all.

You should do something like this:
$sql = "declare \@param ... exec the_proc \@foo=1, \@bar='string',
\@param=\@param output";
$dbh->dbcmd($sql);
$dbh->dbsqlexec;
while($dbh->results != NO_MORE_RESULTS) {
	while(@d = $dbh->dbnextrow) {
		...
	}
	@retdata = $dbh->dbretdata;
	# dbretdata must be called after any rows from the stored proc 
	# have been processed, but before dbresults() is called again...
}

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@datamig.com    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com