3 * ===============================================================
4 * SourceMod SQLite Driver Extension
5 * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
6 * ===============================================================
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _INCLUDE_SQLITE_SOURCEMOD_QUERY_H_
25 #define _INCLUDE_SQLITE_SOURCEMOD_QUERY_H_
27 #include "SqDatabase.h"
28 #include "SqResults.h"
34 SqQuery(SqDatabase *parent, sqlite3_stmt *stmt);
37 IResultSet *GetResultSet();
38 bool FetchMoreResults();
40 public: //IPreparedQuery
41 bool BindParamInt(unsigned int param, int num, bool signd=true);
42 bool BindParamFloat(unsigned int param, float f);
43 bool BindParamNull(unsigned int param);
44 bool BindParamString(unsigned int param, const char *text, bool copy);
45 bool BindParamBlob(unsigned int param, const void *data, size_t length, bool copy);
47 const char *GetError(int *errCode=NULL);
48 unsigned int GetAffectedRows();
49 unsigned int GetInsertID();
51 unsigned int GetRowCount();
52 unsigned int GetFieldCount();
53 const char *FieldNumToName(unsigned int columnId);
54 bool FieldNameToNum(const char *name, unsigned int *columnId);
56 IResultRow *FetchRow();
57 IResultRow *CurrentRow();
59 DBType GetFieldType(unsigned int field);
60 DBType GetFieldDataType(unsigned int field);
62 DBResult GetString(unsigned int columnId, const char **pString, size_t *length);
63 DBResult CopyString(unsigned int columnId,
67 DBResult GetFloat(unsigned int columnId, float *pFloat);
68 DBResult GetInt(unsigned int columnId, int *pInt);
69 bool IsNull(unsigned int columnId);
70 size_t GetDataSize(unsigned int columnId);
71 DBResult GetBlob(unsigned int columnId, const void **pData, size_t *length);
72 DBResult CopyBlob(unsigned int columnId, void *buffer, size_t maxlength, size_t *written);
74 sqlite3_stmt *GetStmt();
76 SqDatabase *m_pParent;
77 sqlite3_stmt *m_pStmt;
78 SqResults *m_pResults;
79 unsigned int m_ParamCount;
82 unsigned int m_AffectedRows;
83 unsigned int m_InsertID;
84 unsigned int m_ColCount;
87 #endif //_INCLUDE_SQLITE_SOURCEMOD_QUERY_H_