[glom] DbUtils::recreate_database_from_document(): Create groups too.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] DbUtils::recreate_database_from_document(): Create groups too.
- Date: Fri, 2 Dec 2011 15:45:12 +0000 (UTC)
commit df906a92ed6997ffa88080dd7f1f0aae63cb64dd
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Dec 2 16:32:52 2011 +0100
DbUtils::recreate_database_from_document(): Create groups too.
* glom/libglom/db_utils.[h|cc]: recreate_database_from_document():
Also call add_groups_from_document().
ChangeLog | 7 +++++++
glom/libglom/db_utils.cc | 13 +++++++++++--
glom/libglom/db_utils.h | 3 +++
3 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index df9dac1..7bb0444 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-12-02 Murray Cumming <murrayc murrayc com>
+ DbUtils::recreate_database_from_document(): Create groups too.
+
+ * glom/libglom/db_utils.[h|cc]: recreate_database_from_document():
+ Also call add_groups_from_document().
+
+2011-12-02 Murray Cumming <murrayc murrayc com>
+
test_document_load: Move changes into test_document_load_and_change.
* tests/test_document_load.cc:
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 5f6cdb7..21339bb 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -278,7 +278,15 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
}
//Note that create_database() has already called add_standard_tables() and add_standard_groups(document).
-
+
+ //Add groups from the document:
+ progress();
+ if(!add_groups_from_document(document))
+ {
+ std::cerr << G_STRFUNC << ": add_groups_from_document() failed." << std::endl;
+ return false;
+ }
+
for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
{
sharedptr<const TableInfo> table_info = *iter;
@@ -288,6 +296,7 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
//try
//{
+ progress();
const bool table_insert_succeeded = insert_example_data(document, table_info->get_name());
if(!table_insert_succeeded)
@@ -303,7 +312,7 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
//}
} //for(tables)
-
+
return true; //All tables created successfully.
}
diff --git a/glom/libglom/db_utils.h b/glom/libglom/db_utils.h
index c706f57..6b6dd83 100644
--- a/glom/libglom/db_utils.h
+++ b/glom/libglom/db_utils.h
@@ -32,6 +32,9 @@ namespace DbUtils
bool create_database(Document* document, const Glib::ustring& database_name, const Glib::ustring& title, const sigc::slot<void>& progress);
+//TODO: Use this in Glom::Application?
+/** Create the database on an already-connected server.
+ */
bool recreate_database_from_document(Document* document, const sigc::slot<void>& progress);
/** This creates the standard tables if necessary,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]