@@ -291,6 +291,11 @@ static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *
291
291
}
292
292
/* }}} */
293
293
294
+ #if defined(PDO_USE_MYSQLND ) || MYSQL_VERSION_ID < 50707 || defined(MARIADB_BASE_VERSION )
295
+ # define mysql_real_escape_string_quote (mysql , to , from , length , quote ) \
296
+ mysql_real_escape_string(mysql, to, from, length)
297
+ #endif
298
+
294
299
/* {{{ mysql_handle_quoter */
295
300
static int mysql_handle_quoter (pdo_dbh_t * dbh , const char * unquoted , size_t unquotedlen , char * * quoted , size_t * quotedlen , enum pdo_param_type paramtype )
296
301
{
@@ -313,13 +318,13 @@ static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unqu
313
318
* quoted = safe_emalloc (2 , unquotedlen , 3 + (use_national_character_set ? 1 : 0 ));
314
319
315
320
if (use_national_character_set ) {
316
- * quotedlen = mysql_real_escape_string (H -> server , * quoted + 2 , unquoted , unquotedlen );
321
+ * quotedlen = mysql_real_escape_string_quote (H -> server , * quoted + 2 , unquoted , unquotedlen , '\'' );
317
322
(* quoted )[0 ] = 'N' ;
318
323
(* quoted )[1 ] = '\'' ;
319
324
320
325
++ * quotedlen ; /* N prefix */
321
326
} else {
322
- * quotedlen = mysql_real_escape_string (H -> server , * quoted + 1 , unquoted , unquotedlen );
327
+ * quotedlen = mysql_real_escape_string_quote (H -> server , * quoted + 1 , unquoted , unquotedlen , '\'' );
323
328
(* quoted )[0 ] = '\'' ;
324
329
}
325
330
0 commit comments