-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi,

On Tue, 20 Nov 2001, Anna Winkler wrote:

> I would like to send multiple SQL statements using the C
> API mysql_query.  I have a large string with 20 SQL statements.  When
> I call mysql_query with that string, only the first one is processed.
> 
> Is there a way to do what I'm doing without separating the statements
> into individual calls to mysql_query?

I beleive this is not possible. If it were, it would give lots of people
many hours of headache. Imagine a badly written script, where you can
"escape out" from the original query, like

update articles set author='$author'

If you can make several statements with one query, you could make

$author = "whatever'; drop database"

This, with the above line could drop your entire database if you're not
careful.

I beleive that this is the reason for not allowing several statements in
the same query.

A workaround could be to pass the 20-statement query to a subprocess,
which would go through them one by one. If you do this, be very careful
with escape strings though!

Attila

...........................................................................
After I'm dead I'd rather have people ask why I have no monument than why I
have one. -Cato the Elder, statesman, soldier, and writer (234-149 BCE)

- ---
Public key: http://civ.hu/attila.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7+ozvDeyfLhmXxQwRAsJ8AJ9Kzrqa+8pF3ZR/0YkQRQpJ8qFXeACeL0ct
J99kfaW3gTPLaOMKGYtb1Vg=
=cabo
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to