diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/guff/database.cr | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/guff/database.cr b/src/guff/database.cr index b21a26a..cabc91c 100644 --- a/src/guff/database.cr +++ b/src/guff/database.cr @@ -157,6 +157,7 @@ module Guff end private def bind(sql : String) + # build statement prepare(sql) end @@ -167,8 +168,8 @@ module Guff # build statement st = prepare(sql) - # build args - if args.size > 0 + # bind args + if args && args.size > 0 args.each_with_index do |val, i| st[i + 1] = val end @@ -183,12 +184,12 @@ module Guff args : Hash(String, String)? ) # build statement - if args.size > 0 - st = prepare(sql) - end + st = prepare(sql) # bind args - st[0] = args + if args && args.size > 0 + st[0] = args + end # return result st |