Commit 1a89e8a1 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI
Browse files

Use a transaction for message migration. On 10000 messages, we have a 20x speedup.

parent dbbea2a4
......@@ -333,11 +333,15 @@ static void linphone_migrate_timestamps(sqlite3* db){
char* errmsg = NULL;
uint64_t begin=ortp_get_cur_time_ms();
linphone_sql_request(db,"BEGIN TRANSACTION");
ret = sqlite3_exec(db,"SELECT id,time,direction FROM history WHERE time != '-1'", migrate_messages, db, &errmsg);
if( ret != SQLITE_OK ){
ms_warning("Error migrating outgoing messages: %s.\n", errmsg);
linphone_sql_request(db, "ROLLBACK");
} else {
linphone_sql_request(db, "COMMIT");
uint64_t end=ortp_get_cur_time_ms();
ms_message("Migrated message timestamps to UTC in %i ms",(int)(end-begin));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment