glom r1893 - in trunk: . glom/libglom/connectionpool_backends glom/mode_design/fields



Author: arminb
Date: Thu Feb 12 18:49:31 2009
New Revision: 1893
URL: http://svn.gnome.org/viewvc/glom?rev=1893&view=rev

Log:
2009-02-12  Armin Burgmeier  <armin openismus com>

	* glom/mode_design/fields/box_db_table_definition.cc
	(check_field_change): Check field's glom type directly instead of
	guessing the glom type from its GType, which might produce a wrong
	result with some of the fallback types used with SQLite.

	* glom/libglom/connectionpool_backends/sqlite.cc (recreate_table):
	Don't crash if transaction rollback fails without the error variable
	being set.


Modified:
   trunk/ChangeLog
   trunk/glom/libglom/connectionpool_backends/sqlite.cc
   trunk/glom/mode_design/fields/box_db_table_definition.cc

Modified: trunk/glom/libglom/connectionpool_backends/sqlite.cc
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/sqlite.cc	(original)
+++ trunk/glom/libglom/connectionpool_backends/sqlite.cc	Thu Feb 12 18:49:31 2009
@@ -154,10 +154,6 @@
   if(!set_server_operation_value(operation, pkey_path, column->get_primary_key() ? "TRUE" : "FALSE", error)) return false;
   if(!set_server_operation_value(operation, unique_path, column->get_unique_key() ? "TRUE" : "FALSE", error)) return false;
 
-  Gnome::Gda::Value value = column->get_default_value();
-  if(value.get_value_type() != G_TYPE_NONE && !value.is_null())
-    if(!set_server_operation_value(operation, default_path, value.to_string(), error))
-      return false;
   return true;
 }
 
@@ -185,8 +181,7 @@
   {
     GdaMetaTableColumn* column = GDA_META_TABLE_COLUMN(item->data);
 
-    // Don't add if field was removed or changed.
-    const type_mapFieldChanges::const_iterator changed_iter = fields_changed.find(column->column_name);
+    // Don't add if field was removed
     if(std::find(fields_removed.begin(), fields_removed.end(), column->column_name) != fields_removed.end())
       continue;
 #if 0
@@ -205,6 +200,7 @@
       trans_fields += ",";
     trans_fields += column->column_name;
 
+    const type_mapFieldChanges::const_iterator changed_iter = fields_changed.find(column->column_name);
     if(changed_iter != fields_changed.end())
     {
       if(!add_column_to_server_operation(operation, changed_iter->second, i++, error))
@@ -275,7 +271,10 @@
   std::auto_ptr<Glib::Error> rollback_error;
   if(!rollback_transaction(connection, TRANSACTION_NAME, rollback_error))
   {
-    std::cerr << "Sqlite::recreate_table: Failed to rollback failed transaction: " << rollback_error->what() << std::endl;
+    std::cerr << "Sqlite::recreate_table: Failed to rollback failed transaction";
+    if(rollback_error.get())
+      std::cerr << ": " << rollback_error->what();
+    std::cerr << std::endl;
   }
 
   return false;

Modified: trunk/glom/mode_design/fields/box_db_table_definition.cc
==============================================================================
--- trunk/glom/mode_design/fields/box_db_table_definition.cc	(original)
+++ trunk/glom/mode_design/fields/box_db_table_definition.cc	Thu Feb 12 18:49:31 2009
@@ -269,7 +269,7 @@
 
   //If we are changing a non-glom type:
   //Refuse to edit field definitions that were not created by glom:
-  if(Field::get_glom_type_for_gda_type( field_old->get_field_info()->get_g_type() )  == Field::TYPE_INVALID)
+  if(field_old->get_glom_type() == Field::TYPE_INVALID)
   {
     Utils::show_ok_dialog(_("Invalid database structure"),
       _("This database field was created or edited outside of Glom. It has a data type that is not supported by Glom. Your system administrator may be able to correct this."), parent_window, Gtk::MESSAGE_ERROR);



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