if (ret == PMINFO_R_OK) {
ret = pkgmgrinfo_appinfo_filter_add_string (handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");
if (ret == PMINFO_R_OK) {
- isf_db_begin_transaction();
- ret = pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, isf_pkg_ime_app_list_cb, NULL);
- if (ret != PMINFO_R_OK) {
- LOGW ("pkgmgrinfo_appinfo_filter_foreach_appinfo failed(%d)", ret);
- isf_db_rollback_transaction();
- } else {
- isf_db_commit_transaction();
+ if (isf_db_begin_transaction ()) {
+ ret = pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, isf_pkg_ime_app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ LOGW ("pkgmgrinfo_appinfo_filter_foreach_appinfo failed(%d)", ret);
+ isf_db_rollback_transaction ();
+ } else {
+ isf_db_commit_transaction ();
+ }
}
}
else {
static inline int _db_create_table(void)
{
- _begin_transaction();
-
- int ret = _db_create_ime_info();
- if (ret < 0) {
- _rollback_transaction();
- return ret;
+ int ret = _begin_transaction();
+ if (ret == EXIT_SUCCESS) {
+ ret = _db_create_ime_info();
+ if (ret < 0) {
+ LOGW("Failed");
+ _rollback_transaction();
+ return ret;
+ }
+ ret = _commit_transaction();
+ } else {
+ LOGW("Failed");
}
-
- _commit_transaction();
return ret;
}
int ret = _db_init();
if (databaseInfo.need_reset) {
_db_disconnect();
+ LOGD("need_reset, removing db");
databaseInfo.need_reset = false;
remove(databaseInfo.pPath);
ret = _db_init();
if (_db_is_connected() == 0) {
if (_db_connect() == 0) {
ret = _begin_transaction();
+ } else {
+ LOGW("Connect failed!");
}
- } else
- LOGW("failed");
+ } else {
+ LOGW("Already connected!");
+ }
return (ret == EXIT_SUCCESS);
}