Home
Sign Up
Sign In
V2EX
›
PHP
在PHP中怎么写SQL更方便符合不超过80列的规范?
saharabear
·
Feb 12, 2013
· 4410 views
This topic created in 5018 days ago, the information mentioned may be changed or developed.
PHP虽然支持$str=<<<SQL(换行)(行首)SQL;的方式来编写多行,但这样结束符并不缩进,感觉上并不好,也不美观。
如果使用连接符,在修改SQL的时候又会有问题。
毕竟SQL还是经常超过几百个字符的。
有什么好办法写SQL来尽量符合80列规范?
SQL
PHP
4 replies
•
1970-01-01 08:00:00 +08:00
xuwenhao
Feb 12, 2013
1
直接回车
salforis
Feb 12, 2013
2
超过几百字的SQL,只能说明你的DB很辛苦。
m4ker
Feb 12, 2013
3
$sql = "
select x.xx,x.xx
from xxx x,xxx x
where xxx=xxx
__and xxx=xxx
___or xxx=xxx
order by id desc
limit a,b
";
缩紧自理。
saharabear
OP
Feb 13, 2013
4
@
xuwenhao
@
m4ker
看来只好这样了,自己搞缩进。
@
salforis
一个sql几百个单词也正常吧?随便两个表的连接,每个表三四十个字段,两表或者三表的连接,就要定义出一些东西。没办法,项目特色。
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1002 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms ·
UTC 19:15
·
PVG 03:15
·
LAX 11:15
·
JFK 14:15
♥ Do have faith in what you're doing.
❯