From 08f6d17f91a7c990c8ada20c4038db067ac4874d Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 6 Mar 2016 10:51:20 -0500 Subject: small db fixes --- src/guff/database.cr | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') 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 -- cgit v1.2.3