diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-02 02:59:25 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-02 02:59:25 +0000 |
commit | fb2e4497b5d0d271515a2f2824148d7e4cf085fe (patch) | |
tree | 279dc7766462a60c0bfaa26656b854b9a4e6d870 | |
parent | 986c79d2bfa46cdd47b52ee2b6c94bc895a2d677 (diff) |
Add class SQLhost that represents a <database> config line.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6211 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/extra/m_sqlv2.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/modules/extra/m_sqlv2.h b/src/modules/extra/m_sqlv2.h index ba74fa57f..f9da56c89 100644 --- a/src/modules/extra/m_sqlv2.h +++ b/src/modules/extra/m_sqlv2.h @@ -428,4 +428,43 @@ public: virtual void Free(SQLfieldList* fl) = 0; }; + +/** SQLHost represents a <database> config line and is useful + * for storing in a map and iterating on rehash to see which + * <database> tags was added/removed/unchanged. + */ +class SQLhost +{ + public: + std::string id; /* Database handle id */ + std::string host; /* Database server hostname */ + std::string ip; /* resolved IP, needed for at least pgsql.so */ + unsigned int port; /* Database server port */ + std::string name; /* Database name */ + std::string user; /* Database username */ + std::string pass; /* Database password */ + bool ssl; /* If we should require SSL */ + + SQLhost() + { + } + + SQLhost(const std::string& i, const std::string& h, unsigned int p, const std::string& n, const std::string& u, const std::string& pa, bool s) + : id(i), host(h), port(p), name(n), user(u), pass(pa), ssl(s) + { + } + + /** Overload this to return a correct Data source Name (DSN) for + * the current SQL module. + */ + std::string GetDSN(); +}; + +/** Overload operator== for two SQLhost objects for easy comparison. + */ +bool operator== (const SQLhost& l, const SQLhost& r) +{ + return (l.id == r.id && l.host == r.host && l.port == r.port && l.name == r.name && l.user == l.user && l.pass == r.pass && l.ssl == r.ssl); +} + #endif |