glom r1895 - in trunk: . glom/libglom/connectionpool_backends



Author: arminb
Date: Sun Feb 15 12:52:10 2009
New Revision: 1895
URL: http://svn.gnome.org/viewvc/glom?rev=1895&view=rev

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

	* glom/libglom/connectionpool_backends/sqlite.cc: Convert existing
	values explicitely via the date() and time() SQLite functions when
	converting existing values to date or time. This fixes all rows being
	erased when changing a column to date or time.


Modified:
   trunk/ChangeLog
   trunk/glom/libglom/connectionpool_backends/sqlite.cc

Modified: trunk/glom/libglom/connectionpool_backends/sqlite.cc
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/sqlite.cc	(original)
+++ trunk/glom/libglom/connectionpool_backends/sqlite.cc	Sun Feb 15 12:52:10 2009
@@ -198,16 +198,30 @@
 
     if(!trans_fields.empty())
       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())
     {
+      // Convert values to date or time, accordingly.
+      switch(changed_iter->second->get_glom_type())
+      {
+      case Field::TYPE_DATE:
+        trans_fields += Glib::ustring("date(") + column->column_name + ")";
+        break;
+      case Field::TYPE_TIME:
+        trans_fields += Glib::ustring("time(") + column->column_name + ")";
+        break;
+      default:
+        trans_fields += column->column_name;
+        break;
+      };
+
       if(!add_column_to_server_operation(operation, changed_iter->second, i++, error))
         return false;
     }
     else
     {
+      trans_fields += column->column_name;
       if(!add_column_to_server_operation(operation, column, i++, error))
         return false;
     }



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