summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-11-04 02:28:21 -0400
committerAdam <Adam@anope.org>2011-11-04 02:28:21 -0400
commit066e5b3fc08b6b85311e29aad6e78f12aba1a30e (patch)
tree4aaf5ce44271e61b7475b48fa909d01a4044107d /modules/extra
parent09dba47653f83d62dd3877b4cbac7af3bd16f341 (diff)
Delete all tables before flushing not just ones we know about
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/m_mysql.cpp7
-rw-r--r--modules/extra/m_sqlite.cpp7
-rw-r--r--modules/extra/sql.h2
3 files changed, 16 insertions, 0 deletions
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index 876d2ae4e..61e6c39c9 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -125,6 +125,8 @@ class MySQLService : public SQLProvider
SQLQuery CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data);
+ SQLQuery GetTables();
+
void Connect();
bool CheckConnection();
@@ -374,6 +376,11 @@ SQLQuery MySQLService::CreateTable(const Anope::string &table, const Serializabl
return SQLQuery(query_text);
}
+SQLQuery MySQLService::GetTables()
+{
+ return SQLQuery("SHOW TABLES");
+}
+
void MySQLService::Connect()
{
this->sql = mysql_init(this->sql);
diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp
index 58eab1c32..2411f843f 100644
--- a/modules/extra/m_sqlite.cpp
+++ b/modules/extra/m_sqlite.cpp
@@ -46,6 +46,8 @@ class SQLiteService : public SQLProvider
SQLQuery CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data);
+ SQLQuery GetTables();
+
Anope::string BuildQuery(const SQLQuery &q);
};
@@ -213,6 +215,11 @@ SQLQuery SQLiteService::CreateTable(const Anope::string &table, const Serializab
return SQLQuery(query_text);
}
+SQLQuery SQLiteService::GetTables()
+{
+ return SQLQuery("SELECT name FROM sqlite_master WHERE type='table'");
+}
+
Anope::string SQLiteService::Escape(const Anope::string &query)
{
char *e = sqlite3_mprintf("%q", query.c_str());
diff --git a/modules/extra/sql.h b/modules/extra/sql.h
index 85b3c291a..21b311014 100644
--- a/modules/extra/sql.h
+++ b/modules/extra/sql.h
@@ -118,5 +118,7 @@ class SQLProvider : public Service<Base>
virtual SQLResult RunQuery(const SQLQuery &query) = 0;
virtual SQLQuery CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data) = 0;
+
+ virtual SQLQuery GetTables() = 0;
};