Support for MULTI_STATEMENTS capability in libdrizzle client

Asked by Marc Isambart on 2011-03-03


I was wondering if there was any technical reason why it is not possible to add an option to enable the DRIZZLE_CAPABILITIES_MULTI_STATEMENTS capability from the libdrizzle client API ?

As far as I can work out, setting the DRIZZLE_CAPABILITIES_MULTI_STATEMENTS capability flag in drizzle_state_handshake_client_write at the same time as the other capabilities should be enough to enable this feature.

This could be controlled by adding a corresponding option in drizzle_con_options_t (in the same way the DRIZZLE_CON_INTERACTIVE and DRIZZLE_CON_ADMIN options can be used to control the DRIZZLE_CAPABILITIES_INTERACTIVE and DRIZZLE_CAPABILITIES_ADMIN capabilities)

I have done some basic testing by connecting to a MySQL server and trying to run 2 SELECT statements in a single query with this capability enabled and it seems to work fine (I get the two expected results back).



Question information

English Edit question
Drizzle Edit question
No assignee Edit question
Solved by:
Marc Isambart
Last query:
Last reply:
Andrew Hutchings (linuxjedi) said : #1

Hi Marc,

As far as I am aware multi-statements in libdrizzle is active regardless of the setting of that capability flag.

Marc Isambart (marc-isambart) said : #2

Hi Andrew,

The library itself supports multiple statements, but as the capability flag is not currently set, the MySQL server throws an invalid query error when trying to run multiple statements in a single query.

For example, when running a very simple query containing multiple statements such as "SELECT 1; SELECT 2;" using the drizzle_query_str function, the MySQL servers complains that this is an invalid query.

After setting the MULTI_STATEMENT capability flag (by modifying the drizzle_state_handshake_client_write), everything works fine and I get the two expected results back.


Andrew Hutchings (linuxjedi) said : #3

Ah, I see what you mean. I have filed bug #729642 for this.

Andrew Hutchings (linuxjedi) said : #4

Hi Marc,

DRIZZLE_CON_MULTI_STATEMENTS has been added to trunk to do this and will be in the GA release next week.

Marc Isambart (marc-isambart) said : #5