--- mysql_driver.c.orig Fri Nov 25 17:59:52 2005 +++ mysql_driver.c Fri Dec 16 14:02:59 2005 @@ -163,17 +163,22 @@ char *nsql = NULL; int nsql_len = 0; int ret; + int server_version; #endif S->H = H; stmt->driver_data = S; stmt->methods = &mysql_stmt_methods; - /* TODO: add runtime check to determine if the server we are talking to supports - * prepared statements; if it doesn't, we should set stmt->supports_placeholders - * to PDO_PLACEHOLDER_NONE, and have the rest of the code look at S->stmt to + /* TODO: have the rest of the code look at S->stmt to * determine if we're using real prepared statements or the PDO emulated version */ #if HAVE_MYSQL_STMT_PREPARE + /* Runtime check to determine if the server we are talking to supports prepared + * statements */ + server_version = mysql_get_server_version(H->server); + if (server_version < 40100) { + goto fallback; + } stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL; ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len TSRMLS_CC);