glom r1883 - in trunk: . glom glom/libglom/data_structure



Author: murrayc
Date: Sat Feb  7 16:45:59 2009
New Revision: 1883
URL: http://svn.gnome.org/viewvc/glom?rev=1883&view=rev

Log:
2009-02-07  Murray Cumming  <murrayc murrayc com>

* glom/base_db.cc: get_field_value_is_unique(): Use the 
Field::get_holder(value) method overload instead of get_holder(), 
avoiding copying the Field and using Field::get_data().
* glom/libglom/data_structure/field.[h|cc]:
Removed the get_holder(name) method overload because it is now not 
used.
Removed get/set_data() and the member variable because they are now 
not used.

Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/glom/base_db.cc
   trunk/glom/libglom/data_structure/field.cc
   trunk/glom/libglom/data_structure/field.h

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sat Feb  7 16:45:59 2009
@@ -86,7 +86,7 @@
 fi
 
 # Do not require, goocanvas and gtksourceviewmm in client only mode
-REQUIRED_LIBS="bakery-2.6 >= 2.6.0 gtkmm-2.4 >= 2.10 gthread-2.0 libxslt >= 1.1.10 pygda-4.0 pygtk-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.8 libgda-4.0 >= 3.99.8 libgda-postgres-4.0 goocanvasmm-1.0 >= 0.13.0"
+REQUIRED_LIBS="bakery-2.6 >= 2.6.0 gtkmm-2.4 >= 2.14 gthread-2.0 libxslt >= 1.1.10 pygda-4.0 pygtk-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.8 libgda-4.0 >= 3.99.8 libgda-postgres-4.0 goocanvasmm-1.0 >= 0.13.0"
 if test $enable_client_only != yes; then
 	REQUIRED_LIBS="$REQUIRED_LIBS gtksourceviewmm-2.0"
 fi
@@ -95,7 +95,7 @@
 if test "$enable_maemo" = "yes"; then
 	REQUIRED_LIBS="$REQUIRED_LIBS hildonmm libepc-1.0 >= 0.3.1 avahi-ui";
 elif test "$win32" = "true"; then
-	REQUIRED_LIBS="$REQUIRED_LIBS gtkmm-2.4 >= 2.10";
+	REQUIRED_LIBS="$REQUIRED_LIBS gtkmm-2.4 >= 2.14";
 else
 	REQUIRED_LIBS="$REQUIRED_LIBS iso-codes libepc-1.0 >= 0.3.1 avahi-ui";
 fi

Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc	(original)
+++ trunk/glom/base_db.cc	Sat Feb  7 16:45:59 2009
@@ -2841,14 +2841,16 @@
   bool result = true;  //Arbitrarily default to saying it's unique if we can't get any result.
 
   const Glib::ustring table_name_used = field->get_table_used(table_name); 
+
   Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
-  Field glom_field = *field->get_full_field_details();
-  glom_field.set_data(value);
-  params->add_holder(glom_field.get_holder());
-  Glib::ustring strQuery = "SELECT \"" + table_name_used + "\".\"" + field->get_name() + "\" FROM \"" + table_name_used + "\"";
-  strQuery += " WHERE \"" + field->get_name() + "\" = " + glom_field.get_gda_holder_string();
+  sharedptr<const Field> glom_field = field->get_full_field_details();
+  if(glom_field)
+    params->add_holder(glom_field->get_holder(value));
+
+  const Glib::ustring strQuery = "SELECT \"" + table_name_used + "\".\"" + field->get_name() + "\" FROM \"" + table_name_used + "\""
+    " WHERE \"" + field->get_name() + "\" = " + glom_field->get_gda_holder_string();
 
