Home  >  Article  >  Backend Development  >  php的pdo中对双引号做了什么处置么,为什么这个语句可以执行通过

php的pdo中对双引号做了什么处置么,为什么这个语句可以执行通过

WBOY
WBOYOriginal
2016-06-13 12:22:191041browse

php的pdo中对双引号做了什么处理么,为什么这个语句可以执行通过

本帖最后由 pakey 于 2015-06-21 14:19:06 编辑 找了个轻量级的数据库类 medoo,感觉不错,但是使用时发现了一个很奇怪的问题
在使用mysql的时候他组装的sql表名、字段名都是用双引号的,这样生成的语句不能直接执行
mysql> SELECT * FROM "dd_xq_user_info" WHERE "uid" = '1' AND "status" = '1' ORDER BY "id" LIMIT 1;<br />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 '"dd_xq_user_info" WHERE "uid" = '1' AND "status" = '1' ORDER BY "id" LIMIT 1' at line 1<br />

但是用pdo执行这个语句执行成功了,而且没有错误,请问大家这个是为什么呢?pdo做了什么处理?
------解决思路----------------------
SQL_MODE 的默认值是 STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
改成 ANSI_QUOTES 后,如果没有其他的操作,自然是不会有影响的
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn