MCPcopy Create free account
hub / github.com/webpy/webpy / gen_clause

Method gen_clause

web/db.py:920–942  ·  view source on GitHub ↗
(self, sql, val, vars)

Source from the content-addressed store, hash-verified

918 )
919
920 def gen_clause(self, sql, val, vars):
921 if isinstance(val, int):
922 if sql == "WHERE":
923 nout = "id = " + sqlquote(val)
924 else:
925 nout = SQLQuery(val)
926 # @@@
927 elif isinstance(val, (list, tuple)) and len(val) == 2:
928 nout = SQLQuery(val[0], val[1]) # backwards-compatibility
929 elif sql == "WHERE" and isinstance(val, dict):
930 nout = self._where_dict(val)
931 elif isinstance(val, SQLQuery):
932 nout = val
933 else:
934 nout = reparam(val, vars)
935
936 def xjoin(a, b):
937 if a and b:
938 return a + " " + b
939 else:
940 return a or b
941
942 return xjoin(sql, nout)
943
944 def insert(self, tablename, seqname=None, _test=False, **values):
945 """

Callers 1

selectMethod · 0.95

Calls 4

_where_dictMethod · 0.95
sqlquoteFunction · 0.85
SQLQueryClass · 0.85
reparamFunction · 0.85

Tested by

no test coverage detected