fix a sqlite bug (#18669)

This commit is contained in:
flywind
2021-08-13 00:21:01 +08:00
committed by GitHub
parent 5c1304a418
commit f559319a68
3 changed files with 47 additions and 11 deletions

View File

@@ -0,0 +1,15 @@
import db_common
template dbFormatImpl*(formatstr: SqlQuery, dbQuote: proc (s: string): string, args: varargs[string]): string =
var res = ""
var a = 0
for c in items(string(formatstr)):
if c == '?':
if a == args.len:
dbError("""The number of "?" given exceeds the number of parameters present in the query.""")
add(res, dbQuote(args[a]))
inc(a)
else:
add(res, c)
res