Mysql insert语句中的转义

Mysql insert语句中的转义,mysql,Mysql,如何在mysql insert语句中转义逗号 mysql> create table test.todel (name varchar(100)); Query OK, 0 rows affected (0.03 sec) mysql> insert into test.todel values ('mcdonald's pizza'); '> '; ERROR 1064 (42000): You have an error in your SQL syntax; c

如何在mysql insert语句中转义逗号

mysql> create table test.todel (name varchar(100));
Query OK, 0 rows affected (0.03 sec)

mysql> insert into test.todel values ('mcdonald's pizza');
    '> ';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's pizza');
'' at line 1

mysql> select  * from test.todel;
Empty set (0.02 sec)
我可以跳过单个逗号,但这不是一个选项,因为我使用非常复杂的shell脚本来插入数据

mysql> insert into test.todel values ('mcdonald''s pizza');
Query OK, 1 row affected (0.00 sec)

mysql> select * from test.todel;
+------------------+
| name             |
+------------------+
| mcdonald's pizza | 
+------------------+
1 row in set (0.00 sec)

使用mysql\u real\u escape\u字符串安全地替换它

顺便说一句,你的路不安全


使用mysql\u real\u escape\u字符串安全地替换它

顺便说一句,你的路不安全


使用

使用

如果可以,请不要链接到w3schools。如果可以,请不要链接到w3schools。