Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

updating data in Sybase

by Anonymous Monk
on May 31, 2007 at 15:33 UTC ( [id://618515]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am using Sybase::DBLIB to send 4000 to 40,000 update commands to a Sybase database. do you recommend I batch the commands and send them all at once or send them individually? I tried to batch them in 500 commands. Then when I attempted to send the 2nd batch I got the error: "Attempt to send a command with results still pending" Is there a way to determine if Sybase is still processing the last commands I sent?

Replies are listed 'Best First'.
Re: updating data in Sybase
by mpeppler (Vicar) on Jun 01, 2007 at 05:55 UTC
    The error simply means that you aren't processing the results from your request(s) correctly.

    The basic loop should look like this:

    $dbproc->dbcmd($the_sql_cmd); # possibly add more commands to the SQL buffer with additional # dbcmd() calls # Send the command(s) to the server $dbproc->dbsqlexec; # Process all the results while($dbproc->dbresults != NO_MORE_RESULTS) { # Process any rows that might be returned: while(@data = $dbproc->dbnextrow) { ..... # do something with the data } }
    What you need to realize is that for each INSERT, UPDATE, etc. in your SQL buffer you must call dbresults() at least once - hence the loop until dbresults() returns NO_MORE_RESULTS.

    Michael

Re: updating data in Sybase
by Anonymous Monk on Jun 01, 2007 at 14:35 UTC
    Thanks Michael It works great!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://618515]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found