diff --git a/test/module/net_sql.mysql.result b/test/module/net_sql.mysql.result index b176fa5145a534f083cb0787c4bc9eb395a5fcdc..cfe1f7bd3fb59751f6645129f5107539c6843f79 100644 --- a/test/module/net_sql.mysql.result +++ b/test/module/net_sql.mysql.result @@ -67,33 +67,48 @@ end; - true ... --# setopt delimiter '' -dump({c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')}) +c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc') --- -- '[[{"bool2":0,"str":"abc","num":123,"bool1":1}],1]' +- - bool2: 0 + str: abc + num: 123 + bool1: 1 +- 1 ... -dump({c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2)}) +c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2) --- -- '[{},0]' +- [] +- 0 ... -dump({c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END')}) +c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END') --- -- '[{},0]' +- [] +- 0 ... -dump({c:execute('CALL p1')}) +c:execute('CALL p1') --- -- '[[{"One":1},{"Three":3,"Two":2}],2]' +- - One: 1 + - Three: 3 + Two: 2 +- 2 ... -dump({c:execute('DROP PROCEDURE p1')}) +c:execute('DROP PROCEDURE p1') --- -- '[{},0]' +- [] +- 0 ... -dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2')}) +c:execute('SELECT 1 AS one UNION ALL SELECT 2') --- -- '[[{"one":1},{"one":2}],2]' +- - one: 1 + - one: 2 +- 2 ... -dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc')}) +c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc') --- -- '[[{"one":1},{"one":2},{"two":"abc"}],3]' +- - one: 1 + - one: 2 + - two: abc +- 3 ... c:quote('test \"abc\" test') --- diff --git a/test/module/net_sql.mysql.test.lua b/test/module/net_sql.mysql.test.lua index 149e0a37f492ba3cec440c146527d233c91839e7..a22226a658268f160214f95f997a62fb9075422c 100644 --- a/test/module/net_sql.mysql.test.lua +++ b/test/module/net_sql.mysql.test.lua @@ -36,14 +36,14 @@ do return err == 'error: src/module/sql/sql.lua:111: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'SEL ECT 1\' at line 1' end; --# setopt delimiter '' -dump({c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')}) - -dump({c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2)}) -dump({c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END')}) -dump({c:execute('CALL p1')}) -dump({c:execute('DROP PROCEDURE p1')}) -dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2')}) -dump({c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc')}) +c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc') + +c:execute('SELECT * FROM (SELECT ?) t WHERE 1 = 0', 2) +c:execute('CREATE PROCEDURE p1() BEGIN SELECT 1 AS One; SELECT 2 AS Two, 3 AS Three; END') +c:execute('CALL p1') +c:execute('DROP PROCEDURE p1') +c:execute('SELECT 1 AS one UNION ALL SELECT 2') +c:execute('SELECT 1 AS one UNION ALL SELECT 2; SELECT ? AS two', 'abc') c:quote('test \"abc\" test') diff --git a/test/module/net_sql.pg.result b/test/module/net_sql.pg.result index 1a6f5601cec0719bc8e72dfb01b2247bbcdb0bc8..c29fd65f8709711261f2ed01cd1ee59c2334a179 100644 --- a/test/module/net_sql.pg.result +++ b/test/module/net_sql.pg.result @@ -46,57 +46,90 @@ for tk in string.gmatch(os.getenv('PG')..':', '(.-):') do table.insert(connect, c = box.net.sql.connect('pg', unpack(connect)) --- ... -dump({c:execute('SELECT 123::text AS bla, 345')}) +c:execute('SELECT 123::text AS bla, 345') --- -- '[[{"?column?":345,"bla":"123"}],1,"SELECT 1"]' +- - ?column?: 345 + bla: '123' +- 1 +- SELECT 1 ... -dump({c:execute('SELECT -1 AS neg, NULL AS abc')}) +c:execute('SELECT -1 AS neg, NULL AS abc') --- -- '[[{"neg":-1}],1,"SELECT 1"]' +- - neg: -1 +- 1 +- SELECT 1 ... -dump({c:execute('SELECT -1.1 AS neg, 1.2 AS pos')}) +c:execute('SELECT -1.1 AS neg, 1.2 AS pos') --- -- '[[{"neg":-1.1,"pos":1.2}],1,"SELECT 1"]' +- - neg: -1.1 + pos: 1.2 +- 1 +- SELECT 1 ... -dump({c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos')}) +c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos') --- -- '[[{"neg":"{1,2}","pos":1.2}],1,"SELECT 1"]' +- - neg: '{1,2}' + pos: 1.2 +- 1 +- SELECT 1 ... -dump({c:execute('SELECT ? AS val', 'abc')}) +c:execute('SELECT ? AS val', 'abc') --- -- '[[{"val":"abc"}],1,"SELECT 1"]' +- - val: abc +- 1 +- SELECT 1 ... -dump({c:execute('SELECT ? AS val', 123)}) +c:execute('SELECT ? AS val', 123) --- -- '[[{"val":123}],1,"SELECT 1"]' +- - val: 123 +- 1 +- SELECT 1 ... -dump({c:execute('SELECT ? AS val', true)}) +c:execute('SELECT ? AS val', true) --- -- '[[{"val":true}],1,"SELECT 1"]' +- - val: true +- 1 +- SELECT 1 ... -dump({c:execute('SELECT ? AS val', false)}) +c:execute('SELECT ? AS val', false) --- -- '[[{"val":false}],1,"SELECT 1"]' +- - val: false +- 1 +- SELECT 1 ... -dump({c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc')}) +c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc') --- -- '[[{"str":"abc","num":123,"val":false}],1,"SELECT 1"]' +- - str: abc + num: 123 + val: false +- 1 +- SELECT 1 ... -dump({c:execute('DROP TABLE IF EXISTS unknown_table')}) +c:execute('DROP TABLE IF EXISTS unknown_table') --- -- '[{},0,"DROP TABLE"]' +- [] +- 0 +- DROP TABLE ... -dump({c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t')}) +c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t') --- -- '[[{"column1":1,"column2":2},{"column1":2,"column2":3}],2,"SELECT 2"]' +- - column1: 1 + column2: 2 + - column1: 2 + column2: 3 +- 2 +- SELECT 2 ... c:ping() --- - true ... -dump({c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')}) +c:select('SELECT * FROM (VALUES (1,2), (2,3)) t') --- -- '[[{"column1":1,"column2":2},{"column1":2,"column2":3}]]' +- - column1: 1 + column2: 2 + - column1: 2 + column2: 3 ... --# setopt delimiter ';' do @@ -108,13 +141,14 @@ end; - true ... --# setopt delimiter '' -dump({c:single('SELECT * FROM (VALUES (1,2)) t')}) +c:single('SELECT * FROM (VALUES (1,2)) t') --- -- '[{"column1":1,"column2":2}]' +- column1: 1 + column2: 2 ... -dump({c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')}) +c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t') --- -- '[2]' +- 2 ... --# setopt delimiter ';' do diff --git a/test/module/net_sql.pg.test.lua b/test/module/net_sql.pg.test.lua index 64f87f5df228354939ead09dda077e699330f61e..14e0f5b2f65271d1b5471216f8e60cb616c9df46 100644 --- a/test/module/net_sql.pg.test.lua +++ b/test/module/net_sql.pg.test.lua @@ -22,19 +22,19 @@ for tk in string.gmatch(os.getenv('PG')..':', '(.-):') do table.insert(connect, -- postgresql c = box.net.sql.connect('pg', unpack(connect)) -dump({c:execute('SELECT 123::text AS bla, 345')}) -dump({c:execute('SELECT -1 AS neg, NULL AS abc')}) -dump({c:execute('SELECT -1.1 AS neg, 1.2 AS pos')}) -dump({c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos')}) -dump({c:execute('SELECT ? AS val', 'abc')}) -dump({c:execute('SELECT ? AS val', 123)}) -dump({c:execute('SELECT ? AS val', true)}) -dump({c:execute('SELECT ? AS val', false)}) -dump({c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc')}) -dump({c:execute('DROP TABLE IF EXISTS unknown_table')}) -dump({c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t')}) +c:execute('SELECT 123::text AS bla, 345') +c:execute('SELECT -1 AS neg, NULL AS abc') +c:execute('SELECT -1.1 AS neg, 1.2 AS pos') +c:execute('SELECT ARRAY[1,2] AS neg, 1.2 AS pos') +c:execute('SELECT ? AS val', 'abc') +c:execute('SELECT ? AS val', 123) +c:execute('SELECT ? AS val', true) +c:execute('SELECT ? AS val', false) +c:execute('SELECT ? AS val, ? AS num, ? AS str', false, 123, 'abc') +c:execute('DROP TABLE IF EXISTS unknown_table') +c:execute('SELECT * FROM (VALUES (1,2), (2,3)) t') c:ping() -dump({c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')}) +c:select('SELECT * FROM (VALUES (1,2), (2,3)) t') --# setopt delimiter ';' do stat, err = pcall(c.single, c, 'SELECT * FROM (VALUES (1,2), (2,3)) t') @@ -42,8 +42,8 @@ do return err == 'error: src/module/sql/sql.lua:162: SQL request returned multiply rows' end; --# setopt delimiter '' -dump({c:single('SELECT * FROM (VALUES (1,2)) t')}) -dump({c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')}) +c:single('SELECT * FROM (VALUES (1,2)) t') +c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t') --# setopt delimiter ';' do stat, err = pcall(c.execute, c, 'SELEC T')