浏览代码

Add where clause only if conditions exists (#3853)

version-14
Nabin Hait 8 年前
committed by Rushabh Mehta
父节点
当前提交
b524d892f7
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. +3
    -2
      frappe/database.py

+ 3
- 2
frappe/database.py 查看文件

@@ -600,8 +600,9 @@ class Database:

order_by = ("order by " + order_by) if order_by else ""

r = self.sql("select {0} from `tab{1}` where {2} {3}".format(fl, doctype,
conditions, order_by), values, as_dict=as_dict, debug=debug, update=update)
r = self.sql("select {0} from `tab{1}` {2} {3} {4}"
.format(fl, doctype, "where" if conditions else "", conditions, order_by), values,
as_dict=as_dict, debug=debug, update=update)

return r



正在加载...
取消
保存