Fix api_sql_mysql.t to work with older MySQL versions.

This commit is contained in:
Alexey Kopytov
2017-01-21 17:19:59 +03:00
parent cdabf72b7b
commit 7ddab2dcff
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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<sql_connection> (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