Mercurial > games > semicongine
comparison semiconginev2/thirdparty/db_connector/private/dbutils.nim @ 1218:56781cc0fc7c compiletime-tests
did: renamge main package
author | sam <sam@basx.dev> |
---|---|
date | Wed, 17 Jul 2024 21:01:37 +0700 |
parents | semicongine/old/thirdparty/db_connector/private/dbutils.nim@239adab121a3 |
children |
comparison
equal
deleted
inserted
replaced
1217:f819a874058f | 1218:56781cc0fc7c |
---|---|
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 |