From b1ca475703da59eaaf8166e7f8e453dc7a913e5b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 10 Aug 2005 23:48:22 +0000 Subject: [PATCH] Probable fix for #34054. --- ext/pdo_mysql/mysql_driver.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index b7297800a7..d880a259e3 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -188,6 +188,13 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, if (mysql_stmt_prepare(S->stmt, sql, sql_len)) { /* TODO: might need to pull statement specific info here? */ + /* if the query isn't supported by the protocol, fallback to emulation */ + if (mysql_errno(H->server) == 1295) { + if (nsql) { + efree(nsql); + } + goto fallback; + } pdo_mysql_error(dbh); if (nsql) { efree(nsql); @@ -212,9 +219,9 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, return 1; -#else - stmt->supports_placeholders = PDO_PLACEHOLDER_NONE; +fallback: #endif + stmt->supports_placeholders = PDO_PLACEHOLDER_NONE; return 1; } -- 2.50.1