Пример #1
0
void CPage::loadPhraseCheck(ConnectionPtr connection)
{
	Trace("loadPhraseCheck()", "", 0);

	std::string strQuery;

	try
	{
		Mutex::Lock lock(m_phraseListLock);

		strQuery = Format(SQL_WTT_PHRASE_WORDS, getPageID());
		if (ResultPtr result = connection->Query(strQuery))
		{
			Trace("RowPtr s:","",result->GetRowCount());

			while (result->Next())
			{
				RowPtr row = result->GetCurrentRow();

				StringIDList::value_type phrase(row->GetFieldString(1), row->GetFieldLong(2));

				Trace("loadPhraseCheck_LT(): pre", phrase.first.c_str(), phrase.second);
				std::transform(phrase.first.begin(), phrase.first.end(), phrase.first.begin(), tolower);
				Trace("loadPhraseCheck_LT(): post", phrase.first.c_str(), phrase.second);
				m_phrase.push_back(phrase);
			}
		}
	}
	catch (const std::exception& e)
	{
		LogError("Exception Caught:", e.what(), 0);
	}
}
Пример #2
0
//---------------------------------------------------------------------
Page* PagedWorldSection::loadOrCreatePage(const Vector3& worldPos)
{
    PageID id = getPageID(worldPos);
    // this will create a Page instance no matter what, even if load fails
    // we force the load attempt to happen immediately (forceSynchronous)
    loadPage(id, true);
    return getPage(id);
}
Пример #3
0
void CPage::loadJavaScriptCheck(ConnectionPtr connection)
{
	Trace("loadJavaScriptCheck()", "",0);

	std::string strQuery;

	// need to change all to lower case
	std::string	lowerCaseBody;

	try
	{
		Mutex::Lock lock(m_javascriptListLock);

		strQuery = Format(SQL_WTT_JAVASCRIPT1);
		if (ResultPtr result = connection->Query(strQuery))
		{
			Trace("RowPtr s:","",result->GetRowCount());

			while(result->Next())
			{
				RowPtr row = result->GetCurrentRow();

				// add to the list
				Trace("loadJavaScriptCheck() - search", row->GetField(1),0);
				Trace("loadJavaScriptCheck() - replace", row->GetField(2),0);
				m_javascriptSearchList.push_back(row->GetFieldString(1));
				m_javascriptReplaceList.push_back(row->GetFieldString(2));
			}
		}

		strQuery = Format(SQL_WTT_JAVASCRIPT2, getPageID());
		if (ResultPtr result = connection->Query(strQuery))
		{
			Trace("RowPtr s:","",result->GetRowCount());

			while(result->Next())
			{
				RowPtr row = result->GetCurrentRow();

				// add to the list
				Trace("loadJavaScriptCheck() - search", row->GetField(1),0);
				Trace("loadJavaScriptCheck() - replace", row->GetField(2),0);
				m_javascriptSearchList.push_back(row->GetFieldString(1));
				m_javascriptReplaceList.push_back(row->GetFieldString(2));
			}
		}
	}
	catch (const std::exception& e)
	{
		LogError("Exception Caught:", e.what(), 0);
	}

	try
	{
		Mutex::Lock lock(m_javascriptExtractListLock);

		strQuery = Format(SQL_WTT_JAVASCRIPT3, getPageID());
		if (ResultPtr result = connection->Query(strQuery))
		{
			Trace("RowPtr s:","",result->GetRowCount());

			while(result->Next())
			{
				RowPtr row = result->GetCurrentRow();

				// add to the list
				Trace("loadJavaScriptCheck() - start", row->GetField(1),0);
				Trace("loadJavaScriptCheck() - end", row->GetField(2),0);
				m_javascriptStartList.push_back(row->GetFieldString(1));
				m_javascriptEndList.push_back(row->GetFieldString(2));
			}
		}
	}
	catch (const std::exception& e)
	{
		LogError("Exception Caught:", e.what(), 0);
	}
}