You are here: Re: Executing Multiple Queries using MDB2 « PHP Programming Language « IT news, forums, messages
Re: Executing Multiple Queries using MDB2

Posted by Kailash Nadh on 11/26/07 03:39

Multiple queries separated by a semicolon won't work. You *have* to
execute the queries sequentially.

Regards,
Kailash Nadh
http://kailashnadh.name


On Nov 25, 7:02 pm, Rob Wilkerson <r.d.wilker...@gmail.com> wrote:
> I'm trying to execute an action that involves multiple insert
> queries. Rather than execute them sequentially, I'd rather build a
> sql string containing all of the queries and only have one round trip
> to the database. Using MDB2, though, I can't seem to do that. I've
> separated each query with a semicolon, but I get a syntax error. When
> I display the user info ($result->getUserInfo()) and copy the SQL from
> the error message, I can execute the SQL just fine in CocoaMySQL.
>
> Is this a limitation of MDB2? Am I using the wrong query separator?
> I'm not seeing anything in the MDB2 documentation about this at all.
>
> My generated SQL looks like this:
>
> INSERT INTO object ( field1, field2, field3 ) VALUES ( value1, value2,
> value3 ); INSERT INTO object_property ( field1, field2, field3 )
> VALUES ( value1, value2, value3 ); INSERT INTO object_property
> ( field1, field2, field3 ) VALUES ( value1, value2, value3 ); ...;
> INSERT INTO object_property ( field1, field2, field3 ) VALUES
> ( value1, value2, value3 );
>
> Error:
>
> [Native code: 1064] [Native message: You have an error in your SQL
> syntax; check the manual that corresponds to your MySQL server version
> for the right syntax to use near '; INSERT INTO object_property
> ( object_id, object_property, int_value) VALUES ' at line 1]
>
> Thanks.
>
> Rob

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация