This commit is contained in:
Araq 2015-01-10 23:52:05 +01:00
commit a41b62da97

View file

@ -48,6 +48,7 @@ proc dbError*(msg: string) {.noreturn.} =
raise e raise e
proc dbQuote(s: string): string = proc dbQuote(s: string): string =
if s.isNil: return "NULL"
result = "'" result = "'"
for c in items(s): for c in items(s):
if c == '\'': add(result, "''") if c == '\'': add(result, "''")
@ -61,7 +62,7 @@ proc dbFormat(formatstr: TSqlQuery, args: varargs[string]): string =
if c == '?': if c == '?':
add(result, dbQuote(args[a])) add(result, dbQuote(args[a]))
inc(a) inc(a)
else: else:
add(result, c) add(result, c)
proc tryExec*(db: TDbConn, query: TSqlQuery, proc tryExec*(db: TDbConn, query: TSqlQuery,