Strip sourcehook from SQLite

This commit is contained in:
Kenzzer 2025-08-17 22:09:11 +00:00
parent 1007ed712c
commit ee4808dd5a
No known key found for this signature in database
GPG Key ID: 64C3FD4332686DC1
7 changed files with 12 additions and 16 deletions

View File

@ -674,7 +674,7 @@ else:
#'extensions/regex/AMBuilder',
#'extensions/sdkhooks/AMBuilder',
#'extensions/sdktools/AMBuilder',
#'extensions/sqlite/AMBuilder',
'extensions/sqlite/AMBuilder',
#'extensions/tf2/AMBuilder',
#'extensions/topmenus/AMBuilder',
#'extensions/updater/AMBuilder',

View File

@ -72,7 +72,7 @@ private:
sqlite3 *m_sq3;
std::recursive_mutex m_FullLock;
bool m_Persistent;
String m_LastError;
std::string m_LastError;
int m_LastErrorCode;
};

View File

@ -77,9 +77,8 @@ SqDriver::~SqDriver()
{
std::lock_guard<std::mutex> lock(m_OpenLock);
List<SqDbInfo>::iterator iter;
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
// now that we're gone.
@ -258,8 +257,7 @@ IDatabase *SqDriver::Connect(const DatabaseInfo *info, bool persistent, char *er
if (persistent)
{
/* See if anything in the cache matches */
List<SqDbInfo>::iterator iter;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
if ((*iter).path.compare(fullpath) == 0)
{
@ -298,8 +296,7 @@ void SqDriver::RemovePersistent(IDatabase *pdb)
{
std::lock_guard<std::mutex> lock(m_OpenLock);
List<SqDbInfo>::iterator iter;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
if ((*iter).db == pdb)
{

View File

@ -34,17 +34,16 @@
#define SOURCEMOD_SQL_DRIVER_CODE
#include <IDBDriver.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <mutex>
#include "sqlite-source/sqlite3.h"
using namespace SourceMod;
using namespace SourceHook;
struct SqDbInfo
{
String path;
std::string path;
IDatabase *db;
};
@ -73,7 +72,7 @@ public:
private:
Handle_t m_Handle;
std::mutex m_OpenLock;
List<SqDbInfo> m_Cache;
std::list<SqDbInfo> m_Cache;
bool m_bThreadSafe;
bool m_bShutdown;
};

View File

@ -86,7 +86,7 @@ private:
sqlite3_stmt *m_pStmt;
SqResults *m_pResults;
unsigned int m_ParamCount;
String m_LastError;
std::string m_LastError;
int m_LastErrorCode;
unsigned int m_AffectedRows;
unsigned int m_InsertID;

View File

@ -42,7 +42,7 @@ SqResults::SqResults(SqQuery *query) :
m_ColCount = sqlite3_column_count(m_pStmt);
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++)
{
m_ColNames[i].assign(sqlite3_column_name(m_pStmt, i));

View File

@ -86,7 +86,7 @@ private:
SqField *GetField(unsigned int col);
private:
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 */
BaseStringTable m_Strings; /** DOES NOT CHANGE */
BaseMemTable *m_pMemory; /** DOES NOT CHANGE */