annotate semiconginev2/thirdparty/db_connector/private/dbutils.nim @ 1235:c70fee6568f6
did: improv render tests to run without user input
author |
sam <sam@basx.dev> |
date |
Sat, 20 Jul 2024 15:45:02 +0700 |
parents |
56781cc0fc7c |
children |
|
rev |
line source |
1191
|
1 import ../db_common
|
|
2
|
|
3
|
|
4 template dbFormatImpl*(formatstr: SqlQuery, dbQuote: proc (s: string): string {.nimcall.}, args: varargs[string]): string =
|
|
5 var res = ""
|
|
6 var a = 0
|
|
7 for c in items(string(formatstr)):
|
|
8 if c == '?':
|
|
9 if a == args.len:
|
|
10 dbError("""The number of "?" given exceeds the number of parameters present in the query.""")
|
|
11 add(res, dbQuote(args[a]))
|
|
12 inc(a)
|
|
13 else:
|
|
14 add(res, c)
|
|
15 res
|