]> granicus.if.org Git - php/commitdiff
Probable fix for #34054.
authorWez Furlong <wez@php.net>
Wed, 10 Aug 2005 23:48:22 +0000 (23:48 +0000)
committerWez Furlong <wez@php.net>
Wed, 10 Aug 2005 23:48:22 +0000 (23:48 +0000)
ext/pdo_mysql/mysql_driver.c

index b7297800a7eab232aba67e076f989686886a4bff..d880a259e3e35713a53df84cd590c5d5e0c55e05 100755 (executable)
@@ -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;
 }