R Lenard wrote:
> This works with the old driver but fails with a
> "This command is not supported in the prepared
> statement protocol yet" error with 3.1.6.
>
> Surely it is known what is supported in the
> protocol, and thus server side prepared statements
> should only be used for SQL that is supported the
> protocol..
>
> This is effectively the prepared statement
> statement I was running.
>
> REPLACE INTO summaryTable ( f1, f2, f3 ) SELECT ?
> AS f1, ? AS f2, CURRENT_TIMESTAMP AS f3 FROM
> origTable WHERE f2 = ?
R,
It's not that simple, as 'what is supported' changes with each release of the server.
Even if the list were static, checking for this on the client side would require a nearly full-blown parser to be written, and would have severe performance implications. Most 'normal' statements that someone would use (SELECT/UPDATE/INSERT/DELETE) are all supported.
If you know that you won't be gaining anything from the use of server-side prepared statements, or if you know you have statements that aren't supported (the list is at
http://dev.mysql.com/doc/mysql/en/C_API_Prepared_statements.html , I'll add that to the Connector/J docs so that it's easier to find), then just turn off server-side prepared statements with the 'useServerPrepStmts=false' flag.
-Mark
Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html