X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fglobal.cpp;h=035cdc3dfebb89a864b2169adcdfc47727c1ce86;hb=5c0453c8697cfaa843dd7f799e5404733ee56e13;hp=d241f069f2ec6bb96f4324735ecdceaf74d9255e;hpb=8a0a83a78390f22f99d4487cda2569909dfbc28e;p=fms.git diff --git a/src/global.cpp b/src/global.cpp index d241f06..035cdc3 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -194,6 +194,9 @@ void SetupDB() TrustListTrustComment TEXT\ );"); + db->Execute("CREATE INDEX IF NOT EXISTS idxPeerTrust_IdentityID ON tblPeerTrust (IdentityID);"); + db->Execute("CREATE INDEX IF NOT EXISTS idxPeerTrust_TargetIdentityID ON tblPeerTrust (TargetIdentityID);"); + db->Execute("CREATE TABLE IF NOT EXISTS tblBoard(\ BoardID INTEGER PRIMARY KEY,\ BoardName TEXT UNIQUE,\ @@ -220,6 +223,8 @@ void SetupDB() MessageIndex INTEGER\ );"); + db->Execute("CREATE INDEX IF NOT EXISTS idxMessage_IdentityID ON tblMessage (IdentityID);"); + db->Execute("CREATE TABLE IF NOT EXISTS tblMessageReplyTo(\ MessageID INTEGER,\ ReplyToMessageUUID TEXT,\ @@ -231,6 +236,8 @@ void SetupDB() BoardID INTEGER\ );"); + db->Execute("CREATE INDEX IF NOT EXISTS idxMessageBoard_BoardID ON tblMessageBoard (BoardID);"); + db->Execute("CREATE TABLE IF NOT EXISTS tblMessageListRequests(\ IdentityID INTEGER,\ Day DATE,\ @@ -298,7 +305,7 @@ void SetupDB() GROUP BY tblBoard.BoardID;"); // calculates peer trust - // do the (MessageTrust+1)*LocalTrustListTrust/(MessageTrust+1)/100.0 - so it MessageTrust or TrustListTrust is NULL, the calc will be NULL and it won't be included at all in the average + // do the (MessageTrust+1)*LocalTrustListTrust/(MessageTrust+1)/100.0 - so if MessageTrust or TrustListTrust is NULL, the calc will be NULL and it won't be included at all in the average // need the +1 so that when the values are 0 the result is not 0 db->Execute("DROP VIEW IF EXISTS vwCalculatedPeerTrust;"); db->Execute("CREATE VIEW IF NOT EXISTS vwCalculatedPeerTrust AS \ @@ -396,7 +403,7 @@ void SetupDB() date.SetToGMTime(); // insert SomeDude's public key - db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,LocalTrustListTrust) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"',51);"); + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,LocalTrustListTrust) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"',50);"); // insert Shadow Panther's public key db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@~mimyB1kmH4f7Cgsd2wM2Qv2NxrZHRMM6IY8~7EWRVQ,fxTKkR0TYhgMYb-vEGAv55sMOxCGD2xhE4ZxWHxdPz4,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');"); // insert garfield's public key