-
- /* Empty out our list of connections */
- connections.clear();
-
- for(int i = 0; i < conf.Enumerate("database"); i++)
- {
- SQLhost host;
- int ipvalid;
- insp_inaddr blargle;
-
- host.id = conf.ReadValue("database", "id", i);
- host.host = conf.ReadValue("database", "hostname", i);
- host.port = conf.ReadInteger("database", "port", i, true);
- host.name = conf.ReadValue("database", "name", i);
- host.user = conf.ReadValue("database", "username", i);
- host.pass = conf.ReadValue("database", "password", i);
- host.ssl = conf.ReadFlag("database", "ssl", i);
-
- ipvalid = insp_aton(host.host.c_str(), &blargle);
-
- if(ipvalid > 0)
- {
- /* The conversion succeeded, we were given an IP and we can give it straight to SQLConn */
- this->AddConn(host);
- }
- else if(ipvalid == 0)
- {
- /* Conversion failed, assume it's a host */
- SQLresolver* resolver;
-
- resolver = new SQLresolver(this, Srv, host);
-
- Srv->AddResolver(resolver);
- }
- else
- {
- /* Invalid address family, die horribly. */
- log(DEBUG, "insp_aton failed returning -1, oh noes.");
- }
- }
- }
-
- void AddConn(const SQLhost& hi)
- {
- SQLConn* newconn;
-
- /* The conversion succeeded, we were given an IP and we can give it straight to SQLConn */
- newconn = new SQLConn(ServerInstance, this, Srv, hi);
-
- connections.insert(std::make_pair(hi.id, newconn));
- }
-
- virtual char* OnRequest(Request* request)
- {
- if(strcmp(SQLREQID, request->GetId()) == 0)