aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/test/odbc_query_SUITE.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2011-05-30 10:32:35 +0200
committerIngela Anderton Andin <[email protected]>2011-06-13 11:11:33 +0200
commita70ee114820dd3922f3049e93981bc326af1863a (patch)
treedd90ed35ffdd4f748d6c882e66db021d48940d43 /lib/odbc/test/odbc_query_SUITE.erl
parent751ec4f918bed2f5455538e6296c6b925bcca002 (diff)
downloadotp-a70ee114820dd3922f3049e93981bc326af1863a.tar.gz
otp-a70ee114820dd3922f3049e93981bc326af1863a.tar.bz2
otp-a70ee114820dd3922f3049e93981bc326af1863a.zip
Test odbc with MySQL
Updated test framework to also be able to test the erlang odbc application with MySQL as database. Made minor changes to error-handling to improve interoperability with MySQL-drivers.
Diffstat (limited to 'lib/odbc/test/odbc_query_SUITE.erl')
-rw-r--r--lib/odbc/test/odbc_query_SUITE.erl43
1 files changed, 26 insertions, 17 deletions
diff --git a/lib/odbc/test/odbc_query_SUITE.erl b/lib/odbc/test/odbc_query_SUITE.erl
index 61106fbf84..6dee588076 100644
--- a/lib/odbc/test/odbc_query_SUITE.erl
+++ b/lib/odbc/test/odbc_query_SUITE.erl
@@ -47,15 +47,17 @@ all() ->
select_next, select_relative, select_absolute,
create_table_twice, delete_table_twice, duplicate_key,
not_connection_owner, no_result_set, query_error,
- multiple_select_result_sets, multiple_mix_result_sets,
- multiple_result_sets_error,
+ {group, multiple_result_sets},
{group, parameterized_queries}, {group, describe_table},
delete_nonexisting_row];
Other -> {skip, Other}
end.
groups() ->
- [{parameterized_queries, [],
+ [{multiple_result_sets, [], [multiple_select_result_sets,
+ multiple_mix_result_sets,
+ multiple_result_sets_error]},
+ {parameterized_queries, [],
[{group, param_integers}, param_insert_decimal,
param_insert_numeric, {group, param_insert_string},
param_insert_float, param_insert_real,
@@ -72,9 +74,15 @@ groups() ->
[describe_integer, describe_string, describe_floating,
describe_dec_num, describe_no_such_table]}].
-init_per_group(_GroupName, Config) ->
+init_per_group(multiple_result_sets, Config) ->
+ case is_supported_multiple_resultsets(?RDBMS) of
+ true ->
+ Config;
+ false ->
+ {skip, "Not supported by " ++ atom_to_list(?RDBMS) ++ "driver"}
+ end;
+init_per_group(_, Config) ->
Config.
-
end_per_group(_GroupName, Config) ->
Config.
@@ -88,9 +96,12 @@ end_per_group(_GroupName, Config) ->
%% variable, but should NOT alter/remove any existing entries.
%%--------------------------------------------------------------------
init_per_suite(Config) when is_list(Config) ->
- %% application:start(odbc),
- odbc:start(), % make sure init_per_suite fails if odbc is not built
- [{tableName, odbc_test_lib:unique_table_name()}| Config].
+ case (catch odbc:start()) of
+ ok ->
+ [{tableName, odbc_test_lib:unique_table_name()}| Config];
+ _ ->
+ {skip, "ODBC not startable"}
+ end.
%%--------------------------------------------------------------------
%% Function: end_per_suite(Config) -> _
@@ -116,6 +127,7 @@ end_per_suite(_Config) ->
%%--------------------------------------------------------------------
init_per_testcase(_Case, Config) ->
{ok, Ref} = odbc:connect(?RDBMS:connection_string(), []),
+ odbc_test_lib:strict(Ref, ?RDBMS),
Dog = test_server:timetrap(?default_timeout),
Temp = lists:keydelete(connection_ref, 1, Config),
NewConfig = lists:keydelete(watchdog, 1, Temp),
@@ -661,9 +673,6 @@ multiple_result_sets_error(Config) when is_list(Config) ->
end.
%%-------------------------------------------------------------------------
-
-%%-------------------------------------------------------------------------
-%%-------------------------------------------------------------------------
param_insert_tiny_int(doc)->
["Test insertion of tiny ints by parameterized queries."];
param_insert_tiny_int(suite) ->
@@ -899,8 +908,6 @@ param_insert_numeric(Config) when is_list(Config) ->
ok.
%%-------------------------------------------------------------------------
-
-%%-------------------------------------------------------------------------
param_insert_char(doc)->
["Test insertion of fixed length string by parameterized queries."];
param_insert_char(suite) ->
@@ -1323,8 +1330,6 @@ param_select(Config) when is_list(Config) ->
ok.
%%-------------------------------------------------------------------------
-
-%%-------------------------------------------------------------------------
describe_integer(doc) ->
["Test describe_table/[2,3] for integer columns."];
describe_integer(suite) ->
@@ -1336,7 +1341,7 @@ describe_integer(Config) when is_list(Config) ->
{updated, _} =
odbc:sql_query(Ref,
"CREATE TABLE " ++ Table ++
- " (int1 SMALLINT, int2 INT, int3 INTEGER)"),
+ " (myint1 SMALLINT, myint2 INT, myint3 INTEGER)"),
Decs = ?RDBMS:describe_integer(),
%% Make sure to test timeout clause
@@ -1397,7 +1402,7 @@ describe_dec_num(Config) when is_list(Config) ->
{updated, _} =
odbc:sql_query(Ref,
"CREATE TABLE " ++ Table ++
- " (dec DECIMAL(9,3), num NUMERIC(9,2))"),
+ " (mydec DECIMAL(9,3), mynum NUMERIC(9,2))"),
Decs = ?RDBMS:describe_dec_num(),
@@ -1449,3 +1454,7 @@ is_driver_error(Error) ->
false ->
test_server:fail(Error)
end.
+is_supported_multiple_resultsets(sqlserver) ->
+ true;
+is_supported_multiple_resultsets(_) ->
+ false.