diff options
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/m_mysql.cpp | 7 | ||||
| -rw-r--r-- | modules/extra/m_sqlite.cpp | 7 | ||||
| -rw-r--r-- | modules/extra/sql.h | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 2edf21745..fef040336 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -135,6 +135,8 @@ class MySQLService : public SQLProvider bool CheckConnection(); Anope::string BuildQuery(const SQLQuery &q); + + Anope::string FromUnixtime(time_t); }; /** The SQL thread used to execute queries @@ -481,6 +483,11 @@ Anope::string MySQLService::BuildQuery(const SQLQuery &q) return real_query; } +Anope::string MySQLService::FromUnixtime(time_t t) +{ + return "FROM_UNIXTIME(" + stringify(t) + ")"; +} + void DispatcherThread::Run() { this->Lock(); diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index 4cf66cb5f..136e9d0dc 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -53,6 +53,8 @@ class SQLiteService : public SQLProvider SQLQuery GetTables(const Anope::string &prefix); Anope::string BuildQuery(const SQLQuery &q); + + Anope::string FromUnixtime(time_t); }; class ModuleSQLite : public Module @@ -297,5 +299,10 @@ Anope::string SQLiteService::BuildQuery(const SQLQuery &q) return real_query; } +Anope::string SQLiteService::FromUnixtime(time_t t) +{ + return "datetime('" + stringify(t) + "', 'unixepoch')"; +} + MODULE_INIT(ModuleSQLite) diff --git a/modules/extra/sql.h b/modules/extra/sql.h index 03c3c7694..62d7b73c0 100644 --- a/modules/extra/sql.h +++ b/modules/extra/sql.h @@ -132,5 +132,7 @@ class SQLProvider : public Service virtual SQLQuery BuildInsert(const Anope::string &table, unsigned int id, const Serialize::Data &data) = 0; virtual SQLQuery GetTables(const Anope::string &prefix) = 0; + + virtual Anope::string FromUnixtime(time_t) = 0; }; |
