#include "account_type.h"
#include "account-server-db.h"
-//typedef sqlite3_stmt* account_stmt;
-
#define EMAIL_SERVICE_CMDLINE "/usr/bin/email-service"
#define EMAIL_APPID "email-setting-efl"
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);
- 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);
- 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);
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);
+ 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);
+ 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)
for (iter = account_list; iter != NULL; iter = g_slist_next(iter)) {
account_s *account = NULL;
account = (account_s*)iter->data;
- _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, account->id, (void*)account);
- _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, account->id, (void*)account);
+ _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, account->id, (void*)account, false);
+ _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, account->id, (void*)account, false);
}
CATCH:
return error_code;
}
-int _account_query_account_by_account_id(int pid, uid_t uid, int account_db_id, account_s *account_record)
+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;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int error_code = _ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
ACCOUNT_RETURN_VAL((account_db_id > 0), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
ACCOUNT_RETURN_VAL(account_record != NULL, {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_DEBUG("starting db operations");
+
+ /* prepare query for account-table */
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ 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);
- ACCOUNT_DEBUG("starting db operations");
+ _INFO("after _account_prepare_query, rc=[%d]", rc);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
hstmt = _account_prepare_query(g_hAccountDB, query);
- rc = _account_db_err_code(g_hAccountDB);
- _INFO("after _account_prepare_query, rc=[%d]", rc);
+ 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;
}
ACCOUNT_DEBUG("before _account_query_step");
+
rc = _account_query_step(hstmt);
+
ACCOUNT_DEBUG("after _account_query_step returned [%d]", rc);
+
ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
while (rc == SQLITE_ROW) {
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);
+ _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);
+ _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;
account_s *testaccount = (account_s*)iter->data;
- _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount);
+ _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount, false);
+ _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount, false);
}
*error_code = _ACCOUNT_ERROR_NONE;
//account = (account_h)iter->data;
account_s* testaccount = (account_s*)iter->data;
- _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount);
+ _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount, false);
+ _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount, false);
}
for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
account_s* testaccount = (account_s*)iter->data;
- _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount);
+ _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount, false);
+ _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount, false);
}
int _account_delete(int pid, uid_t uid, int account_id)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
return ret_transaction;
}
+ /* capability table */
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE account_id = %d", CAPABILITY_TABLE, account_id);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
hstmt = NULL;
+ /* account table */
ACCOUNT_MEMSET(query, 0, sizeof(query));
-
ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
hstmt = _account_prepare_query(g_hAccountDB, query);
/* delete custom data */
ACCOUNT_MEMSET(query, 0, sizeof(query));
-
ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId = %d", ACCOUNT_CUSTOM_TABLE, account_id);
hstmt = _account_prepare_query(g_hAccountDB, query);
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, account_record->id, (void*)account_record);
- _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, account_record->id, (void*)account_record);
+ _account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, account_record->id, (void*)account_record, false);
+ _account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, account_record->id, (void*)account_record, false);
hstmt = NULL;
error_code = _ACCOUNT_ERROR_NONE;
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;
}