From 172fc72fa9baa00d85e33596fa4c2c7683771893 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 1 Apr 2018 09:46:13 -0500 Subject: [PATCH] Fix arg_array on empty --- src/helpers.cr | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/helpers.cr b/src/helpers.cr index bca3954e..47652163 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -428,9 +428,13 @@ def number_with_separator(number) end def arg_array(array, start = 1) - args = [] of String - (start..array.size + start - 1).each { |i| args << "($#{i})" } - args = args.join(",") + if array.size == 0 + args = "NULL" + else + args = [] of String + (start..array.size + start - 1).each { |i| args << "($#{i})" } + args = args.join(",") + end return args end