From: Wez Furlong Date: Wed, 10 Aug 2005 23:48:22 +0000 (+0000) Subject: Probable fix for #34054. X-Git-Tag: BEFORE_UNICODE_MERGE~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1ca475703da59eaaf8166e7f8e453dc7a913e5b;p=php Probable fix for #34054. --- 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; }