From b7b9c5e4223ee61c697ebbf554c4440710e39a3a Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Tue, 10 May 2011 14:23:33 +0400 Subject: [PATCH] More efficient sqlite3:write_many --- src/sqlite3.erl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sqlite3.erl b/src/sqlite3.erl index d4eb130..f15b093 100644 --- a/src/sqlite3.erl +++ b/src/sqlite3.erl @@ -921,9 +921,11 @@ handle_call({write, Tbl, Data}, _From, State) -> {reply, {error, Exception}, State} end; handle_call({write_many, Tbl, DataList}, _From, State) -> - do_sql_exec("BEGIN;", State), - [do_sql_exec(sqlite3_lib:write_sql(Tbl, Data), State) || Data <- DataList], - do_handle_call_sql_exec("COMMIT;", State); + SQLScript = ["BEGIN;", + [sqlite3_lib:write_sql(Tbl, Data) || Data <- DataList], + "COMMIT;"], + Reply = do_sql_exec_script(SQLScript, State), + {reply, Reply, State}; handle_call({read, Tbl}, _From, State) -> % select * from Tbl where Key = Value; try sqlite3_lib:read_sql(Tbl) of