aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-06 10:51:20 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-06 10:51:20 -0500
commit08f6d17f91a7c990c8ada20c4038db067ac4874d (patch)
tree0120aba2ef00bdc926583cda5464dc0630390cff /src
parent1b0d692233e99740793e965e49736e45a2cf74c7 (diff)
downloadold-guff-08f6d17f91a7c990c8ada20c4038db067ac4874d.tar.bz2
old-guff-08f6d17f91a7c990c8ada20c4038db067ac4874d.zip
small db fixes
Diffstat (limited to 'src')
-rw-r--r--src/guff/database.cr13
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