importdb_commontemplatedbFormatImpl*(formatstr:SqlQuery,dbQuote:proc(s:string):string,args:varargs[string]):string=varres=""vara=0forcinitems(string(formatstr)):ifc=='?':ifa==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