summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-04-27 15:38:50 -0400
committerAdam <Adam@anope.org>2012-04-27 15:38:50 -0400
commit5068483cb917ba1c8ed3a0d20f7bfcb996f0aa3e (patch)
treecf2bf4096b72f68b595a3bbe9d0e75d34ad2641d /modules/extra
parent83ee20fc2910e9ea0cac250e767d20f17576d98a (diff)
Add db_sql:prefix allow prefixing all anope tables similarly, and changed db_sql to update the databases incrementally instead of one big flush
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/m_chanstats.cpp2
-rw-r--r--modules/extra/m_mysql.cpp6
-rw-r--r--modules/extra/m_sqlite.cpp6
-rw-r--r--modules/extra/sql.h2
4 files changed, 8 insertions, 8 deletions
diff --git a/modules/extra/m_chanstats.cpp b/modules/extra/m_chanstats.cpp
index 8aa7e0a6a..9da3f0b10 100644
--- a/modules/extra/m_chanstats.cpp
+++ b/modules/extra/m_chanstats.cpp
@@ -66,7 +66,7 @@ class MChanstats : public Module
if (!sql)
return;
- SQLResult r = this->sql->RunQuery(this->sql->GetTables());
+ SQLResult r = this->sql->RunQuery(this->sql->GetTables("anope_bs_"));
for (int i = 0; i < r.Rows(); ++i)
{
const std::map<Anope::string, Anope::string> &map = r.Row(i);
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index 0696955cd..b5f0e4406 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -127,7 +127,7 @@ class MySQLService : public SQLProvider
std::vector<SQLQuery> CreateTable(const Anope::string &table, const Serialize::Data &data) anope_override;
- SQLQuery GetTables() anope_override;
+ SQLQuery GetTables(const Anope::string &prefix) anope_override;
void Connect();
@@ -391,9 +391,9 @@ std::vector<SQLQuery> MySQLService::CreateTable(const Anope::string &table, cons
return queries;
}
-SQLQuery MySQLService::GetTables()
+SQLQuery MySQLService::GetTables(const Anope::string &prefix)
{
- return SQLQuery("SHOW TABLES");
+ return SQLQuery("SHOW TABLES LIKE '" + prefix + "%';");
}
void MySQLService::Connect()
diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp
index 1c82f3459..5102c003b 100644
--- a/modules/extra/m_sqlite.cpp
+++ b/modules/extra/m_sqlite.cpp
@@ -48,7 +48,7 @@ class SQLiteService : public SQLProvider
std::vector<SQLQuery> CreateTable(const Anope::string &table, const Serialize::Data &data) anope_override;
- SQLQuery GetTables();
+ SQLQuery GetTables(const Anope::string &prefix);
Anope::string BuildQuery(const SQLQuery &q);
};
@@ -236,9 +236,9 @@ std::vector<SQLQuery> SQLiteService::CreateTable(const Anope::string &table, con
return queries;
}
-SQLQuery SQLiteService::GetTables()
+SQLQuery SQLiteService::GetTables(const Anope::string &prefix)
{
- return SQLQuery("SELECT name FROM sqlite_master WHERE type='table'");
+ return SQLQuery("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '" + prefix + "%';");
}
Anope::string SQLiteService::Escape(const Anope::string &query)
diff --git a/modules/extra/sql.h b/modules/extra/sql.h
index a986cf794..2e2e1840c 100644
--- a/modules/extra/sql.h
+++ b/modules/extra/sql.h
@@ -129,6 +129,6 @@ class SQLProvider : public Service
virtual std::vector<SQLQuery> CreateTable(const Anope::string &table, const Serialize::Data &data) = 0;
- virtual SQLQuery GetTables() = 0;
+ virtual SQLQuery GetTables(const Anope::string &prefix) = 0;
};