diff options
Diffstat (limited to 'src/guff/database.cr')
-rw-r--r-- | src/guff/database.cr | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/guff/database.cr b/src/guff/database.cr index 67a7a1a..5b971b6 100644 --- a/src/guff/database.cr +++ b/src/guff/database.cr @@ -82,6 +82,21 @@ module Guff def query( sql : String, args = nil : Array(String) | Hash(String, String) | Nil, + ) + run(sql, args) do |rs| + # make sure query executes + rs.next + nil + end + end + + # + # NOTE: if you pass a block, be sure to call rs.next at least once, + # or the query will _not_ execute!!! + # + def query( + sql : String, + args = nil : Array(String) | Hash(String, String) | Nil, &block : Proc(::SQLite3::ResultSet, Nil) \ ) run(sql, args, &block) |