*/
enum SQLstatus { CREAD, CWRITE, WREAD, WWRITE, RREAD, RWRITE };
-unsigned long count(const char * const str, char a)
+static unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
for (const char *p = str; *p; ++p)
unsigned long currid;
char* sqlsuccess;
ReconnectTimer* retimer;
-
+ ServiceProvider sqlserv;
public:
ModulePgSQL()
- : currid(0)
+ : currid(0), sqlserv(this, "SQL/pgsql", SERVICE_DATA)
{
- ServerInstance->Modules->UseInterface("SQLutils");
-
sqlsuccess = new char[strlen(SQLSUCCESS)+1];
strlcpy(sqlsuccess, SQLSUCCESS, strlen(SQLSUCCESS));
- if (!ServerInstance->Modules->PublishFeature("SQL", this))
- {
- throw ModuleException("BUG: PgSQL Unable to publish feature 'SQL'");
- }
-
ReadConf();
- ServerInstance->Modules->PublishInterface("SQL", this);
+ ServerInstance->Modules->AddService(sqlserv);
Implementation eventlist[] = { I_OnUnloadModule, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
ServerInstance->Timers->DelTimer(retimer);
ClearAllConnections();
delete[] sqlsuccess;
- ServerInstance->Modules->UnpublishInterface("SQL", this);
- ServerInstance->Modules->UnpublishFeature("SQL");
- ServerInstance->Modules->DoneWithInterface("SQLutils");
}
}
}
- virtual void OnUnloadModule(Module* mod, const std::string& name)
+ virtual void OnUnloadModule(Module* mod)
{
/* When a module unloads we have to check all the pending queries for all our connections
* and set the Module* specifying where the query came from to NULL. If the query has already
virtual Version GetVersion()
{
- return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR|VF_SERVICEPROVIDER, API_VERSION);
+ return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR);
}
};