|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: sybperl sql batch
Date: May 5 1998 2:03PM
John Dubchak writes:
> > open(BATCH, $file);
> > while() {
> > if(/^go/) {
> > $dbh->dbsqlexec;
> > while($dbh->dbresults != NO_MORE_RESULTS) {
> > while(@d = $dbh->dbnextrow) {
> > print "@d\n";
> > }
> > if(@d = $dbh->dbretdata) {
> > print "@d\n";
> > }
> > if($dbh->dbhasretstat) {
> > print "Return status: $dbh->dbretstatus, "\n";
> > }
> > }
> > } else {
> > $dbh->dbcmd($_);
> > }
> > }
>
> Ok, now do that with the CT-Lib extensions...
>
> :-)
As they say in French - chiche!
[ WARNING - typed directly into the mail client - not tested! ]
open(BATCH, $file);
$buf = '';
while() {
if(/^go/) {
$dbh->ct_execute($buf);
while($dbh->ct_results($restype) == CS_SUCCEED) {
if($dbh->ct_fetchable($restype)) {
if($restype == CS_STATUS_RESULT) {
@d = $dbh->ct_fetch;
print "Return status: $d[0]\n";
while(@d = $dbh->ct_fetch) {
;
}
} else {
while(@d = $dbh->ct_fetch) {
print "@d\n";
}
}
}
}
$buf = '';
} else {
$buf .= $_;
}
}
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
|