Topic: mysql数据库怎么插入特殊字符

  Print this page

1.mysql数据库怎么插入特殊字符 Copy to clipboard
Posted by: javajin
Posted on: 2005-05-20 13:10

像单引号' " \
我用的版本是4.1.11-nt
不能插入

2.Re:mysql数据库怎么插入特殊字符 [Re: javajin] Copy to clipboard
Posted by: phoenix_tree
Posted on: 2005-06-02 13:46

mysql> select id,username,userid,extra from user where userid='xxxxx2000';
+--------+----------------+-----------+-------+
| id | username | userid | extra |
+--------+----------------+-----------+-------+
| 124950 | xxxxxxxxxxxxxx | xxxxx2000 | NULL |
+--------+----------------+-----------+-------+
1 row in set (0.01 sec)

mysql> update user set extra='\'' where userid='xxxxx2000' limit 1;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select id,username,userid,extra from user where userid='xxxxx2000';
+--------+----------------+-----------+-------+
| id | username | userid | extra |
+--------+----------------+-----------+-------+
| 124950 | xxxxxxxxxxxxxx | xxxxx2000 | ' |
+--------+----------------+-----------+-------+
1 row in set (0.00 sec)

mysql> update user set extra='\"' where userid='xxxxx2000' limit 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select id,username,userid,extra from user where userid='xxxxx2000';
+--------+----------------+-----------+-------+
| id | username | userid | extra |
+--------+----------------+-----------+-------+
| 124950 | xxxxxxxxxxxxxx | xxxxx2000 | " |
+--------+----------------+-----------+-------+
1 row in set (0.00 sec)

mysql> update user set extra='\\' where userid='xxxxx2000' limit 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select id,username,userid,extra from user where userid='xxxxx2000';
+--------+----------------+-----------+-------+
| id | username | userid | extra |
+--------+----------------+-----------+-------+
| 124950 | xxxxxxxxxxxxxx | xxxxx2000 | \ |
+--------+----------------+-----------+-------+
1 row in set (0.00 sec)

3.Re:mysql数据库怎么插入特殊字符 [Re: javajin] Copy to clipboard
Posted by: why
Posted on: 2005-06-02 19:20

MySQL uses the C escape syntax for strings.

http://dev.mysql.com/doc/mysql/en/string-syntax.html


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923