[glom] DbUtils: Move fill_full_field_details() here from Base_DB.



commit 741370f1652226c1376aa1e6d1e3fcd31b7baa5a
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 1 16:40:42 2010 +0200

    DbUtils: Move fill_full_field_details() here from Base_DB.
    
    	* glom/base_db.[h|cc]: Move fill_full_field_details() from here to:
    	* glom/libglom/db_utils.[h|cc]: here, so it can be used more generally,
    	and because it isn't actually used much now, so it's just making Base_DB
    	look even more complicated than it is.
    	* glom/report_builder.cc: Adapted.

 ChangeLog                |   10 ++++++++++
 glom/base_db.cc          |   18 ------------------
 glom/base_db.h           |    2 --
 glom/libglom/db_utils.cc |   18 ++++++++++++++++++
 glom/libglom/db_utils.h  |    1 +
 glom/report_builder.cc   |    2 +-
 6 files changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0285701..0ae7bea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-01  Murray Cumming  <murrayc murrayc-x61>
+
+	DbUtils: Move fill_full_field_details() here from Base_DB.
+
+	* glom/base_db.[h|cc]: Move fill_full_field_details() from here to:
+	* glom/libglom/db_utils.[h|cc]: here, so it can be used more generally, 
+	and because it isn't actually used much now, so it's just making Base_DB 
+	look even more complicated than it is.
+	* glom/report_builder.cc: Adapted.
+
 2010-10-01  Murray Cumming  <murrayc murrayc com>
 
 	Document: fill_layout_field_details(): Handle choices layouts too.
diff --git a/glom/base_db.cc b/glom/base_db.cc
index b2bcf43..35efd43 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -599,24 +599,6 @@ sharedptr<LayoutItem_Notebook> Base_DB::offer_notebook(const sharedptr<LayoutIte
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-void Base_DB::fill_full_field_details(const Glib::ustring& parent_table_name, sharedptr<LayoutItem_Field>& layout_item)
-{
-  if(!layout_item)
-  {
-    std::cerr << G_STRFUNC << ": layout_item was null." << std::endl;
-  }
-
-  const Glib::ustring table_name = layout_item->get_table_used(parent_table_name);
-
-  Document* document = get_document();
-  if(!document)
-  {
-    std::cerr << G_STRFUNC << ": document was null." << std::endl;
-  }
-
-  layout_item->set_full_field_details( get_document()->get_field(table_name, layout_item->get_name()) );
-}
-
 sharedptr<Field> Base_DB::get_fields_for_table_one_field(const Glib::ustring& table_name, const Glib::ustring& field_name) const
 {
   //Initialize output parameter:
diff --git a/glom/base_db.h b/glom/base_db.h
index 1780499..e11f018 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -121,8 +121,6 @@ protected:
   sharedptr<LayoutItem_Notebook> offer_notebook(const sharedptr<LayoutItem_Notebook>& start_notebook, Gtk::Window* transient_for = 0);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  void fill_full_field_details(const Glib::ustring& parent_table_name, sharedptr<LayoutItem_Field>& layout_item);
-
   bool get_relationship_exists(const Glib::ustring& table_name, const Glib::ustring& relationship_name);
 
   /** Get all the fields for a table, including any from the datasbase that are not yet known in the document.
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index ac2d6ff..788e18e 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1607,6 +1607,24 @@ bool query_execute(const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder)
   return (exec_retval >= 0);
 }
 
+void layout_item_fill_field_details(Document* document, const Glib::ustring& parent_table_name, sharedptr<LayoutItem_Field>& layout_item)
+{
+  if(!document)
+  {
+    std::cerr << G_STRFUNC << ": document was null." << std::endl;
+    return;
+  }
+
+  if(!layout_item)
+  {
+    std::cerr << G_STRFUNC << ": layout_item was null." << std::endl;
+  }
+
+  const Glib::ustring table_name = layout_item->get_table_used(parent_table_name);
+  layout_item->set_full_field_details( document->get_field(table_name, layout_item->get_name()) );
+}
+
+
 } //namespace DbUtils
 
 } //namespace Glom
diff --git a/glom/libglom/db_utils.h b/glom/libglom/db_utils.h
index d9b98b4..c1e9b5f 100644
--- a/glom/libglom/db_utils.h
+++ b/glom/libglom/db_utils.h
@@ -103,6 +103,7 @@ Gnome::Gda::Value auto_increment_insert_first_if_necessary(const Glib::ustring&
   */
 Gnome::Gda::Value get_next_auto_increment_value(const Glib::ustring& table_name, const Glib::ustring& field_name);
 
+void layout_item_fill_field_details(Document* document, const Glib::ustring& parent_table_name, sharedptr<LayoutItem_Field>& layout_item);
 
 } //namespace DbUtils
 
diff --git a/glom/report_builder.cc b/glom/report_builder.cc
index 1a6f9dd..cfeebbe 100644
--- a/glom/report_builder.cc
+++ b/glom/report_builder.cc
@@ -173,7 +173,7 @@ void ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp
   if(group_by->get_has_field_group_by())
   {
     sharedptr<LayoutItem_Field> field_group_by = group_by->get_field_group_by();
-    fill_full_field_details(found_set_parent.m_table_name, field_group_by);
+    DbUtils::layout_item_fill_field_details(get_document(), found_set_parent.m_table_name, field_group_by);
 
     //Get the possible group values, ignoring repeats by using GROUP BY.
     const Glib::ustring group_field_table_name = field_group_by->get_table_used(found_set_parent.m_table_name);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]