diff options
author | Adam <Adam@anope.org> | 2017-01-08 17:03:54 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-01-11 20:44:55 -0500 |
commit | 074bde5cccf924b10ed15b7b2d91035cf253b57a (patch) | |
tree | dbb26634c7d06c5b276e9763810265b732854d2c | |
parent | a4f7d847abdde8f070a201417a456067d3beb4a1 (diff) |
db_sql: run table creation queries during import synchronously too
-rw-r--r-- | modules/database/db_sql.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index 12fc8512f..873a8cc7a 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -123,14 +123,20 @@ class DBSQL : public Module, public Pipe continue; std::vector<Query> create = this->sql->CreateTable(this->prefix + s_type->GetName(), data); - for (unsigned i = 0; i < create.size(); ++i) - this->RunBackground(create[i]); - Query insert = this->sql->BuildInsert(this->prefix + s_type->GetName(), obj->id, data); + if (this->imported) + { + for (unsigned i = 0; i < create.size(); ++i) + this->RunBackground(create[i]); + this->RunBackground(insert, new ResultSQLSQLInterface(this, obj)); + } else { + for (unsigned i = 0; i < create.size(); ++i) + this->sql->RunQuery(create[i]); + /* We are importing objects from another database module, so don't do asynchronous * queries in case the core has to shut down, it will cut short the import */ |