aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2008-03-02 00:49:44 -0500
committerBrian Cully <bjc@kublai.com>2008-03-02 00:49:44 -0500
commit2354f6f8c7ecbf336f27875131ce0efa9c1f5f7e (patch)
tree83f2c076a9fc08957b8edb740a012d501b790a5a /src
parenta8010bd7a28a8379490d40e1cf34d18ea9ff3571 (diff)
downloadmysqlerl-2354f6f8c7ecbf336f27875131ce0efa9c1f5f7e.tar.gz
mysqlerl-2354f6f8c7ecbf336f27875131ce0efa9c1f5f7e.zip
ODBC compatibility for commit/rollback
Diffstat (limited to 'src')
-rw-r--r--src/mysqlerl.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mysqlerl.erl b/src/mysqlerl.erl
index 213dbc4..a5df819 100644
--- a/src/mysqlerl.erl
+++ b/src/mysqlerl.erl
@@ -55,10 +55,16 @@ commit(Ref, CommitMode) ->
%% common_reason()
%% ok | {error, Reason}
commit(Ref, commit, Timeout) ->
- gen_server:call(Ref, #sql_commit{}, Timeout);
+ case sql_query(Ref, "COMMIT", Timeout) of
+ {num_rows, _} -> ok;
+ Other -> Other
+ end;
commit(Ref, rollback, Timeout) ->
- gen_server:call(Ref, #sql_rollback{}, Timeout).
-
+ case sql_query(Ref, "ROLLBACK", Timeout) of
+ {num_rows, _} -> ok;
+ Other -> Other
+ end.
+
%% Arguments:
%% Host = string()
%% Port = integer()
@@ -95,7 +101,7 @@ describe_table(Ref, Table) ->
%% Description = [{col_name(), odbc_data_type()}]
describe_table(Ref, Table, Timeout) ->
Q = ["DESCRIBE ", Table],
- {selected, _, Rows} = gen_server:call(Ref, #sql_query{q = Q}, Timeout),
+ {selected, _, Rows} = sql_query(Ref, Q, Timeout),
Description = [{Name, convert_type(T)} || {Name, T, _, _, _, _} <- Rows],
{ok, Description}.