X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fthreadbuilder.cpp;fp=src%2Fthreadbuilder.cpp;h=175a34a3d44e5491e1f40379b7bed3db0bebad66;hb=f2545574af789b63fc655decfe31a3d9f1b30504;hp=521cccc5ae2c951e8b0ea252a501d33f7b8a9ebb;hpb=221236a4d3aac4144529d418ce368db5c98facb0;p=fms.git diff --git a/src/threadbuilder.cpp b/src/threadbuilder.cpp index 521cccc..175a34a 100644 --- a/src/threadbuilder.cpp +++ b/src/threadbuilder.cpp @@ -62,10 +62,17 @@ const bool ThreadBuilder::Build(const long messageid, const long boardid, const st.Bind(0,threadid); st.Step(); + SQLite3DB::Statement deleteotherst=m_db->Prepare("DELETE FROM tblThread WHERE ThreadID IN (SELECT tblThread.ThreadID FROM tblThreadPost INNER JOIN tblThread ON tblThreadPost.ThreadID=tblThread.ThreadID WHERE tblThread.BoardID=? AND tblThreadPost.MessageID=?);"); + count=0; st=m_db->Prepare("INSERT INTO tblThreadPost(ThreadID,MessageID,PostOrder) VALUES(?,?,?);"); for(std::vector::const_iterator i=m_threadmessages.begin(); i!=m_threadmessages.end(); i++, count++) { + deleteotherst.Bind(0,boardid); + deleteotherst.Bind(1,(*i).m_messageid); + deleteotherst.Step(); + deleteotherst.Reset(); + st.Bind(0,threadid); st.Bind(1,(*i).m_messageid); st.Bind(2,count);