aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/test/odbc_data_type_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_data_type_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_data_type_SUITE.erl')
-rw-r--r--lib/odbc/test/odbc_data_type_SUITE.erl344
1 files changed, 170 insertions, 174 deletions
diff --git a/lib/odbc/test/odbc_data_type_SUITE.erl b/lib/odbc/test/odbc_data_type_SUITE.erl
index 633ddec27f..3585446ec8 100644
--- a/lib/odbc/test/odbc_data_type_SUITE.erl
+++ b/lib/odbc/test/odbc_data_type_SUITE.erl
@@ -44,24 +44,29 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
case odbc_test_lib:odbc_check() of
ok ->
- [{group, char}, {group, int}, {group, floats},
+ [{group, char},{group, fixed_char}, {group, binary_char},
+ {group, fixed_binary_char},
+ {group, int}, {group, floats},
{group, dec_and_num}, timestamp];
Other -> {skip, Other}
end.
groups() ->
[{char, [],
- [char_fixed_lower_limit, char_fixed_upper_limit,
- char_fixed_padding, varchar_lower_limit,
+ [varchar_lower_limit,
varchar_upper_limit, varchar_no_padding,
text_lower_limit, text_upper_limit, unicode]},
+ {fixed_char, [],
+ [char_fixed_lower_limit, char_fixed_upper_limit,
+ char_fixed_padding]},
{binary_char, [],
- [binary_char_fixed_lower_limit,
- binary_char_fixed_upper_limit,
- binary_char_fixed_padding, binary_varchar_lower_limit,
+ [binary_varchar_lower_limit,
binary_varchar_upper_limit, binary_varchar_no_padding,
binary_text_lower_limit, binary_text_upper_limit,
unicode]},
+ {fixed_binary_char, [], [binary_char_fixed_lower_limit,
+ binary_char_fixed_upper_limit,
+ binary_char_fixed_padding]},
{int, [],
[tiny_int_lower_limit, tiny_int_upper_limit,
small_int_lower_limit, small_int_upper_limit,
@@ -74,6 +79,15 @@ groups() ->
[dec_long, dec_double, dec_bignum, num_long, num_double,
num_bignum]}].
+init_per_group(GroupName, Config) when GroupName == fixed_char;
+ GroupName == fixed_binary_char ->
+ case ?RDBMS of
+ mysql ->
+ {skip, "No supported by MYSQL"};
+ _ ->
+ Config
+ end;
+
init_per_group(_GroupName, Config) ->
Config.
@@ -92,9 +106,12 @@ end_per_group(_GroupName, Config) ->
%% variable, but should NOT alter/remove any existing entries.
%%--------------------------------------------------------------------
init_per_suite(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) -> _
@@ -118,23 +135,22 @@ end_per_suite(_Config) ->
%% Note: This function is free to add any key/value pairs to the Config
%% variable, but should NOT alter/remove any existing entries.
%%--------------------------------------------------------------------
-init_per_testcase(varchar_upper_limit, _Config) ->
- {skip, "Known bug in database"};
-init_per_testcase(text_upper_limit, _Config) ->
- {skip, "Consumes too much resources"};
-
-init_per_testcase(Case, Config) when Case == bit_true; Case == bit_false ->
- case is_supported_bit(?RDBMS) of
+init_per_testcase(Case, Config) when Case == varchar_upper_limit;
+ Case == binary_varchar_upper_limit;
+ Case == varchar_no_padding;
+ Case == binary_varchar_no_padding ->
+ case is_fixed_upper_limit(?RDBMS) of
true ->
common_init_per_testcase(Case, Config);
false ->
- {skip, "Not supported by driver"}
+ {skip, "Upper limit is not fixed in" ++ atom_to_list(?RDBMS)}
end;
-init_per_testcase(Case, Config) when Case == multiple_select_result_sets;
- Case == multiple_mix_result_sets;
- Case == multiple_result_sets_error ->
- case is_supported_multiple_resultsets(?RDBMS) of
+init_per_testcase(text_upper_limit, _Config) ->
+ {skip, "Consumes too much resources"};
+
+init_per_testcase(Case, Config) when Case == bit_true; Case == bit_false ->
+ case is_supported_bit(?RDBMS) of
true ->
common_init_per_testcase(Case, Config);
false ->
@@ -151,11 +167,6 @@ init_per_testcase(param_insert_tiny_int = Case, Config) ->
init_per_testcase(Case, Config) ->
common_init_per_testcase(Case, Config).
-is_supported_multiple_resultsets(sqlserver) ->
- true;
-is_supported_multiple_resultsets(_) ->
- false.
-
is_supported_tinyint(sqlserver) ->
true;
is_supported_tinyint(_) ->
@@ -166,6 +177,11 @@ is_supported_bit(sqlserver) ->
is_supported_bit(_) ->
false.
+is_fixed_upper_limit(mysql) ->
+ false;
+is_fixed_upper_limit(_) ->
+ true.
+
common_init_per_testcase(Case, Config) ->
case atom_to_list(Case) of
"binary" ++ _ ->
@@ -177,6 +193,7 @@ common_init_per_testcase(Case, Config) ->
_ ->
{ok, Ref} = odbc:connect(?RDBMS:connection_string(), [])
end,
+ 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),
@@ -218,18 +235,18 @@ char_fixed_lower_limit(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref,
"CREATE TABLE " ++ Table ++
- ?RDBMS:create_fixed_char_table(
+ ?RDBMS:create_fixed_char_table(
(?RDBMS:fixed_char_min() - 1))),
%% Lower limit
{updated, _} = % Value == 0 || -1 driver dependent!
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_fixed_char_table(
- ?RDBMS:fixed_char_min())),
+ ?RDBMS:create_fixed_char_table(
+ ?RDBMS:fixed_char_min())),
%% Right length data
{updated, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a, ?RDBMS:fixed_char_min())
+ "'" ++ string:chars($a, ?RDBMS:fixed_char_min())
++ "')"),
%% Select data
{selected, Fields,[{"a"}]} =
@@ -240,11 +257,11 @@ char_fixed_lower_limit(Config) when is_list(Config) ->
%% Too long data
{error, _} =
odbc:sql_query(Ref,"INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a,
- (?RDBMS:fixed_char_min()
- + 1))
- ++ "')"),
- ok.
+ "'" ++ string:chars($a,
+ (?RDBMS:fixed_char_min()
+ + 1))
+ ++ "')").
+
%%-------------------------------------------------------------------------
char_fixed_upper_limit(doc) ->
@@ -292,8 +309,7 @@ char_fixed_upper_limit(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
?RDBMS:create_fixed_char_table(
- (?RDBMS:fixed_char_max() + 1))),
- ok
+ (?RDBMS:fixed_char_max() + 1)))
end.
%%-------------------------------------------------------------------------
@@ -310,20 +326,20 @@ char_fixed_padding(Config) when is_list(Config) ->
%% Data should be padded with blanks
{updated, _} = % Value == 0 || -1 driver dependent!
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_fixed_char_table(
- ?RDBMS:fixed_char_max())),
+ ?RDBMS:create_fixed_char_table(
+ ?RDBMS:fixed_char_max())),
- {updated, _} =
+ {updated, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a,
- ?RDBMS:fixed_char_min())
+ "'" ++ string:chars($a,
+ ?RDBMS:fixed_char_min())
++ "')"),
{selected, Fields, [{CharStr}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
true = length(CharStr) == ?RDBMS:fixed_char_max(),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
+
%%-------------------------------------------------------------------------
varchar_lower_limit(doc) ->
@@ -336,33 +352,33 @@ varchar_lower_limit(Config) when is_list(Config) ->
%% Below limit
{error, _} =
- odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_var_char_table(
- ?RDBMS:var_char_min() - 1)),
+ odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
+ ?RDBMS:create_var_char_table(
+ ?RDBMS:var_char_min() - 1)),
%% Lower limit
{updated, _} = % Value == 0 || -1 driver dependent!
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_var_char_table(
- ?RDBMS:var_char_min())),
+ ?RDBMS:create_var_char_table(
+ ?RDBMS:var_char_min())),
+
+ Str = string:chars($a, ?RDBMS:var_char_min()),
%% Right length data
{updated, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a, ?RDBMS:var_char_min())
- ++ "')"),
+ "'" ++ Str ++ "')"),
%% Select data
- {selected, Fields, [{"a"}]} =
+ {selected, Fields, [{Str}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
["FIELD"] = odbc_test_lib:to_upper(Fields),
- %% Too long data
- {error, _} =
- odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a,
- (?RDBMS:var_char_min()+1))
- ++ "')"),
- ok.
+ %% Too long datae
+ {error, _} =
+ odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
+ "'" ++ string:chars($a,
+ (?RDBMS:var_char_min()+1))
+ ++ "')").
%%-------------------------------------------------------------------------
@@ -438,8 +454,7 @@ varchar_no_padding(Config) when is_list(Config) ->
{selected, Fields, [{CharStr}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
true = length(CharStr) /= ?RDBMS:var_char_max(),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
%%-------------------------------------------------------------------------
@@ -462,8 +477,7 @@ text_lower_limit(Config) when is_list(Config) ->
{selected, Fields, [{"a"}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
%%-------------------------------------------------------------------------
@@ -493,8 +507,7 @@ text_upper_limit(Config) when is_list(Config) ->
%% {error, _} =
%% odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
%% "'" ++ string:chars($a, (?RDBMS:text_max()+1))
-%% ++ "')"),
-%% ok.
+%% ++ "')").
%%-------------------------------------------------------------------------
@@ -518,13 +531,18 @@ binary_char_fixed_lower_limit(Config) when is_list(Config) ->
?RDBMS:create_fixed_char_table(
?RDBMS:fixed_char_min())),
+ Str = string:chars($a, ?RDBMS:fixed_char_min()),
+
%% Right length data
{updated, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a, ?RDBMS:fixed_char_min())
+ "'" ++ Str
++ "')"),
+
+ Bin = list_to_binary(Str),
+
%% Select data
- {selected, Fields,[{<<"a">>}]} =
+ {selected, Fields,[{Bin}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
["FIELD"] = odbc_test_lib:to_upper(Fields),
@@ -535,8 +553,7 @@ binary_char_fixed_lower_limit(Config) when is_list(Config) ->
"'" ++ string:chars($a,
(?RDBMS:fixed_char_min()
+ 1))
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
binary_char_fixed_upper_limit(doc) ->
@@ -614,8 +631,8 @@ binary_char_fixed_padding(Config) when is_list(Config) ->
{selected, Fields, [{CharBin}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
true = size(CharBin) == ?RDBMS:fixed_char_max(),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
+
%%-------------------------------------------------------------------------
binary_varchar_lower_limit(doc) ->
@@ -637,13 +654,17 @@ binary_varchar_lower_limit(Config) when is_list(Config) ->
?RDBMS:create_var_char_table(
?RDBMS:var_char_min())),
+ Str = string:chars($a, ?RDBMS:var_char_min()),
+
%% Right length data
{updated, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ string:chars($a, ?RDBMS:var_char_min())
+ "'" ++ Str
++ "')"),
+ BinStr = list_to_binary(Str),
+
%% Select data
- {selected, Fields, [{<<"a">>}]} =
+ {selected, Fields, [{BinStr}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
["FIELD"] = odbc_test_lib:to_upper(Fields),
@@ -653,8 +674,7 @@ binary_varchar_lower_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ string:chars($a,
(?RDBMS:var_char_min()+1))
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
@@ -703,8 +723,7 @@ binary_varchar_upper_limit(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
?RDBMS:create_var_char_table(
- (?RDBMS:var_char_max() + 1))),
- ok
+ (?RDBMS:var_char_max() + 1)))
end.
%%-------------------------------------------------------------------------
@@ -730,8 +749,7 @@ binary_varchar_no_padding(Config) when is_list(Config) ->
{selected, Fields, [{CharBin}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
true = size(CharBin) /= ?RDBMS:var_char_max(),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
%%-------------------------------------------------------------------------
@@ -754,8 +772,7 @@ binary_text_lower_limit(Config) when is_list(Config) ->
{selected, Fields, [{<<"a">>}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
%%-------------------------------------------------------------------------
@@ -785,11 +802,7 @@ binary_text_upper_limit(Config) when is_list(Config) ->
%% {error, _} =
%% odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
%% "'" ++ string:chars($a, (?RDBMS:text_max()+1))
-%% ++ "')"),
-%% ok.
-
-
-%%-------------------------------------------------------------------------
+%% ++ "')").
%%-------------------------------------------------------------------------
@@ -823,8 +836,7 @@ tiny_int_lower_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:tiny_int_min()
- 1)
- ++ "')"),
- ok
+ ++ "')")
end.
%%-------------------------------------------------------------------------
@@ -858,8 +870,7 @@ tiny_int_upper_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:tiny_int_max()
+ 1)
- ++ "')"),
- ok
+ ++ "')")
end.
%%-------------------------------------------------------------------------
@@ -889,8 +900,7 @@ small_int_lower_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:small_int_min()
- 1)
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
@@ -919,8 +929,7 @@ small_int_upper_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref,"INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:small_int_max()
+ 1)
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
int_lower_limit(doc) ->
@@ -947,8 +956,7 @@ int_lower_limit(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:int_min() - 1)
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
@@ -976,8 +984,7 @@ int_upper_limit(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:int_max() + 1)
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
@@ -1006,8 +1013,7 @@ big_int_lower_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:big_int_min()
- 1)
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
@@ -1036,8 +1042,7 @@ big_int_upper_limit(Config) when is_list(Config) ->
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(?RDBMS:big_int_max()
+ 1)
- ++ "')"),
- ok.
+ ++ "')").
%%-------------------------------------------------------------------------
bit_false(doc) ->
@@ -1069,8 +1074,7 @@ bit_false(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(-1)
- ++ "')"),
- ok
+ ++ "')")
end.
%%-------------------------------------------------------------------------
@@ -1105,14 +1109,10 @@ bit_true(Config) when is_list(Config) ->
{error, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
"'" ++ integer_to_list(-1)
- ++ "')"),
- ok
+ ++ "')")
end.
%%-------------------------------------------------------------------------
-
-
-%%-------------------------------------------------------------------------
float_lower_limit(doc) ->
[""];
float_lower_limit(suite) ->
@@ -1122,44 +1122,45 @@ float_lower_limit(Config) when is_list(Config) ->
Ref = ?config(connection_ref, Config),
Table = ?config(tableName, Config),
- {updated, _} = % Value == 0 || -1 driver dependent!
- odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_float_table()),
-
- {updated, _} =
- odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ float_to_list(
- ?RDBMS:float_min())
- ++ "')"),
- {selected,[_ColName],[{MinFloat}]} =
- odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
-
- true = ?RDBMS:float_min() == MinFloat,
-
case ?RDBMS of
- oracle ->
- {updated, _} = % Value == 0 || -1 driver dependent!
- odbc:sql_query(Ref, "DROP TABLE " ++ Table),
-
+ mysql ->
+ {skip, "Not clearly defined in MYSQL"};
+ _ ->
{updated, _} = % Value == 0 || -1 driver dependent!
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_float_table()),
+ ?RDBMS:create_float_table()),
{updated, _} =
- odbc:sql_query(Ref,
- "INSERT INTO " ++ Table ++" VALUES(" ++
- ?RDBMS:float_underflow() ++ ")"),
-
- SelectResult = ?RDBMS:float_zero_selected(),
- SelectResult =
- odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table);
- _ ->
- {error, _} =
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- ?RDBMS:float_underflow() ++ ")")
- end,
- ok.
+ "'" ++ float_to_list(
+ ?RDBMS:float_min())
+ ++ "')"),
+ {selected,[_ColName],[{MinFloat}]} =
+ odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
+ true = ?RDBMS:float_min() == MinFloat,
+
+ case ?RDBMS of
+ oracle ->
+ {updated, _} = % Value == 0 || -1 driver dependent!
+ odbc:sql_query(Ref, "DROP TABLE " ++ Table),
+
+ {updated, _} = % Value == 0 || -1 driver dependent!
+ odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
+ ?RDBMS:create_float_table()),
+ {updated, _} =
+ odbc:sql_query(Ref,
+ "INSERT INTO " ++ Table ++" VALUES(" ++
+ ?RDBMS:float_underflow() ++ ")"),
+ SelectResult = ?RDBMS:float_zero_selected(),
+ SelectResult =
+ odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table);
+ _ ->
+ {error, _} =
+ odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
+ ?RDBMS:float_underflow() ++ ")")
+ end
+ end.
%%-------------------------------------------------------------------------
float_upper_limit(doc) ->
@@ -1170,26 +1171,28 @@ float_upper_limit(Config) when is_list(Config) ->
Ref = ?config(connection_ref, Config),
Table = ?config(tableName, Config),
- {updated, _} = % Value == 0 || -1 driver dependent!
- odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
- ?RDBMS:create_float_table()),
-
- {updated, _} =
- odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- "'" ++ float_to_list(
- ?RDBMS:float_max())
- ++ "')"),
-
+ case ?RDBMS of
+ mysql ->
+ {skip, "Not clearly defined in MYSQL"};
+ _->
+ {updated, _} = % Value == 0 || -1 driver dependent!
+ odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
+ ?RDBMS:create_float_table()),
- {selected,[_ColName],[{MaxFloat}]}
- = odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
+ {updated, _} =
+ odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
+ "'" ++ float_to_list(
+ ?RDBMS:float_max())
+ ++ "')"),
+ {selected,[_ColName],[{MaxFloat}]}
+ = odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- true = ?RDBMS:float_max() == MaxFloat,
+ true = ?RDBMS:float_max() == MaxFloat,
- {error, _} =
- odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
- ?RDBMS:float_overflow() ++ ")"),
- ok.
+ {error, _} =
+ odbc:sql_query(Ref, "INSERT INTO " ++ Table ++" VALUES(" ++
+ ?RDBMS:float_overflow() ++ ")")
+ end.
%%-------------------------------------------------------------------------
float_zero(doc) ->
@@ -1209,8 +1212,7 @@ float_zero(Config) when is_list(Config) ->
SelectResult = ?RDBMS:float_zero_selected(),
SelectResult =
- odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ok.
+ odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table).
%%-------------------------------------------------------------------------
real_zero(doc) ->
["Test the real value zero."];
@@ -1234,10 +1236,8 @@ real_zero(Config) when is_list(Config) ->
SelectResult = ?RDBMS:real_zero_selected(),
SelectResult =
- odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ok
+ odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table)
end.
-%%-------------------------------------------------------------------------
%%------------------------------------------------------------------------
dec_long(doc) ->
[""];
@@ -1256,8 +1256,7 @@ dec_long(Config) when is_list(Config) ->
{selected, Fields, [{2}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
%%------------------------------------------------------------------------
dec_double(doc) ->
[""];
@@ -1304,8 +1303,7 @@ dec_double(Config) when is_list(Config) ->
{selected, Fields2, [{1.60000}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields2),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields2).
%%------------------------------------------------------------------------
dec_bignum(doc) ->
@@ -1338,8 +1336,7 @@ dec_bignum(Config) when is_list(Config) ->
{selected, Fields1, [{"1.6"}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields1),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields1).
%%------------------------------------------------------------------------
num_long(doc) ->
[""];
@@ -1358,8 +1355,7 @@ num_long(Config) when is_list(Config) ->
{selected, Fields, [{2}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields).
%%------------------------------------------------------------------------
num_double(doc) ->
[""];
@@ -1405,8 +1401,7 @@ num_double(Config) when is_list(Config) ->
{selected, Fields2, [{1.6000}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields2),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields2).
%%------------------------------------------------------------------------
num_bignum(doc) ->
[""];
@@ -1438,8 +1433,7 @@ num_bignum(Config) when is_list(Config) ->
{selected, Fields1, [{"1.6"}]} =
odbc:sql_query(Ref,"SELECT FIELD FROM " ++ Table),
- ["FIELD"] = odbc_test_lib:to_upper(Fields1),
- ok.
+ ["FIELD"] = odbc_test_lib:to_upper(Fields1).
%%------------------------------------------------------------------------
unicode(doc) ->
@@ -1471,6 +1465,8 @@ unicode(Config) when is_list(Config) ->
w_char_support_win(Ref, Table, Latin1Data);
postgres ->
direct_utf8(Ref, Table, Latin1Data);
+ mysql ->
+ direct_utf8(Ref, Table, Latin1Data);
oracle ->
{skip, "not currently supported"}
end.