[glom] Adapt use of Gda::ServerOperation.



commit f731186bdfb6fce77b12e9fa6c32924f0bad375e
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jun 21 18:30:16 2010 +0200

    Adapt use of Gda::ServerOperation.
    
    	* glom/libglom/connectionpool_backends/backend.cc: add_column(),
    	* glom/libglom/connectionpool_backends/sqlite.cc:
    	add_column_to_server_operation(): set_value_at() is now templated in libgdamm,
    	so there is no need for the ugly (somebool ? "TRUE" : "FALSE") code.

 ChangeLog                                       |    9 +++++++++
 glom/libglom/connectionpool_backends/backend.cc |    4 ++--
 glom/libglom/connectionpool_backends/sqlite.cc  |    8 ++++----
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6d9bcd2..35c06c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-21  Murray Cumming  <murrayc murrayc com>
+
+	Adapt use of Gda::ServerOperation.
+
+	* glom/libglom/connectionpool_backends/backend.cc: add_column(), 
+	* glom/libglom/connectionpool_backends/sqlite.cc:
+	add_column_to_server_operation(): set_value_at() is now templated in libgdamm, 
+	so there is no need for the ugly (somebool ? "TRUE" : "FALSE") code.
+	
 2010-06-21  David King  <amigadave amigadave com>
 
 	Explicitly link with libdl for Python module loading test
diff --git a/glom/libglom/connectionpool_backends/backend.cc b/glom/libglom/connectionpool_backends/backend.cc
index 76df895..5044391 100644
--- a/glom/libglom/connectionpool_backends/backend.cc
+++ b/glom/libglom/connectionpool_backends/backend.cc
@@ -74,8 +74,8 @@ void Backend::add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection,
   operation->set_value_at("/COLUMN_DEF_P/TABLE_NAME", table_name);
   operation->set_value_at("/COLUMN_DEF_P/COLUMN_NAME", field->get_name());
   operation->set_value_at("/COLUMN_DEF_P/COLUMN_TYPE", field->get_sql_type());
-  operation->set_value_at("/COLUMN_DEF_P/COLUMN_PKEY", field->get_primary_key() ? "TRUE" : "FALSE"); //TODO: Just use bool?
-  operation->set_value_at("/COLUMN_DEF_P/COLUMN_UNIQUE", field->get_unique_key() ? "TRUE" : "FALSE");
+  operation->set_value_at("/COLUMN_DEF_P/COLUMN_PKEY", field->get_primary_key());
+  operation->set_value_at("/COLUMN_DEF_P/COLUMN_UNIQUE", field->get_unique_key());
 
   provider->perform_operation(connection, operation);
 }
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index 73b64c6..f046b4d 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -113,8 +113,8 @@ bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::Serve
 
   operation->set_value_at(name_path, column->column_name);
   operation->set_value_at(type_path, column->column_type);
-  operation->set_value_at(pkey_path, column->pkey ? "TRUE" : "FALSE");
-  operation->set_value_at(nnul_path, !column->nullok ? "TRUE" : "FALSE");
+  operation->set_value_at(pkey_path, column->pkey);
+  operation->set_value_at(nnul_path, !column->nullok);
 
   if(column->default_value)
   {
@@ -135,8 +135,8 @@ bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::Serve
 
   operation->set_value_at(name_path, column->get_name());
   operation->set_value_at(type_path, column->get_sql_type());
-  operation->set_value_at(pkey_path, column->get_primary_key() ? "TRUE" : "FALSE");
-  operation->set_value_at(unique_path, column->get_unique_key() ? "TRUE" : "FALSE");
+  operation->set_value_at(pkey_path, column->get_primary_key());
+  operation->set_value_at(unique_path, column->get_unique_key());
 
   return true;
 }



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