Adding specific file for ODBC.
Adding configuration to some different return values of API functions.
This commit is contained in:
parent
1d2e800f51
commit
a861614daf
@ -1,8 +1,10 @@
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- MySQL specific tests and configurations.
|
-- MySQL specific tests and configurations.
|
||||||
-- $Id: mysql.lua,v 1.2 2006/01/10 18:34:54 tomas Exp $
|
-- $Id: mysql.lua,v 1.3 2006/01/23 20:13:25 tomas Exp $
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
QUERYING_STRING_TYPE_NAME = "binary(65535)"
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Build SQL command to create the test table.
|
-- Build SQL command to create the test table.
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
10
tests/odbc.lua
Normal file
10
tests/odbc.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---------------------------------------------------------------------
|
||||||
|
-- ODBC specific tests and configurations.
|
||||||
|
-- $Id: odbc.lua,v 1.1 2006/01/23 20:13:25 tomas Exp $
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
QUERYING_STRING_TYPE_NAME = "string"
|
||||||
|
-- The CREATE_TABLE_RETURN_VALUE and DROP_TABLE_RETURN_VALUE works
|
||||||
|
-- with -1 on MS Acess Driver, and 0 on SQL Server Driver
|
||||||
|
CREATE_TABLE_RETURN_VALUE = -1
|
||||||
|
DROP_TABLE_RETURN_VALUE = -1
|
@ -4,6 +4,12 @@
|
|||||||
TOTAL_FIELDS = 40
|
TOTAL_FIELDS = 40
|
||||||
TOTAL_ROWS = 40 --unused
|
TOTAL_ROWS = 40 --unused
|
||||||
|
|
||||||
|
DEFINITION_STRING_TYPE_NAME = "text"
|
||||||
|
QUERYING_STRING_TYPE_NAME = "text"
|
||||||
|
|
||||||
|
CREATE_TABLE_RETURN_VALUE = 0
|
||||||
|
DROP_TABLE_RETURN_VALUE = 0
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Produces a SQL statement which completely erases a table.
|
-- Produces a SQL statement which completely erases a table.
|
||||||
-- @param table_name String with the name of the table.
|
-- @param table_name String with the name of the table.
|
||||||
@ -104,7 +110,7 @@ end
|
|||||||
function define_table (n)
|
function define_table (n)
|
||||||
local t = {}
|
local t = {}
|
||||||
for i = 1, n do
|
for i = 1, n do
|
||||||
table.insert (t, "f"..i.." varchar (30)")
|
table.insert (t, "f"..i.." "..DEFINITION_STRING_TYPE_NAME)
|
||||||
end
|
end
|
||||||
return "create table t ("..table.concat (t, ',')..")"
|
return "create table t ("..table.concat (t, ',')..")"
|
||||||
end
|
end
|
||||||
@ -118,7 +124,7 @@ function create_table ()
|
|||||||
CONN = CONN_OK (ENV:connect (datasource, username, password))
|
CONN = CONN_OK (ENV:connect (datasource, username, password))
|
||||||
-- Create t.
|
-- Create t.
|
||||||
local cmd = define_table(TOTAL_FIELDS)
|
local cmd = define_table(TOTAL_FIELDS)
|
||||||
assert2 (0, CONN:execute (cmd))
|
assert2 (CREATE_TABLE_RETURN_VALUE, CONN:execute (cmd))
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@ -423,8 +429,8 @@ function column_info ()
|
|||||||
assert2 (4, table.getn(types), "incorrect column types table")
|
assert2 (4, table.getn(types), "incorrect column types table")
|
||||||
for i = 1, table.getn(names) do
|
for i = 1, table.getn(names) do
|
||||||
assert2 ("f"..i, names[i], "incorrect column names table")
|
assert2 ("f"..i, names[i], "incorrect column names table")
|
||||||
local type_i = string.gsub(types[i], "%s+", "")
|
local type_i = types[i]
|
||||||
assert (type_i == "adVarWChar" or type_i == "varchar(30)" or type_i == "string" or type_i == "string(30)", "incorrect column types table")
|
assert (type_i == QUERYING_STRING_TYPE_NAME, "incorrect column types table")
|
||||||
end
|
end
|
||||||
-- check if the tables are being reused.
|
-- check if the tables are being reused.
|
||||||
local n2, t2 = cur:getcolnames(), cur:getcoltypes()
|
local n2, t2 = cur:getcolnames(), cur:getcoltypes()
|
||||||
@ -478,7 +484,7 @@ end
|
|||||||
function drop_table ()
|
function drop_table ()
|
||||||
-- Postgres retorna 0, enquanto ODBC retorna -1.
|
-- Postgres retorna 0, enquanto ODBC retorna -1.
|
||||||
CONN:setautocommit(true)
|
CONN:setautocommit(true)
|
||||||
assert2 (0, CONN:execute ("drop table t"))
|
assert2 (DROP_TABLE_RETURN_VALUE, CONN:execute ("drop table t"))
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user