update cts_version by delete contact(internal_addressbook) 09/46809/1
authorGukhwan Cho <gh78.cho@samsung.com>
Tue, 18 Aug 2015 01:34:38 +0000 (10:34 +0900)
committerGukhwan Cho <gh78.cho@samsung.com>
Wed, 26 Aug 2015 09:17:39 +0000 (18:17 +0900)
Change-Id: If39a5c23dd6b5222b565a029364ca59c64fcc55d
Signed-off-by: Gukhwan Cho <gh78.cho@samsung.com>
server/db/ctsvc_db_plugin_addressbook_helper.c

index 47e454d..9aa4f2b 100644 (file)
@@ -32,6 +32,7 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
        CTS_FN_CALL;
        char query[CTS_SQL_MIN_LEN] = {0};
        int ret;
+       int version;
 
        ret = ctsvc_begin_trans();
        RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
@@ -46,9 +47,10 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
                return ret;
        }
 
-       snprintf(query, sizeof(query), "UPDATE %s SET deleted=1, person_id=0, "
-                       "changed_ver = ((SELECT ver FROM cts_version) + 1) WHERE addressbook_id = %d",
-                       CTS_TABLE_CONTACTS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/);
+       version = ctsvc_get_next_ver();
+       snprintf(query, sizeof(query),
+                       "UPDATE %s SET deleted = 1, person_id = 0, changed_ver=%d WHERE addressbook_id = %d",
+                       CTS_TABLE_CONTACTS, version, 0 /*CTS_ADDRESSBOOK_INTERNAL*/);
 
        /* DOING JOB */
        do {