aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2012-02-09 17:10:14 -0500
committerBrian Cully <bjc@kublai.com>2012-02-09 17:10:14 -0500
commit3ae64e29aaa0ab8c63925bda90b2ee9fd0f173f1 (patch)
tree27c172751c4e841ee7c360aae0f76adca58f4063
parentf408c9aa01105f1a9d0826144269a465c3185014 (diff)
downloadmysqlerl-3ae64e29aaa0ab8c63925bda90b2ee9fd0f173f1.tar.gz
mysqlerl-3ae64e29aaa0ab8c63925bda90b2ee9fd0f173f1.zip
Add a few tests for cursors when no results are present.
-rw-r--r--test/mysqlerl_SUITE.erl28
1 files changed, 24 insertions, 4 deletions
diff --git a/test/mysqlerl_SUITE.erl b/test/mysqlerl_SUITE.erl
index 58591f8..f6ed29c 100644
--- a/test/mysqlerl_SUITE.erl
+++ b/test/mysqlerl_SUITE.erl
@@ -146,7 +146,8 @@ end_per_testcase(_TestCase, Config) ->
%%--------------------------------------------------------------------
groups() ->
[{all, [sequence],
- [{group, read_queries}, {group, cursor}]},
+ [{group, read_queries}, {group, cursor},
+ {group, trans}, {group, errors}]},
{read_queries, [shuffle],
[describe_table, sql_query, param_query, select_count]},
{cursor, [shuffle],
@@ -155,7 +156,10 @@ groups() ->
next_all, prev_all, next_prev_next, prev_next_prev,
select_next, select_relative, select_absolute]},
{trans, [sequence],
- [commit, rollback]}].
+ [commit, rollback]},
+ {errors, [shuffle],
+ [select_no_results, first_no_results, last_no_results,
+ next_no_results, prev_no_results]}].
%%--------------------------------------------------------------------
%% @spec all() -> GroupsAndTestCases | {skip,Reason}
@@ -292,9 +296,25 @@ prev_next_prev(Config) ->
{selected, ?COLS, [{"bjc", _}]} = mysqlerl:prev(?config(db_ref, Config)).
commit(Config) ->
- ok = mysqlerl:commit(?config(db_ref, Config), commit),
+ {updated, 0} = mysqlerl:commit(?config(db_ref, Config), commit),
{skip, "Not implemented"}.
rollback(Config) ->
- ok = mysqlerl:rollback(?config(db_ref, Config), rollback),
+ {updated, 0} = mysqlerl:commit(?config(db_ref, Config), rollback),
{skip, "Not implemented"}.
+
+select_no_results(Config) ->
+ {error, result_set_does_not_exist} = mysqlerl:select(?config(db_ref, Config),
+ next, 1).
+
+first_no_results(Config) ->
+ {error, result_set_does_not_exist} = mysqlerl:first(?config(db_ref, Config)).
+
+last_no_results(Config) ->
+ {error, result_set_does_not_exist} = mysqlerl:last(?config(db_ref, Config)).
+
+next_no_results(Config) ->
+ {error, result_set_does_not_exist} = mysqlerl:next(?config(db_ref, Config)).
+
+prev_no_results(Config) ->
+ {error, result_set_does_not_exist} = mysqlerl:prev(?config(db_ref, Config)).