unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
+ for (const char *p = str; *p; ++p)
{
if (*p == '?')
++n;
{
private:
ModuleMsSQL* Parent;
- InspIRCd* ServerInstance;
public:
- QueryThread(InspIRCd* si, ModuleMsSQL* mod)
- : SocketThread(si), Parent(mod), ServerInstance(si)
- {
+ QueryThread(ModuleMsSQL* mod)
+ : SocketThread(si), Parent(mod), {
}
~QueryThread() { }
virtual void Run();
{
private:
ResultQueue results;
- InspIRCd* ServerInstance;
Module* mod;
SQLhost host;
TDSLOGIN* login;
public:
QueryQueue queue;
- SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi)
- : ServerInstance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL)
+ SQLConn(Module* m, const SQLhost& hi)
+ : mod(m), host(hi), login(NULL), sock(NULL), context(NULL)
{
if (OpenDB())
{
QueryThread* queryDispatcher;
public:
- ModuleMsSQL(InspIRCd* Me)
- : Module(Me), currid(0)
+ ModuleMsSQL()
+ : currid(0)
{
LoggingMutex = new Mutex();
ResultsMutex = new Mutex();
ReadConf();
- queryDispatcher = new QueryThread(ServerInstance, this);
+ queryDispatcher = new QueryThread(this);
ServerInstance->Threads->Start(queryDispatcher);
ServerInstance->Modules->PublishInterface("SQL", this);
virtual ~ModuleMsSQL()
{
+ queryDispatcher->join();
delete queryDispatcher;
ClearQueue();
ClearAllConnections();
bool HostInConf(const SQLhost &h)
{
- ConfigReader conf(ServerInstance);
+ ConfigReader conf;
for(int i = 0; i < conf.Enumerate("database"); i++)
{
SQLhost host;
{
ClearOldConnections();
- ConfigReader conf(ServerInstance);
+ ConfigReader conf;
for(int i = 0; i < conf.Enumerate("database"); i++)
{
SQLhost host;
SQLConn* newconn;
- newconn = new SQLConn(ServerInstance, this, hi);
+ newconn = new SQLConn(this, hi);
connections.insert(std::make_pair(hi.id, newconn));
}
virtual Version GetVersion()
{
- return Version("$Id$", VF_VENDOR | VF_SERVICEPROVIDER, API_VERSION);
+ return Version("MsSQL provider", VF_VENDOR | VF_SERVICEPROVIDER, API_VERSION);
}
};