glom r1496 - in branches/glom-1-6: . glom



Author: murrayc
Date: Mon Mar 31 12:48:17 2008
New Revision: 1496
URL: http://svn.gnome.org/viewvc/glom?rev=1496&view=rev

Log:
2008-03-31  Murray Cumming  <murrayc murrayc com>

* glom/base_db.cc: get_record_field_values_for_calculation():
Do not show an error if the record does not exist yet. That is normal 
and is already dealt with by the following code. Do show an error if 
there is an exception.
Bug #525096 (Jani Monoses)

Modified:
   branches/glom-1-6/ChangeLog
   branches/glom-1-6/glom/base_db.cc

Modified: branches/glom-1-6/glom/base_db.cc
==============================================================================
--- branches/glom-1-6/glom/base_db.cc	(original)
+++ branches/glom-1-6/glom/base_db.cc	Mon Mar 31 12:48:17 2008
@@ -2001,7 +2001,18 @@
       //sharedptr<const Field> fieldPrimaryKey = get_field_primary_key();
 
       const Glib::ustring query = Utils::build_sql_select_with_key(table_name, fieldsToGet, primary_key, primary_key_value);
-      Glib::RefPtr<Gnome::Gda::DataModel> data_model = query_execute(query);
+
+      Glib::RefPtr<Gnome::Gda::DataModel> data_model;
+      try
+      {
+        data_model = query_execute(query);
+      }
+      catch(const Glib::Exception& ex)
+      {
+        std::cerr << "Base_DB::get_record_field_values_for_calculation(): Exception while executing SQL: " << query << std::endl;
+        handle_error(ex);
+        return field_values;
+      }
 
       if(data_model && data_model->get_n_rows())
       {
@@ -2024,7 +2035,9 @@
       }
       else
       {
-        handle_error();
+        //Maybe the record does not exist yet
+        //(Maybe we need the field values so we can calculate default values for some fields when creating the record.)
+        //So we create appropriate empty values below.
       }
     }
 



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