static sqlite3* g_hAccountDB2 = NULL;
static sqlite3* g_hAccountGlobalDB = NULL;
static sqlite3* g_hAccountGlobalDB2 = NULL;
-pthread_mutex_t account_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t account_global_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t account_mutex = PTHREAD_MUTEX_INITIALIZER;
//static char *_account_dup_text(const char *text_data);
static int _account_insert_custom(account_s *account, int account_id);
ACCOUNT_GET_GLOBAL_DB_PATH(account_db_path, sizeof(account_db_path));
if (g_hAccountGlobalDB) {
- _ERR("Account database is using in another app. %x", g_hAccountDB);
+ _ERR("Account database is using in another app");
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
ACCOUNT_GET_USER_DB_PATH(account_db_path, sizeof(account_db_path), uid);
if (g_hAccountDB) {
- _ERR("Account database is using in another app. %x", g_hAccountDB);
+ _ERR("Account database is using in another app");
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
if (rc != SQLITE_DONE) {
ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ if (_account_query_finalize(hstmt) != _ACCOUNT_ERROR_NONE)
+ _ERR("finalize error - account_query_step() failed");
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_finalize(hstmt);
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ if (_account_query_finalize(hstmt) != _ACCOUNT_ERROR_NONE)
+ _ERR("finalize error - account_query_step() failed");
return _ACCOUNT_ERROR_DB_FAILED;
}
return TRUE;
}
-
-static int _account_compare_old_record_by_user_name(account_s *new_account, const char* user_name, const char* package_name)
+static void _account_compare_new_and_old_account_properties(account_s** new_account, account_s* old_account)
{
- int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- account_s *old_account = NULL;
-
- ACCOUNT_RETURN_VAL((new_account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
- ACCOUNT_RETURN_VAL((user_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
- ACCOUNT_RETURN_VAL((package_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- old_account = (account_s*)calloc(1, sizeof(account_s));
- if (!old_account) {
- ACCOUNT_FATAL("Memory alloc fail\n");
- return _ACCOUNT_ERROR_OUT_OF_MEMORY;
- }
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = '%s' and package_name='%s'", ACCOUNT_TABLE, user_name, package_name);
- hstmt = _account_prepare_query(g_hAccountDB, query);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- while (rc == SQLITE_ROW) {
- _account_convert_column_to_account(hstmt, old_account);
- rc = _account_query_step(hstmt);
+ if ((*new_account) == NULL || old_account == NULL) {
+ _ERR("invalid input params");
+ return;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- // get capability
- error_code = _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, old_account->id, (void*)old_account, false);
- ACCOUNT_CATCH_ERROR((error_code == _ACCOUNT_ERROR_NONE), {}, error_code, ("account_query_capability_by_account_id error"));
-
- // get custom text
- error_code = _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, old_account->id, (void*)old_account, false);
- ACCOUNT_CATCH_ERROR((error_code == _ACCOUNT_ERROR_NONE), {}, error_code, ("_account_query_custom_by_account_id error"));
-
// compare
- new_account->id = old_account->id;
+ (*new_account)->id = old_account->id;
//user name
- if (!new_account->user_name) {
+ if (!(*new_account)->user_name) {
if (old_account->user_name)
- new_account->user_name = _account_dup_text(old_account->user_name);
+ (*new_account)->user_name = _account_dup_text(old_account->user_name);
}
// display name
- if (!new_account->display_name) {
+ if (!(*new_account)->display_name) {
if (old_account->display_name)
- new_account->display_name = _account_dup_text(old_account->display_name);
+ (*new_account)->display_name = _account_dup_text(old_account->display_name);
}
// email address
- if (!new_account->email_address) {
+ if (!(*new_account)->email_address) {
if (old_account->email_address)
- new_account->email_address = _account_dup_text(old_account->email_address);
+ (*new_account)->email_address = _account_dup_text(old_account->email_address);
}
// domain name
- if (!new_account->domain_name) {
+ if (!(*new_account)->domain_name) {
if (old_account->domain_name)
- new_account->domain_name = _account_dup_text(old_account->domain_name);
+ (*new_account)->domain_name = _account_dup_text(old_account->domain_name);
}
// icon path
- if (!new_account->icon_path) {
+ if (!(*new_account)->icon_path) {
if (old_account->icon_path)
- new_account->icon_path = _account_dup_text(old_account->icon_path);
+ (*new_account)->icon_path = _account_dup_text(old_account->icon_path);
}
// source
- if (!new_account->source) {
+ if (!(*new_account)->source) {
if (old_account->source)
- new_account->source = _account_dup_text(old_account->source);
+ (*new_account)->source = _account_dup_text(old_account->source);
}
- _ACCOUNT_FREE(new_account->package_name);
- new_account->package_name = _account_dup_text(old_account->package_name);
+ _ACCOUNT_FREE((*new_account)->package_name);
+ (*new_account)->package_name = _account_dup_text(old_account->package_name);
// access token
- if (!new_account->access_token) {
+ if (!(*new_account)->access_token) {
if (old_account->access_token)
- new_account->access_token = _account_dup_text(old_account->access_token);
+ (*new_account)->access_token = _account_dup_text(old_account->access_token);
}
// auth type
- if (new_account->auth_type == _ACCOUNT_AUTH_TYPE_INVALID)
- new_account->auth_type = old_account->auth_type;
+ if ((*new_account)->auth_type == _ACCOUNT_AUTH_TYPE_INVALID)
+ (*new_account)->auth_type = old_account->auth_type;
//secret
- if (new_account->secret == _ACCOUNT_SECRECY_INVALID)
- new_account->secret = old_account->secret;
+ if ((*new_account)->secret == _ACCOUNT_SECRECY_INVALID)
+ (*new_account)->secret = old_account->secret;
// sync support
- if (new_account->sync_support == _ACCOUNT_SYNC_INVALID)
- new_account->sync_support = old_account->sync_support;
+ if ((*new_account)->sync_support == _ACCOUNT_SYNC_INVALID)
+ (*new_account)->sync_support = old_account->sync_support;
// TODO user text
int i;
for (i = 0; i < USER_TXT_CNT; i++) {
- if (!new_account->user_data_txt[i]) {
+ if (!(*new_account)->user_data_txt[i]) {
if (old_account->user_data_txt[i])
- new_account->user_data_txt[i] = _account_dup_text(old_account->user_data_txt[i]);
+ (*new_account)->user_data_txt[i] = _account_dup_text(old_account->user_data_txt[i]);
}
}
// TODO user int
for (i = 0; i < USER_INT_CNT; i++) {
- if (new_account->user_data_int[i] == 0)
- new_account->user_data_int[i] = old_account->user_data_int[i];
+ if ((*new_account)->user_data_int[i] == 0)
+ (*new_account)->user_data_int[i] = old_account->user_data_int[i];
}
+ return;
+}
+
+
+static int _account_compare_old_record_by_user_name(account_s *new_account, const char* user_name, const char* package_name)
+{
+ int error_code = _ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ account_s *old_account = NULL;
+
+ ACCOUNT_RETURN_VAL((new_account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
+ ACCOUNT_RETURN_VAL((user_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ old_account = (account_s*)calloc(1, sizeof(account_s));
+ if (!old_account) {
+ ACCOUNT_FATAL("Memory alloc fail\n");
+ return _ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = '%s' and package_name='%s'", ACCOUNT_TABLE, user_name, package_name);
+ hstmt = _account_prepare_query(g_hAccountDB, query);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ while (rc == SQLITE_ROW) {
+ _account_convert_column_to_account(hstmt, old_account);
+ rc = _account_query_step(hstmt);
+ }
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_CATCH_ERROR((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ // get capability
+ error_code = _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, old_account->id, (void*)old_account, false);
+ ACCOUNT_CATCH_ERROR((error_code == _ACCOUNT_ERROR_NONE), {}, error_code, ("account_query_capability_by_account_id error"));
+
+ // get custom text
+ error_code = _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, old_account->id, (void*)old_account, false);
+ ACCOUNT_CATCH_ERROR((error_code == _ACCOUNT_ERROR_NONE), {}, error_code, ("_account_query_custom_by_account_id error"));
+
+ _account_compare_new_and_old_account_properties(&new_account, old_account);
+
CATCH:
if (old_account)
_account_free_account_with_items(old_account);
error_code = _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, old_account->id, (void*)old_account, false);
ACCOUNT_CATCH_ERROR((error_code == _ACCOUNT_ERROR_NONE), {}, error_code, ("_account_query_custom_by_account_id error"));
- // compare
-
- new_account->id = old_account->id;
-
- //user name
- if (!new_account->user_name) {
- if (old_account->user_name)
- new_account->user_name = _account_dup_text(old_account->user_name);
- }
-
- // display name
- if (!new_account->display_name) {
- if (old_account->display_name)
- new_account->display_name = _account_dup_text(old_account->display_name);
- }
-
- // email address
- if (!new_account->email_address) {
- if (old_account->email_address)
- new_account->email_address = _account_dup_text(old_account->email_address);
- }
-
- // domain name
- if (!new_account->domain_name) {
- if (old_account->domain_name)
- new_account->domain_name = _account_dup_text(old_account->domain_name);
- }
-
- // icon path
- if (!new_account->icon_path) {
- if (old_account->icon_path)
- new_account->icon_path = _account_dup_text(old_account->icon_path);
- }
-
- // source
- if (!new_account->source) {
- if (old_account->source)
- new_account->source = _account_dup_text(old_account->source);
- }
-
- _ACCOUNT_FREE(new_account->package_name);
- new_account->package_name = _account_dup_text(old_account->package_name);
-
- // access token
- if (!new_account->access_token) {
- if (old_account->access_token)
- new_account->access_token = _account_dup_text(old_account->access_token);
- }
-
- // user text
- int i;
- for (i = 0; i < USER_TXT_CNT; i++) {
- if (!new_account->user_data_txt[i]) {
- if (old_account->user_data_txt[i])
- new_account->user_data_txt[i] = _account_dup_text(old_account->user_data_txt[i]);
- }
- }
-
- // auth type
- if (new_account->auth_type == _ACCOUNT_AUTH_TYPE_INVALID)
- new_account->auth_type = old_account->auth_type;
-
- // secret
- if (new_account->secret == _ACCOUNT_SECRECY_INVALID)
- new_account->secret = old_account->secret;
-
- // sync support
- if (new_account->sync_support == _ACCOUNT_SYNC_INVALID)
- new_account->sync_support = old_account->sync_support;
-
- // user int
- for (i = 0; i < USER_INT_CNT; i++) {
- if (new_account->user_data_int[i] == 0)
- new_account->user_data_int[i] = old_account->user_data_int[i];
- }
+ _account_compare_new_and_old_account_properties(&new_account, old_account);
CATCH:
if (old_account)
return error_code;
}
-int account_server_empty_deleted_account_info_tables(const char* del_account_table, const char* del_capability_table,
- const char* del_account_custom_table)
-{
- _INFO("account_server_empty_deleted_account_info_tables start");
-
- account_stmt hstmt = NULL;
- int error_code = _ACCOUNT_ERROR_NONE;
- int rc = 0, record_count = 0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
-
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- rc = _account_begin_transaction(g_hAccountDB);
- _INFO("after _account_begin_trasaction");
-
- if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
- ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (rc == _ACCOUNT_ERROR_DATABASE_BUSY) {
- ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (rc != _ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", rc);
- return rc;
- }
-
- /*del_account_table - check record count*/
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s", del_account_table);
-
- record_count = _account_get_record_count(g_hAccountDB, query);
- if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
- ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _INFO("item count val - [%d] table - [%s]", record_count, del_account_table);
-
- if (record_count > 0) {
- /*clear deleted account table*/
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s", del_account_table);
-
- _INFO("clearing deleted-account-table - query[%s]", query);
-
- hstmt = _account_prepare_query(g_hAccountDB, query);
- if ((_account_db_err_code(g_hAccountDB) == SQLITE_PERM)) {
- _account_end_transaction(g_hAccountDB, false);
- ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (hstmt == NULL) {
- _ERR("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg(g_hAccountDB));
- error_code = _ACCOUNT_ERROR_DB_FAILED;
- goto END;
- }
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- _ERR("The record isn't found");
- error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
- goto END;
- }
-
- rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE) {
- _ERR("finalize error");
- error_code = rc;
- goto END;
- }
-
- record_count = 0;
- }
-
- /*del_capability_table - check record count*/
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s", del_capability_table);
-
- record_count = _account_get_record_count(g_hAccountDB, query);
- if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
- ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _INFO("item count val - [%d] table - [%s]", record_count, del_capability_table);
-
- if (record_count > 0) {
- /*clear deleted capability table*/
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s", del_capability_table);
-
- _INFO("clearing deleted-capability-table - query[%s]", query);
-
- hstmt = _account_prepare_query(g_hAccountDB, query);
- if (hstmt == NULL) {
- _ERR("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg(g_hAccountDB));
- error_code = _ACCOUNT_ERROR_DB_FAILED;
- goto END;
- }
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- _ERR("The record isn't found");
- error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
- goto END;
- }
-
- rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE) {
- _ERR("finalize error");
- error_code = rc;
- goto END;
- }
-
- record_count = 0;
- }
-
- /*del_account_custom_table - check record count*/
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s", del_account_custom_table);
-
- record_count = _account_get_record_count(g_hAccountDB, query);
- if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
- ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _INFO("item count val - [%d] table - [%s]", record_count, del_account_custom_table);
-
- if (record_count > 0) {
- /*clear deleted account_custom table*/
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s", del_account_custom_table);
-
- _INFO("clearing deleted-account-custom-table - query[%s]", query);
-
- hstmt = _account_prepare_query(g_hAccountDB, query);
- if (hstmt == NULL) {
- _ERR("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg(g_hAccountDB));
- error_code = _ACCOUNT_ERROR_DB_FAILED;
- goto END;
- }
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- _ERR("The record isn't found");
- error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
- goto END;
- }
-
- rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE) {
- _ERR("finalize error");
- error_code = rc;
- goto END;
- }
- }
-
- rc = _account_end_transaction(g_hAccountDB, true);
- if (rc != _ACCOUNT_ERROR_NONE)
- _ERR("clear deleted account tables - fail [%d]", rc);
-
- hstmt = NULL;
- _INFO("account_server_empty_deleted_account_info_tables end");
-END:
- return error_code;
-}
-
-int _account_query_account_by_account_id(int pid, uid_t uid, int account_db_id, account_s *account_record, bool *IsDeletedAccount)
+int _account_query_account_by_account_id(int pid, uid_t uid, int account_db_id, account_s *account_record, bool query_del_acc)
{
- _INFO("_account_query_account_by_account_id() start, account_db_id=[%d]", account_db_id);
+ _INFO("_account_query_account_by_account_id() start, account_db_id=[%d], query_del_acc=[%d]", account_db_id, query_del_acc);
int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
/* prepare query for account-table */
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
+ if (!query_del_acc)
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
+ else
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", DELETED_ACCOUNT_TABLE, account_db_id);
_INFO("after _account_prepare_query, rc=[%d]", rc);
ACCOUNT_DEBUG("after _account_query_step returned [%d]", rc);
- /*querying information from deleted_account_table*/
- if (rc != SQLITE_ROW) {
-
- /*free previous hstmt*/
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- ACCOUNT_DEBUG("checking account info in deleted_account_table");
-
- /* query from deleted-account-info table */
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", DELETED_ACCOUNT_TABLE, account_db_id);
-
- hstmt = _account_prepare_query(g_hAccountDB, query);
-
- rc = _account_db_err_code(g_hAccountDB);
- if (rc == SQLITE_PERM) {
- ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- ACCOUNT_DEBUG("getting account info from deleted_account_table");
- *IsDeletedAccount = true;
- }
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
while (rc == SQLITE_ROW) {
ACCOUNT_DEBUG("before _account_convert_column_to_account");
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
ACCOUNT_DEBUG("before _account_query_capability_by_account_id");
- _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, account_record->id, (void*)account_record, *IsDeletedAccount);
+ _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, account_record->id, (void*)account_record, query_del_acc);
ACCOUNT_DEBUG("after _account_query_capability_by_account_id");
ACCOUNT_DEBUG("before _account_query_custom_by_account_id");
- _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, account_record->id, (void*)account_record, *IsDeletedAccount);
+ _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, account_record->id, (void*)account_record, query_del_acc);
ACCOUNT_DEBUG("after _account_query_custom_by_account_id");
hstmt = NULL;
return _ACCOUNT_ERROR_NONE;
}
- ACCOUNT_DEBUG("app id", app_id);
+ ACCOUNT_DEBUG("app id[%s]", app_id);
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
if (rc != SQLITE_DONE) {
ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
+ if (_account_query_finalize(hstmt) != _ACCOUNT_ERROR_NONE)
+ _ERR("finalize error - account_query_step() failed");
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_finalize(hstmt);
if (rc != SQLITE_DONE) {
ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
+ if (_account_query_finalize(hstmt) != _ACCOUNT_ERROR_NONE)
+ _ERR("finalize error - account_query_step() failed");
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_finalize(hstmt);
rc = _account_query_finalize(hstmt);
if (rc != _ACCOUNT_ERROR_NONE) {
_account_type_gslist_account_type_free(account_type_list);
- ACCOUNT_ERROR("finalize error(%s)", rc);
+ ACCOUNT_ERROR("finalize error(%d)", rc);
error_code = rc;
goto CATCH;
}
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
if (rc != _ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("finalize error(%s)", rc);
+ ACCOUNT_ERROR("finalize error(%d)", rc);
return rc;
}
hstmt = NULL;
rc = _account_query_finalize(hstmt);
if (rc != _ACCOUNT_ERROR_NONE) {
_account_type_gslist_account_type_free(account_type_list);
- ACCOUNT_ERROR("finalize error(%s)", rc);
+ ACCOUNT_ERROR("finalize error(%d)", rc);
*error_code = rc;
goto CATCH;
}
rc = _account_get_record_count(g_hAccountDB, query);
if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
- ACCOUNT_ERROR("Access failed(%d, %s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
if (rc == SQLITE_BUSY) {
ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ if (_account_query_finalize(hstmt) != _ACCOUNT_ERROR_NONE)
+ _ERR("finalize error - account_query_step() failed");
return _ACCOUNT_ERROR_DATABASE_BUSY;
} else if (rc != SQLITE_DONE) {
ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ if (_account_query_finalize(hstmt) != _ACCOUNT_ERROR_NONE)
+ _ERR("finalize error - account_query_step() failed");
return _ACCOUNT_ERROR_DB_FAILED;
}