$wpdb->query() multiple query support

Just bump into the issue that I can’t execute multiple sql queries using the $wpdb->query(). Generated queries work fine directly in phpmyadmin so its something will the ezSQL class only. By design perhaps?

I found this http://wordpress.org/support/topic/wpdb-gtquery-fails-when-multiple-update-statements-are-used which also says its by design. Can anyone confirm? ezSQL docs dont say anything about multiple queries support.

If you have to do a bunch of queries mainly (INSERT/UPDATE/DELETE), any better way of doing them other than doing them one by one using $wpdb->insert() and like functions?

1 Answer
1

Using PHP 5.3.5, I was unable to make this syntax work even after setting the 5th parameter of mysql_connect() to 65536 (CLIENT_MULTI_STATEMENTS). Looks like it’s not possible to concatenate multiple queries into one statement as long as the old-school MySQL API is running the show.

I assume you’re familiar with the MySQL multiple row INSERT syntax, but I mention it just in case.

Leave a Comment