Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are learning perl AND Sybase basics and making several incorrect conclusions. </p> <p>Forget about what it does under ODBC for a moment. ODBC most probably has AUTOCOMMIT turned on, and thus you have no transaction control whatsoever. (Why anyone would use ODBC when the DBD:: supports DB-Lib and CT-Lib is beyond me, but that's a separate story.)</p> <p>Re: <em>"So looks like every prepared statement needs to be run under Sybase."</em></p> <p>Rawheiser is correct. What exactly do you expect to achieve by preparing a batch but performing a Do instead ? Where else do you expect to execute the batch prepared under Sybase, other than under Sybase?</p> <p>Do vs prepare/execute are quite different. prepare/execute for Sybase works just fine in millions of programs. you just have to learn what it does, not what you think it should do. prepare let's you load a batch, a block of commands terminated by GO in the normal Sybase sense. Execute executes the prepared batch (supplies the GO and sends the batch to the server), and captures whatever is returned (according to whatever array/variables you have set). </p> <p>Do is immediate, single command, with no prepare. A prepare+execute combined.</p> <p>Performing only single-statement do's, and only dynamic SQL, simply because that's all that you could get to work, is very limiting and quite unnecessary.</p> <p>You currently have:</p> <p>Prepare:</p> <pre><code>UPDATE Execute (100) ExecuteImmediate(Do): COMMIT TRAN </code></pre> <p>So of course, there is no BEGIN TRAN. (The first "do" executed, the BEGIN TRAN is gone)</p> <p>I think what you want (intended originally) is this. Forget the 'do':</p> <p>Prepare:</p> <pre><code>BEGIN TRAN UPDATE COMMIT TRAN </code></pre> <p>Execute (100)</p> <p>Then change it to:</p> <pre><code>BEGIN TRAN INSERT UPDATE COMMIT TRAN </code></pre> <p>Execute (100)</p> <p>Your $update and $insert will confuse you (you're executing a multi-statement batch, right ?not a isolated single command in the middle of a prepare batch). If you get rid of them, and think in terms of $execute [whatever you have prepared in the batch], it might help you to understand the problem better.</p> <p>Do not form conclusions until you have all the above working as intended.</p> <p>And read up on BEGIN/COMMIT TRAN.</p> <p>Last, What exactly is a "<code>END TRAN</code>" ? I do not think the code block you have posted is real.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload