added data parameter to SQL_TConnect()
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401323
This commit is contained in:
		
							parent
							
								
									6943dece87
								
							
						
					
					
						commit
						b8900e9cfe
					
				@ -231,11 +231,12 @@ private:
 | 
				
			|||||||
class TConnectOp : public IDBThreadOperation
 | 
					class TConnectOp : public IDBThreadOperation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	TConnectOp(IPluginFunction *func, IDBDriver *driver, const char *_dbname)
 | 
						TConnectOp(IPluginFunction *func, IDBDriver *driver, const char *_dbname, cell_t data)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		m_pFunction = func;
 | 
							m_pFunction = func;
 | 
				
			||||||
		m_pDriver = driver;
 | 
							m_pDriver = driver;
 | 
				
			||||||
		m_pDatabase = NULL;
 | 
							m_pDatabase = NULL;
 | 
				
			||||||
 | 
							m_Data = data;
 | 
				
			||||||
		error[0] = '\0';
 | 
							error[0] = '\0';
 | 
				
			||||||
		strncopy(dbname, _dbname, sizeof(dbname));
 | 
							strncopy(dbname, _dbname, sizeof(dbname));
 | 
				
			||||||
		me = g_PluginSys.GetPluginByCtx(m_pFunction->GetParentContext()->GetContext());
 | 
							me = g_PluginSys.GetPluginByCtx(m_pFunction->GetParentContext()->GetContext());
 | 
				
			||||||
@ -269,7 +270,7 @@ public:
 | 
				
			|||||||
		m_pFunction->PushCell(BAD_HANDLE);
 | 
							m_pFunction->PushCell(BAD_HANDLE);
 | 
				
			||||||
		m_pFunction->PushCell(BAD_HANDLE);
 | 
							m_pFunction->PushCell(BAD_HANDLE);
 | 
				
			||||||
		m_pFunction->PushString("Driver is unloading");
 | 
							m_pFunction->PushString("Driver is unloading");
 | 
				
			||||||
		m_pFunction->PushCell(0);
 | 
							m_pFunction->PushCell(m_Data);
 | 
				
			||||||
		m_pFunction->Execute(NULL);
 | 
							m_pFunction->Execute(NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	void RunThinkPart()
 | 
						void RunThinkPart()
 | 
				
			||||||
@ -289,7 +290,7 @@ public:
 | 
				
			|||||||
		m_pFunction->PushCell(m_pDriver->GetHandle());
 | 
							m_pFunction->PushCell(m_pDriver->GetHandle());
 | 
				
			||||||
		m_pFunction->PushCell(hndl);
 | 
							m_pFunction->PushCell(hndl);
 | 
				
			||||||
		m_pFunction->PushString(hndl == BAD_HANDLE ? error : "");
 | 
							m_pFunction->PushString(hndl == BAD_HANDLE ? error : "");
 | 
				
			||||||
		m_pFunction->PushCell(0);
 | 
							m_pFunction->PushCell(m_Data);
 | 
				
			||||||
		m_pFunction->Execute(NULL);
 | 
							m_pFunction->Execute(NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	void Destroy()
 | 
						void Destroy()
 | 
				
			||||||
@ -303,6 +304,7 @@ private:
 | 
				
			|||||||
	IDatabase *m_pDatabase;
 | 
						IDatabase *m_pDatabase;
 | 
				
			||||||
	char dbname[64];
 | 
						char dbname[64];
 | 
				
			||||||
	char error[255];
 | 
						char error[255];
 | 
				
			||||||
 | 
						cell_t m_Data;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static cell_t SQL_Connect(IPluginContext *pContext, const cell_t *params)
 | 
					static cell_t SQL_Connect(IPluginContext *pContext, const cell_t *params)
 | 
				
			||||||
@ -394,7 +396,7 @@ static cell_t SQL_TConnect(IPluginContext *pContext, const cell_t *params)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Finally, add to the thread if we can */
 | 
						/* Finally, add to the thread if we can */
 | 
				
			||||||
	TConnectOp *op = new TConnectOp(pf, driver, conf);
 | 
						TConnectOp *op = new TConnectOp(pf, driver, conf, params[3]);
 | 
				
			||||||
	CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
 | 
						CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
 | 
				
			||||||
	if (pPlugin->GetProperty("DisallowDBThreads", NULL)
 | 
						if (pPlugin->GetProperty("DisallowDBThreads", NULL)
 | 
				
			||||||
		|| !g_DBMan.AddToThreadQueue(op, PrioQueue_High))
 | 
							|| !g_DBMan.AddToThreadQueue(op, PrioQueue_High))
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public Plugin:myinfo = 
 | 
					public Plugin:myinfo = 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	name = "SQL Admin Prefetcher",
 | 
						name = "SQL Admins (Prefetch)",
 | 
				
			||||||
	author = "AlliedModders LLC",
 | 
						author = "AlliedModders LLC",
 | 
				
			||||||
	description = "Reads all admins from SQL",
 | 
						description = "Reads all admins from SQL",
 | 
				
			||||||
	version = SOURCEMOD_VERSION,
 | 
						version = SOURCEMOD_VERSION,
 | 
				
			||||||
 | 
				
			|||||||
@ -551,7 +551,7 @@ native bool:SQL_IsSameConnection(Handle:hndl1, Handle:hndl2);
 | 
				
			|||||||
 * @param name			Database name.
 | 
					 * @param name			Database name.
 | 
				
			||||||
 * @noreturn
 | 
					 * @noreturn
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
native SQL_TConnect(SQLTCallback:callback, const String:name[]="default");
 | 
					native SQL_TConnect(SQLTCallback:callback, const String:name[]="default", any:data=0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Executes a simple query via a thread.  The query Handle is passed through
 | 
					 * Executes a simple query via a thread.  The query Handle is passed through
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user