From 2354f6f8c7ecbf336f27875131ce0efa9c1f5f7e Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sun, 2 Mar 2008 00:49:44 -0500 Subject: ODBC compatibility for commit/rollback --- src/mysqlerl.erl | 14 ++++++++++---- 1 file 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}. -- cgit v1.2.3