@@ -293,6 +293,11 @@ static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *
293293}
294294/* }}} */
295295
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+
296301/* {{{ mysql_handle_quoter */
297302static int mysql_handle_quoter (pdo_dbh_t * dbh , const char * unquoted , size_t unquotedlen , char * * quoted , size_t * quotedlen , enum pdo_param_type paramtype )
298303{
@@ -315,13 +320,13 @@ static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unqu
315320 * quoted = safe_emalloc (2 , unquotedlen , 3 + (use_national_character_set ? 1 : 0 ));
316321
317322 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 , '\'' );
319324 (* quoted )[0 ] = 'N' ;
320325 (* quoted )[1 ] = '\'' ;
321326
322327 ++ * quotedlen ; /* N prefix */
323328 } 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 , '\'' );
325330 (* quoted )[0 ] = '\'' ;
326331 }
327332
0 commit comments