make write_many nestable via SAVEPOINT instead of BEGIN/COMMIT

This commit is contained in:
Ryan Flynn
2013-01-02 15:54:51 -05:00
parent a1e3fbc4b0
commit 14874a9776

View File

@@ -828,9 +828,9 @@ handle_call({write, Tbl, Data}, _From, State) ->
{reply, {error, Exception}, State} {reply, {error, Exception}, State}
end; end;
handle_call({write_many, Tbl, DataList}, _From, State) -> handle_call({write_many, Tbl, DataList}, _From, State) ->
SQLScript = ["BEGIN;", SQLScript = ["SAVEPOINT 'erlang-sqlite3-write_many';",
[sqlite3_lib:write_sql(Tbl, Data) || Data <- DataList], [sqlite3_lib:write_sql(Tbl, Data) || Data <- DataList],
"COMMIT;"], "RELEASE SAVEPOINT 'erlang-sqlite3-write_many';"],
Reply = do_sql_exec_script(SQLScript, State), Reply = do_sql_exec_script(SQLScript, State),
{reply, Reply, State}; {reply, Reply, State};
handle_call({read, Tbl}, _From, State) -> handle_call({read, Tbl}, _From, State) ->