开发者

Is the backslash \ counted as a character in MySQL?

开发者 https://www.devze.com 2022-12-25 19:49 出处:网络
if i have a table which has columns with fi开发者_如何学编程xed lenght, Will mySQL count the backslashes as characters?

if i have a table which has columns with fi开发者_如何学编程xed lenght, Will mySQL count the backslashes as characters?

Example :

people(name[10],age[3])

If i store in the name column a MySQL escaped value like : Blahblah\'s Will MySQL cut it at the quote?

Thanks


No, escape characters do not add the length of char or varchar string, because escape characters are not stored at all.

CREATE TABLE a (name char(5));

INSERT INTO a VALUES ('1234567890');
INSERT INTO a VALUES ('12\'345678');

SELECT * FROM a;
+-------+
| name  |
+-------+
| 12345 | 
| 12'34 | 
+-------+
2 rows in set (0.00 sec)
0

精彩评论

暂无评论...
验证码 换一张
取 消