From 21dd979ba87f24405a11bcee880b272e8970cddf Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Tue, 12 Feb 2013 21:45:30 +0000 Subject: [PATCH] Fixed for duplicate messages ending up in db, set msgId and grpId as primary keys in message and group table respectively in db when created Please delete your TESTNET folders so a keyed db is created few additional fixes - did create id list for meta request in dataservice - possible fix for uninitialised values for rsdb git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6123 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/rsdataservice.cc | 6 +++--- libretroshare/src/util/retrodb.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index 9c60ef77f..47ff70b10 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -182,7 +182,7 @@ void RsDataService::initialise(){ // create table for msg data mDb->execSQL("CREATE TABLE " + MSG_TABLE_NAME + "(" + - KEY_MSG_ID + " TEXT," + + KEY_MSG_ID + " TEXT PRIMARY KEY," + KEY_GRP_ID + " TEXT," + KEY_NXS_FLAGS + " INT," + KEY_ORIG_MSG_ID + " TEXT," + @@ -202,7 +202,7 @@ void RsDataService::initialise(){ // create table for grp data mDb->execSQL("CREATE TABLE " + GRP_TABLE_NAME + "(" + - KEY_GRP_ID + " TEXT," + + KEY_GRP_ID + " TEXT PRIMARY KEY," + KEY_TIME_STAMP + " INT," + KEY_NXS_FILE + " TEXT," + KEY_NXS_FILE_OFFSET + " INT," + @@ -770,7 +770,6 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b } msg[grpId] = msgSet; - msgSet.clear(); if(withMeta) { @@ -784,6 +783,7 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b metaReqIds[grpId] = msgIds; } + msgSet.clear(); } // tres expensive !? diff --git a/libretroshare/src/util/retrodb.cc b/libretroshare/src/util/retrodb.cc index c7402a8a3..a68e8b508 100644 --- a/libretroshare/src/util/retrodb.cc +++ b/libretroshare/src/util/retrodb.cc @@ -265,14 +265,14 @@ bool RetroDb::sqlInsert(const std::string &table, const std::string& nullColumnH } else if ( ContentValue::INT32_TYPE == type) { - int32_t value; + int32_t value = 0; cv.getAsInt32(key, value); oStrStream << value; qValues += oStrStream.str(); } else if( ContentValue::INT64_TYPE == type) { - int64_t value; + int64_t value = 0; cv.getAsInt64(key, value); oStrStream << value; qValues += oStrStream.str();