Skip to content

Commit

Permalink
test case for stored procedure with (32bit) integer out params on 64b…
Browse files Browse the repository at this point in the history
…it platform
  • Loading branch information
kinogmt authored and rimmius committed Mar 27, 2013
1 parent 0555a3a commit 16ea5fc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/odbc/test/odbc_query_SUITE.erl
Expand Up @@ -43,7 +43,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
case odbc_test_lib:odbc_check() of
ok ->
[sql_query, next, {group, scrollable_cursors}, select_count,
[stored_proc, sql_query, next, {group, scrollable_cursors}, select_count,
select_next, select_relative, select_absolute,
create_table_twice, delete_table_twice, duplicate_key,
not_connection_owner, no_result_set, query_error,
Expand Down Expand Up @@ -172,6 +172,24 @@ end_per_testcase(_Case, Config) ->
%%-------------------------------------------------------------------------
%% Test cases starts here.
%%-------------------------------------------------------------------------
stored_proc(doc)->
["Test stored proc with OUT param"];
stored_proc(suite) -> [];
stored_proc(Config) when is_list(Config) ->
case ?RDBMS of
oracle ->
Ref = ?config(connection_ref, Config),
{updated, _} =
odbc:sql_query(Ref,
?RDBMS:stored_proc_integer_out()),
Result = ?RDBMS:query_result(),
Result =
?RDBMS:param_query(Ref),
ok;
_ ->
{skip, "stored proc not yet supported"}
end.

sql_query(doc)->
["Test the common cases"];
sql_query(suite) -> [];
Expand Down
23 changes: 23 additions & 0 deletions lib/odbc/test/oracle.erl
Expand Up @@ -240,3 +240,26 @@ describe_floating() ->
{ok,[{"F",sql_double},{"R",sql_double},{"D",sql_double}]}.
describe_dec_num() ->
{ok,[{"MYDEC",{sql_decimal,9,3}},{"MYNUM",{sql_decimal,9,2}}]}.

stored_proc_integer_out() ->
"create or replace PROCEDURE test_proc1(" ++
"int_a OUT NUMBER, " ++
"int_b OUT NUMBER) " ++
"is " ++
"begin " ++
" int_a := 123; " ++
" int_b := 456; " ++
"exception " ++
"WHEN NO_DATA_FOUND THEN " ++
" int_a := 0; " ++
" int_b := 0; " ++
"end;".

param_query(Ref) ->
odbc:param_query(Ref, "call test_proc1(?,?)",
[{sql_integer, out, [0]},
{sql_integer, out, [0]}]).


query_result() ->
{executed, 2, [{123, 456}]}.

0 comments on commit 16ea5fc

Please sign in to comment.