- Change order of releasing resources according to SQLite recommendation.
- Change methods of lock from exclusive to deferred.
This will allow processes to access db while modifying db
except actual transaction.
Change-Id: I441d6c14b6b503f6f2b8599240efdfed36b6a617
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
#define __BEGIN_TRANSACTION(db) \
do { \
- if (sqlite3_exec(db, "BEGIN EXCLUSIVE", NULL, NULL, NULL) != \
+ if (sqlite3_exec(db, "BEGIN DEFERRED", NULL, NULL, NULL) != \
SQLITE_OK) { \
_LOGE("begin transaction failed: %s", sqlite3_errmsg(db)); \
sqlite3_close_v2(db); \
pkgmgrinfo_basic_free_application(info);
g_list_free_full(bind_params, free);
- sqlite3_close_v2(db);
sqlite3_finalize(stmt);
+ sqlite3_close_v2(db);
return ret;
}
}
free(dbpath);
- ret = sqlite3_exec(db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(db, "BEGIN DEFERRED", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("failed to begin transaction");
sqlite3_close_v2(db);
}
free(dbpath);
- ret = sqlite3_exec(db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(db, "BEGIN DEFERRED", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("failed to begin transaction");
sqlite3_close_v2(db);
/*Begin transaction*/
/* Setting Manifest DB */
- ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN DEFERRED", NULL, NULL, NULL);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Failed to begin transaction\n");
_LOGD("Transaction Begin\n");
pkgmgrinfo_pkginfo_filter_destroy(tmp_filter);
g_list_free_full(bind_params, free);
+ sqlite3_finalize(stmt);
sqlite3_close_v2(db);
- if (stmt)
- sqlite3_finalize(stmt);
return ret;
}