Mercurial > games > semicongine
annotate semiconginev2/thirdparty/db_connector/private/dbutils.nim @ 1225:27cd1c21290e compiletime-tests
did: refactor resources
author | sam <sam@basx.dev> |
---|---|
date | Wed, 17 Jul 2024 22:20:59 +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 |