Re: execute multiple queries with mysql c++ connector

From: The Natural Philosopher <tnp_at_invalid.invalid>
Date: Tue, 7 Mar 2017 17:19:37 +0000
Message-ID: <o9mq39$7ja$2_at_news.albasani.net>


On 07/03/17 16:46, Axel Schwenke wrote:
> On 07.03.2017 11:56, kushal bhattacharya wrote:
>> Cant i use semicolon in c++ mysql connector too ?
>
> Obviously not. Haven't you just got an error message for that?
>
>> i Have to run the above queries simultaneously not as a separate query statement
>
> 1. what you have shown before was a single statement ending with a
> semicolon, not multiple statements. You're blabbing incoherently.
>
> 2. no, you cannot run two (or more) statements simultaneously in one
> connection. It's impossible. You might be able to *send* multiple statements
> at once [1] but it's highly discouraged. But even in that case the
> statements will be executed one after the other.
>
> 3. whenever you think you have to run two (or more) statements
> simultaneously to achieve a certain result, you're doing it wrong.
>

How can you therefore create an atomic unit of two or more queries?

I.e. lest suppose you want to read a number, like a bank balance, and subtract something from it and write it back, but you dont want some other asynchronous process to be doing the same?

No alternatives to locks?

>
> [1] https://dev.mysql.com/doc/refman/5.7/en/c-api-multiple-queries.html
> but I don't think Connector/C++ exposes that functionality
>

-- 
"I am inclined to tell the truth and dislike people who lie consistently.
This makes me unfit for the company of people of a Left persuasion, and 
all women"
Received on Tue Mar 07 2017 - 18:19:37 CET

Original text of this message