From 7ddab2dcffa72c52d293e861941102e8883399cf Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Sat, 21 Jan 2017 17:19:59 +0300 Subject: [PATCH] Fix api_sql_mysql.t to work with older MySQL versions. --- tests/include/api_sql_common.sh | 3 +++ tests/t/api_sql_mysql.t | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/include/api_sql_common.sh b/tests/include/api_sql_common.sh index eb6650d..c979ccf 100644 --- a/tests/include/api_sql_common.sh +++ b/tests/include/api_sql_common.sh @@ -144,6 +144,9 @@ function event() } print('--') con:query("DROP TABLE IF EXISTS t") + if (drv:name() == 'mysql') then + con:query("SET sql_mode='STRICT_TRANS_TABLES'") + end for i = 1, #queries do local e, m = pcall(function () con:query(queries[i]) end) if not e then print(m) end diff --git a/tests/t/api_sql_mysql.t b/tests/t/api_sql_mysql.t index 89bf1c7..c187252 100644 --- a/tests/t/api_sql_mysql.t +++ b/tests/t/api_sql_mysql.t @@ -76,14 +76,14 @@ SQL Lua API + MySQL tests sql_state = \t22001 (esc) sql_errmsg = \tData too long for column 'a' at row 1 (esc) */api_sql.lua:*: SQL error, errno = 1406, state = '22001': Data too long for column 'a' at row 1 (glob) - FATAL: mysql_drv_query() returned error 1051 (Unknown table 'sbtest.t') for query 'DROP TABLE t' + FATAL: mysql_drv_query() returned error 1051 (Unknown table '*t') for query 'DROP TABLE t' (glob) Got an error descriptor: sql_errno = \t1051 (esc) connection = \t (esc) query = \tDROP TABLE t (esc) sql_state = \t42S02 (esc) - sql_errmsg = \tUnknown table 'sbtest.t' (esc) - */api_sql.lua:*: SQL error, errno = 1051, state = '42S02': Unknown table 'sbtest.t' (glob) + sql_errmsg = \tUnknown table '*t' (esc) (glob) + */api_sql.lua:*: SQL error, errno = 1051, state = '42S02': Unknown table '*t' (glob) -- 1 2