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