MCPcopy Index your code
hub / github.com/webpy/webpy / reparam

Function reparam

web/db.py:343–353  ·  view source on GitHub ↗

Takes a string and a dictionary and interpolates the string using values from the dictionary. Returns an `SQLQuery` for the result. >>> reparam("s = $s", dict(s=True)) >>> reparam("s IN $s", dict(s=[1, 2]))

(string_, dictionary)

Source from the content-addressed store, hash-verified

341
342
343def reparam(string_, dictionary):
344 """
345 Takes a string and a dictionary and interpolates the string
346 using values from the dictionary. Returns an `SQLQuery` for the result.
347
348 >>> reparam("s = $s", dict(s=True))
349 <sql: "s = 't'">
350 >>> reparam("s IN $s", dict(s=[1, 2]))
351 <sql: 's IN (1, 2)'>
352 """
353 return SafeEval().safeeval(string_, dictionary)
354
355
356def sqlify(obj):

Callers 3

_whereMethod · 0.85
queryMethod · 0.85
gen_clauseMethod · 0.85

Calls 2

SafeEvalClass · 0.85
safeevalMethod · 0.80

Tested by

no test coverage detected