예제 #1
0
///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::ProcessQuery
//
//
//
///////////////////////////////////////////////////////////////
void CDatabaseJobQueueImpl::ProcessQuery ( CDbJobData* pJobData )
{
    // CDatabaseConnection* from handle
    CDatabaseConnection* pConnection = GetConnectionFromHandle ( pJobData->command.connectionHandle );
    if ( !pConnection )
    {
        pJobData->result.status = EJobResult::FAIL;
        pJobData->result.strReason = "Invalid connection";
        return;
    }

    // And query
    if ( !pConnection->Query ( pJobData->command.strData, pJobData->result.registryResult ) )
    {
        pJobData->result.status = EJobResult::FAIL;
        pJobData->result.strReason = pConnection->GetLastErrorMessage ();
        pJobData->result.uiErrorCode = pConnection->GetLastErrorCode ();
        pJobData->result.bErrorSuppressed = MapContains ( pConnection->m_SuppressedErrorCodes, pConnection->GetLastErrorCode () );
    }
    else
    {
        pJobData->result.status = EJobResult::SUCCESS;
    }

    // And log if required
    LogResult ( pJobData );
}
예제 #2
0
s64 CProcessor::RetrieveCount(CDatabaseConnection& db, std::string key)
{
	auto res = db.Query(StrFormat(
		"SELECT `count` FROM `osu_counts` WHERE `name`='{0}'", key));

	while(res.NextRow())
	{
		if(!res.IsNull(0))
		{
			return res.S64(0);
		}
	}

	return -1;
}