fsqlf(http://sourceforge.net/projects/fsqlf/)比较通用(用SQL代替pgSQL),它是用于格式化SQL的命令行或GUI程序,是开源的。它支持具有formatting.conf文件,该文件使您在最终产品的外观上具有很大的灵活性。
例子:
☺ [wwalker@speedy:~]
$ echo "select f1, f2, fname, lName from tblName where f1 = true and fname is not null order by lName asc" | fsqlf
SELECT
f1
, f2
, fname
, lName
FROM tblName
WHERE f1=true
AND fname is not null
ORDER BY lName asc
☺ [wwalker@speedy:~]
$ vim formatting.conf # 2 character change
☺ [wwalker@speedy:~]
$ echo "select f1, f2, fname, lName from tblName where f1 = true and fname is not null order by lName asc" | fsqlf
SELECT
f1 ,
f2 ,
fname ,
lName
FROM tblName
WHERE f1=true
AND fname is not null
ORDER BY lName asc
☺ [wwalker@speedy:~]
$ vim formatting.conf # 1 character change
☺ [wwalker@speedy:~]
$ echo "select f1, f2, fname, lName from tblName where f1 = true and fname is not null order by lName asc" | fsqlf
SELECT
f1 , f2 , fname , lName
FROM tblName
WHERE f1=true
AND fname is not null
ORDER BY lName asc
☺ [wwalker@speedy:~]
$