|
|
sybperl-l Archive
Up Prev Next
From: "Chris Jack" <jackc at rabo-bank dot com>
Subject: Re: sybperl sql batch
Date: May 5 1998 11:15PM
dbmopen %world_issues, "/etc/world", 0777 || die "World already gone\n";
while (($key,$val) = each %world_issues) {
if (!($val =~ /^peace$/i)) {
delete($world_issues{$key});
}
}
dbmclose %world_issues;
----------
> For his next trick, Michael Peppler will institute a script for world
> peace.
>
> > -----Original Message-----
> > From: Michael Peppler [SMTP:mpeppler@MBAY.NET]
> > Sent: Tuesday, May 05, 1998 9:03 AM
> > To: SybPerl Discussion List
> > Subject: Re: sybperl sql batch
> >
> > 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
|