|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: results pending error
Date: May 6 1998 8:09PM
Gary Udstrand writes:
>
>
>
>
> I have a subroutine (actually a series on them) in which I pass a
> $dbproc value to handle various sybperl database functions. All work
> without a hitch except for the following,
>
> sub drop_table {
> local($dbproc, $tmptablename) = @_;
>
> &dbcmd($dbproc, "if exists (select * from sysobjects where name =
> \"$tmptablename\")\n");
> &dbcmd($dbproc, "begin\n");
> &dbcmd($dbproc, "drop table $tmptablename\n");
> &dbcmd($dbproc, "end\n");
> &dbsqlexec($dbproc);
> &dbresults($dbproc);
You must call dbresults() until it returns $NO_MORE_RESULTS, because
the SQL that you execute is multi-statement.
So do something like (perl4/sybperl1.x syntax):
while(&dbresults($dbproc) != $NO_MORE_RESULTS) {
while(@return_data = &dbnextrow($dbproc)) {
print "@return_data\n";
}
}
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
|