mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-08 10:58:36 +00:00
Strip sourcehook from SQLite
This commit is contained in:
parent
1007ed712c
commit
ee4808dd5a
@ -674,7 +674,7 @@ else:
|
|||||||
#'extensions/regex/AMBuilder',
|
#'extensions/regex/AMBuilder',
|
||||||
#'extensions/sdkhooks/AMBuilder',
|
#'extensions/sdkhooks/AMBuilder',
|
||||||
#'extensions/sdktools/AMBuilder',
|
#'extensions/sdktools/AMBuilder',
|
||||||
#'extensions/sqlite/AMBuilder',
|
'extensions/sqlite/AMBuilder',
|
||||||
#'extensions/tf2/AMBuilder',
|
#'extensions/tf2/AMBuilder',
|
||||||
#'extensions/topmenus/AMBuilder',
|
#'extensions/topmenus/AMBuilder',
|
||||||
#'extensions/updater/AMBuilder',
|
#'extensions/updater/AMBuilder',
|
||||||
|
|||||||
@ -72,7 +72,7 @@ private:
|
|||||||
sqlite3 *m_sq3;
|
sqlite3 *m_sq3;
|
||||||
std::recursive_mutex m_FullLock;
|
std::recursive_mutex m_FullLock;
|
||||||
bool m_Persistent;
|
bool m_Persistent;
|
||||||
String m_LastError;
|
std::string m_LastError;
|
||||||
int m_LastErrorCode;
|
int m_LastErrorCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -77,9 +77,8 @@ SqDriver::~SqDriver()
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_OpenLock);
|
std::lock_guard<std::mutex> lock(m_OpenLock);
|
||||||
|
|
||||||
List<SqDbInfo>::iterator iter;
|
|
||||||
SqDatabase *sqdb;
|
SqDatabase *sqdb;
|
||||||
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
|
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
|
||||||
{
|
{
|
||||||
// Don't let SqDatabase try to remove itself from m_Cache
|
// Don't let SqDatabase try to remove itself from m_Cache
|
||||||
// now that we're gone.
|
// now that we're gone.
|
||||||
@ -258,8 +257,7 @@ IDatabase *SqDriver::Connect(const DatabaseInfo *info, bool persistent, char *er
|
|||||||
if (persistent)
|
if (persistent)
|
||||||
{
|
{
|
||||||
/* See if anything in the cache matches */
|
/* See if anything in the cache matches */
|
||||||
List<SqDbInfo>::iterator iter;
|
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
|
||||||
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
|
|
||||||
{
|
{
|
||||||
if ((*iter).path.compare(fullpath) == 0)
|
if ((*iter).path.compare(fullpath) == 0)
|
||||||
{
|
{
|
||||||
@ -298,8 +296,7 @@ void SqDriver::RemovePersistent(IDatabase *pdb)
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_OpenLock);
|
std::lock_guard<std::mutex> lock(m_OpenLock);
|
||||||
|
|
||||||
List<SqDbInfo>::iterator iter;
|
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
|
||||||
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
|
|
||||||
{
|
{
|
||||||
if ((*iter).db == pdb)
|
if ((*iter).db == pdb)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,17 +34,16 @@
|
|||||||
|
|
||||||
#define SOURCEMOD_SQL_DRIVER_CODE
|
#define SOURCEMOD_SQL_DRIVER_CODE
|
||||||
#include <IDBDriver.h>
|
#include <IDBDriver.h>
|
||||||
#include <sh_list.h>
|
#include <list>
|
||||||
#include <sh_string.h>
|
#include <string>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "sqlite-source/sqlite3.h"
|
#include "sqlite-source/sqlite3.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
using namespace SourceHook;
|
|
||||||
|
|
||||||
struct SqDbInfo
|
struct SqDbInfo
|
||||||
{
|
{
|
||||||
String path;
|
std::string path;
|
||||||
IDatabase *db;
|
IDatabase *db;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,7 +72,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Handle_t m_Handle;
|
Handle_t m_Handle;
|
||||||
std::mutex m_OpenLock;
|
std::mutex m_OpenLock;
|
||||||
List<SqDbInfo> m_Cache;
|
std::list<SqDbInfo> m_Cache;
|
||||||
bool m_bThreadSafe;
|
bool m_bThreadSafe;
|
||||||
bool m_bShutdown;
|
bool m_bShutdown;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -86,7 +86,7 @@ private:
|
|||||||
sqlite3_stmt *m_pStmt;
|
sqlite3_stmt *m_pStmt;
|
||||||
SqResults *m_pResults;
|
SqResults *m_pResults;
|
||||||
unsigned int m_ParamCount;
|
unsigned int m_ParamCount;
|
||||||
String m_LastError;
|
std::string m_LastError;
|
||||||
int m_LastErrorCode;
|
int m_LastErrorCode;
|
||||||
unsigned int m_AffectedRows;
|
unsigned int m_AffectedRows;
|
||||||
unsigned int m_InsertID;
|
unsigned int m_InsertID;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ SqResults::SqResults(SqQuery *query) :
|
|||||||
m_ColCount = sqlite3_column_count(m_pStmt);
|
m_ColCount = sqlite3_column_count(m_pStmt);
|
||||||
if (m_ColCount)
|
if (m_ColCount)
|
||||||
{
|
{
|
||||||
m_ColNames = new String[m_ColCount];
|
m_ColNames = new std::string[m_ColCount];
|
||||||
for (unsigned int i=0; i<m_ColCount; i++)
|
for (unsigned int i=0; i<m_ColCount; i++)
|
||||||
{
|
{
|
||||||
m_ColNames[i].assign(sqlite3_column_name(m_pStmt, i));
|
m_ColNames[i].assign(sqlite3_column_name(m_pStmt, i));
|
||||||
|
|||||||
@ -86,7 +86,7 @@ private:
|
|||||||
SqField *GetField(unsigned int col);
|
SqField *GetField(unsigned int col);
|
||||||
private:
|
private:
|
||||||
sqlite3_stmt *m_pStmt; /** DOES NOT CHANGE */
|
sqlite3_stmt *m_pStmt; /** DOES NOT CHANGE */
|
||||||
String *m_ColNames; /** DOES NOT CHANGE */
|
std::string *m_ColNames; /** DOES NOT CHANGE */
|
||||||
unsigned int m_ColCount; /** DOES NOT CHANGE */
|
unsigned int m_ColCount; /** DOES NOT CHANGE */
|
||||||
BaseStringTable m_Strings; /** DOES NOT CHANGE */
|
BaseStringTable m_Strings; /** DOES NOT CHANGE */
|
||||||
BaseMemTable *m_pMemory; /** DOES NOT CHANGE */
|
BaseMemTable *m_pMemory; /** DOES NOT CHANGE */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user