__int64 PersistentAccount::GetMessageBoxSize(__int64 iAccountID) { SQLCommand selectCommand("select sum(messagesize) as mailboxsize from hm_messages where messageaccountid = @ACCOUNTID"); selectCommand.AddParameter("@ACCOUNTID", iAccountID); boost::shared_ptr<DALRecordset> pRS = Application::Instance()->GetDBManager()->OpenRecordset(selectCommand); if (!pRS) return false; // Different data types on MySQL and MSSQL... __int64 iSize = 0; switch (IniFileSettings::Instance()->GetDatabaseType()) { case DatabaseSettings::TypeMYSQLServer: iSize = (__int64) pRS->GetDoubleValue("mailboxsize");; break; case DatabaseSettings::TypeMSSQLServer: case DatabaseSettings::TypeMSSQLCompactEdition: iSize = pRS->GetInt64Value("mailboxsize");; break; case DatabaseSettings::TypePGServer: iSize = (__int64) pRS->GetDoubleValue("mailboxsize"); break; case DatabaseSettings::TypeUnknown: assert(0); } return iSize; }
void PersistentRule::DeleteByAccountID(__int64 iAccountID) { SQLCommand selectCommand("select * from hm_rules where ruleaccountid = @ACCOUNTID"); selectCommand.AddParameter("@ACCOUNTID", iAccountID); shared_ptr<DALRecordset> pRS = Application::Instance()->GetDBManager()->OpenRecordset(selectCommand); if (!pRS) return ; bool bRetVal = false; while (!pRS->IsEOF()) { // Create and read the fetch account. shared_ptr<Rule> oRule = shared_ptr<Rule>(new Rule); if (ReadObject(oRule, pRS)) { // Delete this fetch account and all the // UID's connected to it. DeleteObject(oRule); } pRS->MoveNext(); } // All the fetch accounts have been deleted. }
void AsiMS2000::interpretCommand(char commandBuffer[]) { String c = String(commandBuffer); int s = c.indexOf(' '); clearCommandBuffer(commandBuffer); String base; if(s > 0) { base = c.substring(0,s); _args = c.substring(s); #if ARDUINO>=100//toUppercase modifies string in place in 1.0 _args.toUpperCase(); #else _args = _args.toUpperCase(); #endif } else { base = c; } _isQuery = isQueryCommand(c); isAxisInCommand(); int commandNum = getCommandNum(base); if(commandNum > -1) { selectCommand(commandNum); } }
bool PersistentDistributionList::ReadObject(std::shared_ptr<DistributionList> pDistList, __int64 iID) { SQLCommand selectCommand("select * from hm_distributionlists where distributionlistid = @LISTID"); selectCommand.AddParameter("@LISTID", iID); return ReadObject(pDistList, selectCommand); }
String ServerStatus::GetUnsortedMessageStatus() const { // messagetype 3 added for ETRN on GUI Delivery Queue SQLCommand command("select messageid, messagecurnooftries, messagecreatetime, messagefrom, messagenexttrytime, messagefilename, messagelocked from hm_messages " " where messagetype = 1 OR messagetype = 3 order by messageid asc"); shared_ptr<DALRecordset> pRS = Application::Instance()->GetDBManager()->OpenRecordset(command); if (!pRS) return ""; String sRetVal; String sCreateTime, sFrom, sTo, sNextTryTime, sFileName, sLine; __int64 lMessageID; int lNoOfTries; bool bLocked; String dataDirectory = IniFileSettings::Instance()->GetDataDirectory(); while (!pRS->IsEOF()) { lMessageID = pRS->GetInt64Value("messageid"); lNoOfTries = pRS->GetLongValue("messagecurnooftries"); sCreateTime = pRS->GetStringValue("messagecreatetime"); sFrom = pRS->GetStringValue("messagefrom"); sNextTryTime = pRS->GetStringValue("messagenexttrytime"); sFileName = pRS->GetStringValue("messagefilename"); bLocked = pRS->GetLongValue("messagelocked") == 1; sTo = ""; // reset between every recipient // Construct a full path to the file if it's partial. if (PersistentMessage::IsPartialPath(sFileName)) sFileName = FileUtilities::Combine(dataDirectory, sFileName); SQLCommand selectCommand("select recipientaddress from hm_messagerecipients where recipientmessageid = @MESSAGEID"); selectCommand.AddParameter("@MESSAGEID", lMessageID); shared_ptr<DALRecordset> pRecipientsRS = Application::Instance()->GetDBManager()->OpenRecordset(selectCommand); if (!pRecipientsRS) return ""; while (!pRecipientsRS->IsEOF()) { if (!sTo.IsEmpty()) sTo += ","; sTo += pRecipientsRS->GetStringValue("recipientaddress"); pRecipientsRS->MoveNext(); } sLine.Format(_T("%I64d\t%s\t%s\t%s\t%s\t%s\t%d\t%d"), lMessageID, sCreateTime, sFrom, sTo, sNextTryTime, sFileName, bLocked, lNoOfTries); if (!sRetVal.IsEmpty()) sRetVal += "\r\n"; sRetVal += sLine; pRS->MoveNext(); } return sRetVal; }