RE: Prepare error




On 20-Feb-2006 Adam Boswell wrote:
Hello,

I am trying to run a prepare("check table ***on all tables**") and I am
getting an error "DBD::mysql::db prepare failed: This command is not
supported in the prepared statement protocol yet". However the process still
runs and it sends it to mysql and works, BUT then the process never finishes
and it spawns all kinds of problems. Is there a way around this or a fix for
this?

~Adam

You could try setting mysql_emulated_prepare as per the DBD::mysql
docs to see if that helps.

I think this explains some code in DBD::mysql I was unsure about recently.

I'm guessing you'd need to add "check" to the list of commands tested for in
dbdimp.c in dbd_st_prepare (but this code only exists in 3.0002_4).


e.g. like

if ( (statement[i] == 'c' || statement[i] == 'C') &&
(statement[i+1] == 'r' || statement[i+1] == 'R') &&
(statement[i+2] == 'e' || statement[i+2] == 'E') &&
(statement[i+3] == 'a' || statement[i+3] == 'A') &&
(statement[i+4] == 't' || statement[i+4] == 'T') &&
(statement[i+5] == 'e' || statement[i+5] == 'E'))
{
if (dbis->debug >= 2)
PerlIO_printf(DBILOGFP, "CREATE set use_server_side_prepare to 0\n");
imp_sth->use_server_side_prepare= 0;
}

But that is a guess. Like the entry in the ChangeLog:

* Fix that sets mysql_server_prepare to 0 if SQL statement is 'SHOW ...'
which is not supported by prepared statement API currently

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com

.



Relevant Pages