extensions/clientprefs/query.h
author Matt Woodrow <pred@alliedmods.net>
Mon May 12 08:06:47 2008 +0000 (2008-05-12)
changeset 2048 2454ff4d6afb
parent 2009 1a1236dfdbb1
child 2087 c1ac266bd660
permissions -rw-r--r--
CLIENT PREFS ARE GO!!1!shiftone!!1!
Fully implemented amb734 - Including console interface and menu for clients to use.
pred@2009
     1
/**
pred@2009
     2
 * vim: set ts=4 :
pred@2009
     3
 * =============================================================================
pred@2009
     4
 * SourceMod Client Preferences Extension
pred@2009
     5
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
pred@2009
     6
 * =============================================================================
pred@2009
     7
 *
pred@2009
     8
 * This program is free software; you can redistribute it and/or modify it under
pred@2009
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
pred@2009
    10
 * Free Software Foundation.
pred@2009
    11
 * 
pred@2009
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
pred@2009
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
pred@2009
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
pred@2009
    15
 * details.
pred@2009
    16
 *
pred@2009
    17
 * You should have received a copy of the GNU General Public License along with
pred@2009
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
pred@2009
    19
 *
pred@2009
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
pred@2009
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
pred@2009
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
pred@2009
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
pred@2009
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
pred@2009
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
pred@2009
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
pred@2009
    27
 * or <http://www.sourcemod.net/license.php>.
pred@2009
    28
 *
pred@2009
    29
 * Version: $Id$
pred@2009
    30
 */
pred@2009
    31
pred@2009
    32
#ifndef _INCLUDE_SOURCEMOD_CLIENTPREFS_QUERY_H_
pred@2009
    33
#define _INCLUDE_SOURCEMOD_CLIENTPREFS_QUERY_H_
pred@2009
    34
pred@2009
    35
#include "extension.h"
pred@2009
    36
#include "cookie.h"
pred@2009
    37
#include "sh_string.h"
pred@2009
    38
pred@2009
    39
enum querytype
pred@2009
    40
{
pred@2009
    41
	Query_InsertCookie = 0,
pred@2009
    42
	Query_SelectData,
pred@2009
    43
	Query_InsertData,
pred@2048
    44
	Query_SelectId,
pred@2009
    45
};
pred@2009
    46
pred@2009
    47
class TQueryOp : public IDBThreadOperation
pred@2009
    48
{
pred@2009
    49
public:
pred@2048
    50
	TQueryOp(IDatabase *db, const char *query, enum querytype type, int client);
pred@2048
    51
	TQueryOp(IDatabase *db, const char *query, enum querytype type, Cookie *cookie);
pred@2009
    52
	~TQueryOp() {}
pred@2009
    53
pred@2009
    54
	IDBDriver *GetDriver();
pred@2009
    55
	IdentityToken_t *GetOwner();
pred@2009
    56
pred@2009
    57
	void Destroy();
pred@2009
    58
pred@2009
    59
	void RunThreadPart();
pred@2009
    60
	/* Thread has been cancelled due to driver unloading. Nothing else to do? */
pred@2009
    61
	void CancelThinkPart()
pred@2009
    62
	{
pred@2009
    63
	}
pred@2009
    64
	void RunThinkPart();
pred@2009
    65
pred@2009
    66
private:
pred@2009
    67
	IDatabase *m_pDatabase;
pred@2048
    68
	IQuery *m_pQuery;
pred@2048
    69
	SourceHook::String m_Query;
pred@2009
    70
	char error[255];
pred@2009
    71
	enum querytype m_type;
pred@2009
    72
	int m_client;
pred@2009
    73
	int m_insertId;
pred@2009
    74
	Cookie *pCookie;
pred@2009
    75
};
pred@2009
    76
pred@2009
    77
pred@2009
    78
#endif // _INCLUDE_SOURCEMOD_CLIENTPREFS_QUERY_H_