view semiconginev2/thirdparty/db_connector/private/dbutils.nim @ 1258:5442d0e9d8ff

did: improve testing lighting, try new glb model (need to add jpeg support first)
author sam <sam@basx.dev>
date Sun, 28 Jul 2024 20:42:51 +0700
parents 56781cc0fc7c
children
line wrap: on
line source

import ../db_common


template dbFormatImpl*(formatstr: SqlQuery, dbQuote: proc (s: string): string {.nimcall.}, 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