Exemplo n.º 1
0
void CVarManager::saveWinUser()
{
	try
	{
		sqlite3x::sqlite3_connection db(m_szCVarDb.c_str());

		{
			sqlite3x::sqlite3_command cmd(db,"DELETE FROM cvarwin where user=?;");
			cmd.bind(1, getWinUser());
			cmd.executenonquery();
		}

		sqlite3x::sqlite3_command cmd(db, "INSERT INTO cvarwin (name, value, user) VALUES (?,?,?);");
		cmd.bind(3, getWinUser());

		sqlite3x::sqlite3_transaction trans(db);
		saveToDb(cmd, CFLAG_WINUSER);
		trans.commit();
	}
	catch (std::exception &e)
	{
		Warning(gcString("Failed to save cvar win user: {0}\n", e.what()));
	}
}
Exemplo n.º 2
0
void CVarManager::loadWinUser(CVar* var)
{
	try
	{
		sqlite3x::sqlite3_connection db(m_szCVarDb.c_str());
		sqlite3x::sqlite3_command cmd(db, "SELECT value FROM cvarwin WHERE user=? AND name=?;");


		cmd.bind(1, getWinUser());
		cmd.bind(2, var->getName());

		std::string value = cmd.executestring();
		var->setValueOveride(value.c_str());
	}
	catch (std::exception &)
	{
	}
}
Exemplo n.º 3
0
void CVarManager::loadWinUser()
{
	m_bWinUserLoaded = true;

	try
	{
		sqlite3x::sqlite3_connection db(m_szCVarDb.c_str());
		sqlite3x::sqlite3_command cmd(db, "SELECT name, value FROM cvarwin WHERE user=?;");

		cmd.bind(1, getWinUser());

		sqlite3x::sqlite3_reader cmdResults = cmd.executereader();
		loadFromDb(cmdResults);
	}
	catch (std::exception &e)
	{
		Warning(gcString("Failed to load cvar win user: {0}\n", e.what()));
	}
}
Exemplo n.º 4
0
void CVarManager::loadWinUser(CVar* var)
{
	loadCVarFromDb(var, "SELECT value FROM cvarwin WHERE name=? AND user=?;", getWinUser());
}