[glom/glom-1-20] DbUtils::recreate_database_from_document(): Create groups too.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] DbUtils::recreate_database_from_document(): Create groups too.
- Date: Mon, 5 Dec 2011 15:20:33 +0000 (UTC)
commit 7768a4b5e668556b9a4d2c1cfdfa66bddf7a8f4a
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 f50c1ae..9bbea74 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: Test some navigation utility functions.
* glom/libglom/data_structure/layout/layoutgroup.cc: get_items_recursive():
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 592cc80..c2d1fed 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -279,7 +279,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;
@@ -289,6 +297,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)
@@ -304,7 +313,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 fa97683..85d8805 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]