Commit Diff


commit - 10d3af81decc71bcb0d3bce05a24704b72f14607
commit + 980ae98bf2170a867104430e4c672a45a626d203
blob - /dev/null
blob + bbb566de662ce8bbac7810e8dc5939c6a1ffa9f9 (mode 644)
--- /dev/null
+++ test/sql-luatest/array_test.lua
@@ -0,0 +1,30 @@
+local server = require('luatest.server')
+local t = require('luatest')
+
+local g = t.group()
+
+g.before_all(function()
+    g.server = server:new({alias = 'array'})
+    g.server:start()
+end)
+
+g.after_all(function()
+    g.server:stop()
+end)
+
+-- Make sure that ARRAY values can be used as bound variable.
+g.test_array_binding_local = function()
+    g.server:exec(function()
+        local sql = [[SELECT #a;]]
+        local arg = {{['#a'] = {1, 2, 3}}}
+        t.assert_equals(box.execute(sql, arg).rows[1][1], {1, 2, 3})
+    end)
+end
+
+g.test_array_binding_remote = function()
+    local conn = g.server.net_box
+    local ok, res = pcall(conn.execute, conn, [[SELECT #a;]],
+                          {{['#a'] = {1, 2, 3}}})
+    t.assert_equals(ok, true)
+    t.assert_equals(res.rows[1][1], {1, 2, 3})
+end
blob - c9bdf37480a31231c22739d1794f55385282418d
blob + 679907dcc91d5ed965a99cdce073a80fd3310660
--- test/sql-luatest/map_test.lua
+++ test/sql-luatest/map_test.lua
@@ -318,5 +318,23 @@ g.test_map_9 = function()
         local sql = [[SELECT {'a' : 1, 'a' : 2, 'b' : 3, 'a' : 4};]]
         local res = {{{b = 3, a = 4}}}
         t.assert_equals(box.execute(sql).rows, res)
+    end)
+end
+
+-- Make sure that MAP values can be used as a bound variable.
+g.test_map_binding_local = function()
+    g.server:exec(function()
+        local sql = [[SELECT #a;]]
+        local arg = {{['#a'] = {abc = 2, [1] = 3}}}
+        local res = {abc = 2, [1] = 3}
+        t.assert_equals(box.execute(sql, arg).rows[1][1], res)
     end)
 end
+
+g.test_map_binding_remote = function()
+    local conn = g.server.net_box
+    local ok, res = pcall(conn.execute, conn, [[SELECT #a;]],
+                          {{['#a'] = {abc = 2, [1] = 3}}})
+    t.assert_equals(ok, true)
+    t.assert_equals(res.rows[1][1], {abc = 2, [1] = 3})
+end
blob - 610d325287e9dcee598011fb2cf4ad6250aa13f2
blob + 801dbd00931cf04a27984d436499e515102f2677
--- test/sql-tap/array.test.lua
+++ test/sql-tap/array.test.lua
@@ -1,6 +1,6 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-test:plan(117)
+test:plan(115)
 
 box.schema.func.create('a1', {
     language = 'Lua',
@@ -1025,31 +1025,6 @@ test:do_execsql_test(
         "array"
     })
 
--- Make sure that ARRAY values can be used as bound variable.
-test:do_test(
-    "builtins-14.1",
-    function()
-        local res = box.execute([[SELECT #a;]], {{['#a'] = {1, 2, 3}}})
-        return {res.rows[1][1]}
-    end, {
-        {1, 2, 3}
-    })
-
-local remote = require('net.box')
-box.cfg{listen = os.getenv('LISTEN')}
-box.schema.user.grant('guest', 'execute', 'sql')
-local cn = remote.connect(box.cfg.listen)
-test:do_test(
-    "builtins-14.2",
-    function()
-        local res = cn:execute([[SELECT #a;]], {{['#a'] = {1, 2, 3}}})
-        return {res.rows[1][1]}
-    end, {
-        {1, 2, 3}
-    })
-cn:close()
-box.schema.user.revoke('guest', 'execute', 'sql')
-
 box.execute([[DROP TABLE t1;]])
 box.execute([[DROP TABLE t;]])
 
blob - 194eff290cbe8180c21f01c47b46c7bbdb07bc9c
blob + 21860249247fcae44e0d1a79a8fc031fe985c194
--- test/sql-tap/map.test.lua
+++ test/sql-tap/map.test.lua
@@ -1,6 +1,6 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-test:plan(112)
+test:plan(110)
 
 box.schema.func.create('m1', {
     language = 'Lua',
@@ -981,31 +981,6 @@ test:do_catchsql_test(
         1, "Failed to execute SQL statement: wrong arguments for function ZEROBLOB()"
     })
 
--- Make sure that MAP values can be used as a bound variable.
-test:do_test(
-    "builtins-13.1",
-    function()
-        local res = box.execute([[SELECT #a;]], {{['#a'] = {abc = 2, [1] = 3}}})
-        return {res.rows[1][1]}
-    end, {
-        {abc = 2, [1] = 3}
-    })
-
-local remote = require('net.box')
-box.cfg{listen = os.getenv('LISTEN')}
-box.schema.user.grant('guest', 'execute', 'sql')
-local cn = remote.connect(box.cfg.listen)
-test:do_test(
-    "builtins-13.2",
-    function()
-        local res = cn:execute([[SELECT #a;]], {{['#a'] = {abc = 2, [1] = 3}}})
-        return {res.rows[1][1]}
-    end, {
-        {abc = 2, [1] = 3}
-    })
-cn:close()
-box.schema.user.revoke('guest', 'execute', 'sql')
-
 box.execute([[DROP TABLE t1;]])
 box.execute([[DROP TABLE t;]])