List:MySQL++« Previous MessageNext Message »
From:Attila Date:September 15 2010 3:06pm
Subject:Re: How to execute multiple SQL instructions in one step
View as plain text  
Thank you very much

On Wed, Sep 15, 2010 at 10:52 AM, Jonathan Wakely <mysql@stripped> wrote:

> On 15 September 2010 15:34, Attila wrote:
> > Hi Everyone,
> >
> > I am using the following to try and execute a lock on table and then in
> > update:
> >
> > const char* sql = "LOCK TABLES MyTable WRITE;UPDATE MyTable SET status=
> > 'STARTED' WHERE status_id= '7' AND address = 167473977; UNLOCK TABLES;";
> >
> > // m_pConnection is a mysqlpp::Connection
> > mysqlpp::Query query = m_pConnection->query(sql);
> > mysqlpp::StoreQueryResult storeResult(query.store());
> >
> > However this gives me a syntax error. Is there any way to accomplish the
> > above in one call?
>
> You need mysqlpp::MultiStatementsOption, as shown in this tutorial:
> http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#connopts
>
> c.f. http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html
>



-- 
Attila
Software Developer
atteeela@stripped

Thread
How to execute multiple SQL instructions in one stepAttila15 Sep
  • Re: How to execute multiple SQL instructions in one stepJonathan Wakely15 Sep
    • Re: How to execute multiple SQL instructions in one stepAttila15 Sep