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
This commit is contained in:
chrisparker126 2013-02-12 21:45:30 +00:00
parent ee62819389
commit 21dd979ba8
2 changed files with 5 additions and 5 deletions

View File

@ -182,7 +182,7 @@ void RsDataService::initialise(){
// create table for msg data // create table for msg data
mDb->execSQL("CREATE TABLE " + MSG_TABLE_NAME + "(" + mDb->execSQL("CREATE TABLE " + MSG_TABLE_NAME + "(" +
KEY_MSG_ID + " TEXT," + KEY_MSG_ID + " TEXT PRIMARY KEY," +
KEY_GRP_ID + " TEXT," + KEY_GRP_ID + " TEXT," +
KEY_NXS_FLAGS + " INT," + KEY_NXS_FLAGS + " INT," +
KEY_ORIG_MSG_ID + " TEXT," + KEY_ORIG_MSG_ID + " TEXT," +
@ -202,7 +202,7 @@ void RsDataService::initialise(){
// create table for grp data // create table for grp data
mDb->execSQL("CREATE TABLE " + GRP_TABLE_NAME + "(" + mDb->execSQL("CREATE TABLE " + GRP_TABLE_NAME + "(" +
KEY_GRP_ID + " TEXT," + KEY_GRP_ID + " TEXT PRIMARY KEY," +
KEY_TIME_STAMP + " INT," + KEY_TIME_STAMP + " INT," +
KEY_NXS_FILE + " TEXT," + KEY_NXS_FILE + " TEXT," +
KEY_NXS_FILE_OFFSET + " INT," + KEY_NXS_FILE_OFFSET + " INT," +
@ -770,7 +770,6 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
} }
msg[grpId] = msgSet; msg[grpId] = msgSet;
msgSet.clear();
if(withMeta) if(withMeta)
{ {
@ -784,6 +783,7 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
metaReqIds[grpId] = msgIds; metaReqIds[grpId] = msgIds;
} }
msgSet.clear();
} }
// tres expensive !? // tres expensive !?

View File

@ -265,14 +265,14 @@ bool RetroDb::sqlInsert(const std::string &table, const std::string& nullColumnH
} }
else if ( ContentValue::INT32_TYPE == type) else if ( ContentValue::INT32_TYPE == type)
{ {
int32_t value; int32_t value = 0;
cv.getAsInt32(key, value); cv.getAsInt32(key, value);
oStrStream << value; oStrStream << value;
qValues += oStrStream.str(); qValues += oStrStream.str();
} }
else if( ContentValue::INT64_TYPE == type) else if( ContentValue::INT64_TYPE == type)
{ {
int64_t value; int64_t value = 0;
cv.getAsInt64(key, value); cv.getAsInt64(key, value);
oStrStream << value; oStrStream << value;
qValues += oStrStream.str(); qValues += oStrStream.str();