From ab538c6d284030223386e9f8f360d07e22b297ff Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 10 Aug 2015 13:27:46 +0200 Subject: [PATCH] Avoid error messages "table already exists" in RsDataService::initialise by using "IF NOT EXISTS" --- libretroshare/src/gxs/rsdataservice.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index 340ecfbe9..719b496c8 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -216,7 +216,7 @@ void RsDataService::initialise(){ // create table for msg data - mDb->execSQL("CREATE TABLE " + MSG_TABLE_NAME + "(" + + mDb->execSQL("CREATE TABLE IF NOT EXISTS " + MSG_TABLE_NAME + "(" + KEY_MSG_ID + " TEXT PRIMARY KEY," + KEY_GRP_ID + " TEXT," + KEY_NXS_FLAGS + " INT," + @@ -238,7 +238,7 @@ void RsDataService::initialise(){ KEY_NXS_FILE_LEN + " INT);"); // create table for grp data - mDb->execSQL("CREATE TABLE " + GRP_TABLE_NAME + "(" + + mDb->execSQL("CREATE TABLE IF NOT EXISTS " + GRP_TABLE_NAME + "(" + KEY_GRP_ID + " TEXT PRIMARY KEY," + KEY_TIME_STAMP + " INT," + KEY_NXS_FILE + " TEXT," + @@ -268,7 +268,7 @@ void RsDataService::initialise(){ KEY_GRP_REP_CUTOFF + " INT," + KEY_SIGN_SET + " BLOB);"); - mDb->execSQL("CREATE TRIGGER " + GRP_LAST_POST_UPDATE_TRIGGER + + mDb->execSQL("CREATE TRIGGER IF NOT EXISTS " + GRP_LAST_POST_UPDATE_TRIGGER + " INSERT ON " + MSG_TABLE_NAME + std::string(" BEGIN ") + " UPDATE " + GRP_TABLE_NAME + " SET " + KEY_GRP_LAST_POST + "= new."