X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fboard.cpp;h=99350f5d7508ab6789766cbfb0d3ca4cc56da610;hp=aee9339f4054bf6f4f20fdf2925e8247aac0b60c;hb=3dc3ac3cfe10b7196a7977e9c041c29fa141c35e;hpb=befd91205eff729a182f66de15374a577a8718f7 diff --git a/src/board.cpp b/src/board.cpp index aee9339..99350f5 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -97,8 +97,9 @@ const bool Board::Load(const long boardid) } } -const bool Board::Load(const std::string &boardname) +const bool Board::Load(const std::string &boardname) // same as loading form boardid - but using name { + /* SQLite3DB::Statement st=m_db->Prepare("SELECT BoardID FROM tblBoard WHERE BoardName=?;"); st.Bind(0,boardname); st.Step(); @@ -112,6 +113,62 @@ const bool Board::Load(const std::string &boardname) { return false; } + */ + + // clear current values + m_boardid=-1; + m_boardname=""; + m_boarddescription=""; + m_datecreated.Set(1970,1,1); + m_lowmessageid=0; + m_highmessageid=0; + m_messagecount=0; + int tempint=-1; + + SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, tblBoard.BoardID FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardName=?;"); + st.Bind(0,boardname); + st.Step(); + + if(st.RowReturned()) + { + int tempint; + std::string tempstr; + std::vector dateparts; + + st.ResultText(0,m_boardname); + st.ResultText(1,m_boarddescription); + st.ResultText(2,tempstr); + st.ResultInt(7,tempint); // boardid + m_boardid=tempint; + + SetDateFromString(tempstr); + + tempint=0; + st.ResultInt(3,tempint); + m_highmessageid=tempint; + tempint=0; + st.ResultInt(4,tempint); + m_lowmessageid=tempint; + tempint=0; + st.ResultInt(5,tempint); + m_messagecount=tempint; + st.ResultText(6,tempstr); + if(tempstr=="true") + { + m_savereceivedmessages=true; + } + else + { + m_savereceivedmessages=false; + } + + return true; + } + else + { + return false; + } + } void Board::SetDateFromString(const std::string &datestring)