有没有可能在sqlparse
中增加一个N的限制?例如,假设用户输入以下三个查询(示例中使用1000作为限制):
1) Reformat if limit > 1000
SELECT * FROM mytable LIMIT 1e10
==> SELECT * FROM mytable LIMIT 1000
2) Reformat if no limit
SELECT * FROM mytable
==> SELECT * FROM mytable LIMIT 1000
3) Ignore if a limit <= 1000 already applied
SELECT * FROM mytable
==> [ ok ]
另外,sqlparse
是否能够根据数据库引擎修改限制?例如,mysql中的limit
与mssql中的top
不同。示例:
MySQL: SELECT * FROM table LIMIT 1000
PostgreSQL: SELECT * FROM table LIMIT 1000
Oracle: SELECT * FROM table WHERE rownum <= 1000
MsSQL: SELECT TOP 1000 FROM table
或者,如果无法在sqlparse
中执行,是否有其他库可以执行此操作?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