static int __uam_db_upgrade_version(unsigned int old_ver, unsigned int new_ver)
{
FUNC_ENTRY;
+ int ret = UAM_ERROR_NONE;
unsigned int i;
for (i = old_ver + 1; i <= new_ver; i++) {
- retv_if(UAM_ERROR_NONE != __uam_db_upgrade(i), UAM_ERROR_DB_FAILED);
+ ret = __uam_db_upgrade(i);
+ if (UAM_ERROR_NONE != ret) {
+ UAM_ERR("Faild to __uam_db_upgrade(%d)", i);
+ ret = UAM_ERROR_DB_FAILED;
+ break;
+ }
}
FUNC_EXIT;
- return UAM_ERROR_NONE;
+ return ret;
}
int _uam_db_check_version(void)
static int __uam_db_check_integrity(void)
{
FUNC_ENTRY;
+ int ret = UAM_ERROR_NONE;
char *sql = NULL;
sql = sqlite3_mprintf("PRAGMA integrity_check");
- retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, __uam_db_check_integrity_cb), UAM_ERROR_DB_FAILED);
- sqlite3_free(sql);
- UAM_DBG("Successfully verified database integrity");
+ ret = __uam_db_exec_sql(sql, __uam_db_check_integrity_cb);
+ if (UAM_ERROR_NONE != ret)
+ UAM_ERR("Faild to __uam_db_exec_sql()");
+ else
+ UAM_DBG("Successfully verified database integrity");
+
+ sqlite3_free(sql);
FUNC_EXIT;
- return UAM_ERROR_NONE;
+ return ret;
}
static int __uam_db_set_locking_mode(void)
int ret = UAM_ERROR_NONE;
sql = sqlite3_mprintf(table_name);
- retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, NULL), UAM_ERROR_DB_FAILED);
+ ret = __uam_db_exec_sql(sql, NULL);
+
+ if (UAM_ERROR_NONE != ret)
+ UAM_ERR("Faild to __uam_db_exec_sql()");
+ else
+ UAM_DBG("Successfully verified database integrity");
+
sqlite3_free(sql);
return ret;
{
FUNC_ENTRY;
char *sql;
-
+ int ret= UAM_ERROR_NONE;
int max_retries = 2;
int max_attempts = 10;
/* Enable persist journal mode */
sql = sqlite3_mprintf("PRAGMA journal_mode = PERSIST");
- retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, NULL), UAM_ERROR_DB_FAILED);
+ ret = __uam_db_exec_sql(sql, NULL);
sqlite3_free(sql);
+ if (UAM_ERROR_NONE != ret) {
+ UAM_ERR("Faile to __uam_db_exec_sql()");
+ return UAM_ERROR_DB_FAILED;
+ }
if (NULL == database) {
unlink(DATABASE_FULL_PATH);
}
/* Set how many times we'll repeat our attempts for sqlite_step */
- if (SQLITE_OK != sqlite3_busy_handler(database, __uam_db_busy, &max_attempts))
+ if (SQLITE_OK != sqlite3_busy_handler(database, __uam_db_busy, &max_attempts)) {
UAM_ERR("Couldn't set busy handler!");
+ return UAM_ERROR_DB_FAILED;
+ }
FUNC_EXIT;
- return UAM_ERROR_NONE;
+ return ret;
}
sqlite3 *__uam_db_recover_database(void)