-  Glib::RefPtr<Gnome::Gda::DataModel> data_model = query_execute_select(strQuery, params);
+  Glib::RefPtr<const Gnome::Gda::DataModel> data_model = query_execute_select(strQuery, params);
   if(data_model)
   {
     //std::cout << "debug: Base_DB::get_field_value_is_unique(): table_name=" << table_name << ", field name=" << field->get_name() << ", value=" << value.to_string() << ", rows count=" << data_model->get_n_rows() << std::endl;

Modified: trunk/glom/libglom/data_structure/field.cc
==============================================================================
--- trunk/glom/libglom/data_structure/field.cc	(original)
+++ trunk/glom/libglom/data_structure/field.cc	Sat Feb  7 16:45:59 2009
@@ -63,7 +63,6 @@
 
   m_glom_type = src.m_glom_type;
   m_field_info = src.m_field_info->copy();
-  m_data = src.m_data;
 
   m_lookup_relationship = src.m_lookup_relationship;
   m_strLookupField = src.m_strLookupField;
@@ -85,7 +84,6 @@
   return TranslatableItem::operator==(src)
          && (m_field_info->equal(src.m_field_info))
          && (m_glom_type == src.m_glom_type)
-         && (m_data == src.m_data)
          && (m_lookup_relationship == src.m_lookup_relationship)
          && (m_strLookupField == src.m_strLookupField)
          && (m_calculation == src.m_calculation)
@@ -156,16 +154,6 @@
     set_glom_type( get_glom_type_for_gda_type(fieldinfo->get_g_type()) );
 }
 
-Gnome::Gda::Value Field::get_data() const
-{
-  return m_data;
-}
-
-void Field::set_data(const Gnome::Gda::Value& data)
-{
-  m_data = data;
-}
-
 sharedptr<Relationship> Field::get_lookup_relationship() const
 {
   return m_lookup_relationship;
@@ -745,18 +733,10 @@
   return g_type_name(get_gda_g_type());
 }
 
-Glib::RefPtr<Gnome::Gda::Holder> Field::get_holder(const Glib::ustring& name) const
-{
-  const Glib::ustring real_name = name.empty() ? get_name() : name;
-  Glib::RefPtr<Gnome::Gda::Holder> holder = Gnome::Gda::Holder::create(get_gda_g_type(),
-                                                                       real_name);
-  holder->set_value_as_value(get_data());
-  return holder;
-}
-
 Glib::RefPtr<Gnome::Gda::Holder> Field::get_holder(const Gnome::Gda::Value& value, const Glib::ustring& name) const
 {
-  Glib::RefPtr<Gnome::Gda::Holder> holder = get_holder(name);
+  const Glib::ustring real_name = name.empty() ? get_name() : name;
+  Glib::RefPtr<Gnome::Gda::Holder> holder = Gnome::Gda::Holder::create(get_gda_g_type(), real_name);
   holder->set_value_as_value(value);
   return holder;
 }

Modified: trunk/glom/libglom/data_structure/field.h
==============================================================================
--- trunk/glom/libglom/data_structure/field.h	(original)
+++ trunk/glom/libglom/data_structure/field.h	Sat Feb  7 16:45:59 2009
@@ -145,10 +145,6 @@
   /// Ignores any part of FieldAttributes that libgda does not properly fill.
   bool field_info_from_database_is_equal(const Glib::RefPtr<const Gnome::Gda::Column>& field);
 
-  //These are not used much:
-  Gnome::Gda::Value get_data() const;
-  void set_data(const Gnome::Gda::Value& value);
-
   //Lookup stuff:
   bool get_is_lookup() const;
 
@@ -162,9 +158,6 @@
   Glib::ustring get_gda_type() const;
   GType get_gda_g_type() const;
 
-  /// A convenience when using parameters with a libgda SQL query.
-  Glib::RefPtr<Gnome::Gda::Holder> get_holder(const Glib::ustring& name = Glib::ustring()) const;
- 
   //TODO: Shouldn't this be called get_gda_holder_name()?
   /// A convenience when using parameters with a libgda SQL query.
   Glib::RefPtr<Gnome::Gda::Holder> get_holder(const Gnome::Gda::Value& value, const Glib::ustring& name = Glib::ustring()) const;
@@ -255,8 +248,6 @@
   glom_field_type m_glom_type;
   Glib::RefPtr<Gnome::Gda::Column> m_field_info;
 
-  Gnome::Gda::Value m_data; //Not used much.
-
   sharedptr<Relationship> m_lookup_relationship;
   Glib::ustring m_strLookupField;
   Glib::ustring m_calculation;



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