Re: execute multiple queries with mysql c++ connector

From: Peter H. Coffin <hellsop_at_ninehells.com>
Date: Thu, 9 Mar 2017 15:18:23 -0600
Message-ID: <slrnoc3hkv.t3q.hellsop_at_nibelheim.ninehells.com>


On Thu, 9 Mar 2017 09:52:07 -0800 (PST), kushal bhattacharya wrote:

> hi, I want the queries to be written just as if i am writing it in
> sql editor with semicolons in between so that it runs on the same
> context and there is no chance that due to multi threading there may
> be interference from other connections if i do it as a seperate query
> statement which i am observing sometimes

Go back and read the stuff other people posted about transactions. That's how you get that consistency to happen. Submitting multiple statements with semicolons runs the statements sequentially and DOES NOT guarantee consistency. The database can change between running the first and the second statements. If you use the transaction properly, you've told it NOT to change between statements, so it won't.

-- 
"25 grams of wafers and 20 ml of wine undergo transubstantiation and
 become the flesh and blood of our Lord. How many Joules of heat are
 released by the transformation?"   --Theological Physics exam, 1997
Received on Thu Mar 09 2017 - 22:18:23 CET

Original text of this message