summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDewal Agarwal <d1.agarwal@samsung.com>2021-06-04 18:23:59 +0530
committerDewal Agarwal <d1.agarwal@samsung.com>2021-06-09 17:37:05 +0530
commit666e7ea3c51a3244833eda143a5ae48cc400156e (patch)
tree186c094859171f53a9f2ad3cae6fcbda8189f15b
parent6a1d5bfd74217fbd8b2bbefeb3a20739e3fa8ac0 (diff)
downloadsync-manager-tizen_6.5.tar.gz
sync-manager-tizen_6.5.tar.bz2
sync-manager-tizen_6.5.zip
Change-Id: Ie256714723c29d4866ca488c5638be278a2652d1
-rw-r--r--src/sync-service/SyncManager_RepositoryEngine.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/sync-service/SyncManager_RepositoryEngine.cpp b/src/sync-service/SyncManager_RepositoryEngine.cpp
index b6cb5bc..525556d 100644
--- a/src/sync-service/SyncManager_RepositoryEngine.cpp
+++ b/src/sync-service/SyncManager_RepositoryEngine.cpp
@@ -1105,15 +1105,17 @@ RepositoryEngine::InsertSyncAdapterToDB(const char *SvcAppId, const char *PkgNam
ret = sqlite3_step(stmt);
if (ret == SQLITE_DONE) {
- sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
if (!PkgName || strlen(PkgName) <= 0) {
string SvcPkgId = SyncManager::GetInstance()->GetPkgIdByAppId(SvcAppId);
- insert_query = sqlite3_mprintf("INSERT INTO %Q (SvcAppId, PkgName, UserId, DoA, AppStatus, ProcId) VALUES (%Q, %Q, %Q, %Q, %Q, %Q)",
- SYNC_ADAPTER_TABLE, SvcAppId, SvcPkgId.c_str(),
- uid, DoA, AppStatus ? AppStatus : "enabled", pid);
+ insert_query = sqlite3_mprintf("INSERT INTO %Q (SvcAppId, PkgName, UserId, DoA, AppStatus, ProcId) "
+ "VALUES (%Q, %Q, %Q, %Q, %Q, %Q)",
+ SYNC_ADAPTER_TABLE, SvcAppId, SvcPkgId.c_str(),
+ uid, DoA, AppStatus ? AppStatus : "enabled", pid);
} else {
- insert_query = sqlite3_mprintf("INSERT INTO %Q (SvcAppId, PkgName, UserId, DoA, AppStatus, ProcId) VALUES (%Q, %Q, %Q, %Q, %Q, %Q)",
- SYNC_ADAPTER_TABLE, SvcAppId, PkgName, uid, DoA, AppStatus ? AppStatus : "enabled", pid);
+ insert_query = sqlite3_mprintf("INSERT INTO %Q (SvcAppId, PkgName, UserId, DoA, AppStatus, ProcId) "
+ "VALUES (%Q, %Q, %Q, %Q, %Q, %Q)",
+ SYNC_ADAPTER_TABLE, SvcAppId, PkgName, uid, DoA, AppStatus ? AppStatus : "enabled", pid);
}
ret = sqlite3_prepare_v2(db, insert_query, strlen(insert_query), &stmt, NULL);
@@ -1753,12 +1755,12 @@ RepositoryEngine::InsertSyncJobToDB(const char *SvcAppId, const char *PkgName, i
ret = sqlite3_step(stmt);
if (ret == SQLITE_DONE) {
- sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
insert_query = sqlite3_mprintf("INSERT INTO %Q (SvcAppId, PkgName, UserId, AppStatus, SyncJobId, SyncType, "
- "AccountId, JobName, Interval, Expedit, NoRetry, UserDataKey, UserDataValue) "
- "VALUES (%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- SYNC_JOB_TABLE, SvcAppId, PkgName, uid, AppStatus, jobId, SyncType,
- accId, JobName, interval, expedit, noRetry, UserKey, UserValue);
+ "AccountId, JobName, Interval, Expedit, NoRetry, UserDataKey, UserDataValue) "
+ "VALUES (%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q)",
+ SYNC_JOB_TABLE, SvcAppId, PkgName, uid, AppStatus, jobId, SyncType,
+ accId, JobName, interval, expedit, noRetry, UserKey, UserValue);
ret = sqlite3_prepare_v2(db, insert_query, strlen(insert_query), &stmt, NULL);
if (ret != SQLITE_OK) {
@@ -1917,10 +1919,10 @@ RepositoryEngine::UpdateSyncJobToDB(const char *SvcAppId, int UserId, const char
char *update_query = NULL;
string SvcPkgId = SyncManager::GetInstance()->GetPkgIdByAppId(SvcAppId);
update_query = sqlite3_mprintf("UPDATE %Q SET AppStatus=%Q, SyncJobId=%Q, AccountId=%Q, Interval=%Q, "
- "Expedit=%Q, NoRetry=%Q, UserDataKey=%Q, UserDataValue=%Q "
- "WHERE SvcAppId=%Q AND PkgName=%Q AND UserId=%Q AND SyncType=%Q AND JobName=%Q",
- SYNC_JOB_TABLE, AppStatus, jobId, accId, interval, expedit, noRetry, UserKey, UserValue,
- SvcAppId, SvcPkgId.c_str(), uid, SyncType, JobName);
+ "Expedit=%Q, NoRetry=%Q, UserDataKey=%Q, UserDataValue=%Q "
+ "WHERE SvcAppId=%Q AND PkgName=%Q AND UserId=%Q AND SyncType=%Q AND JobName=%Q",
+ SYNC_JOB_TABLE, AppStatus, jobId, accId, interval, expedit, noRetry, UserKey, UserValue,
+ SvcAppId, SvcPkgId.c_str(), uid, SyncType, JobName);
sqlite3_stmt *stmt = NULL;
int ret = SQLITE_OK;