glom r1794 - in trunk: . glom glom/libglom glom/libglom/connectionpool_backends glom/libglom/data_structure glom/libglom/python_embed glom/mode_design/fields glom/utility_widgets/db_adddel regression_tests



Author: jhs
Date: Wed Dec 10 19:10:57 2008
New Revision: 1794
URL: http://svn.gnome.org/viewvc/glom?rev=1794&view=rev

Log:
2008-12-10  Johannes  <jschmid openismus com>

	* configure.in:
	Depend on libgdamm-4.0, libgda-postgres-4.0 and pygda-4.0

	* glom/main.cc: Call Gnome::Gda::Init() without arguments
	
	* glom/base_db.cc:
	* glom/libglom/connectionpool.cc:
	* glom/libglom/connectionpool.h:
	* glom/libglom/connectionpool_backends/postgres_central.cc:
	* glom/libglom/connectionpool_backends/postgres_central.h:
	* glom/libglom/connectionpool_backends/postgres_self.cc:
	* glom/libglom/connectionpool_backends/postgres_self.h:
	* glom/libglom/connectionpool_backends/sqlite.cc:
	* glom/libglom/connectionpool_backends/sqlite.h:
	* glom/libglom/data_structure/field.cc:
	* glom/libglom/data_structure/fieldtypes.cc:
	* glom/libglom/python_embed/py_glom_relatedrecord.cc:
	* glom/libglom/test_connectionpool.cc:
	* glom/libglom/utils.cc:
	* glom/mode_design/fields/box_db_table_definition.cc:
	* glom/mode_design/fields/dialog_fielddefinition.cc:
	* glom/utility_widgets/db_adddel/glom_db_treemodel.cc:
	* regression_tests/test_parsing_time.cc:
	
	Ported gda calls to libgda 4.0. This does mostly involve the removal of Gda::Client
	and some more API changes (Gda::ParamList => Gda::Set, Gda::Parameter => Gda::Holder).
	Some bits are still missing which involves creating database for Postgres (sqlite works) and
	several checks if postgres is installed that have been performed in the past. Also, the
	set_unique_key() and set_primary_key() methods of Gda::Column have no replacement in 4.0.
	All things that are not finished are marked with "TODO_gda:".

Modified:
   trunk/ChangeLog
   trunk/config.h.in
   trunk/configure.in
   trunk/glom/base_db.cc
   trunk/glom/libglom/connectionpool.cc
   trunk/glom/libglom/connectionpool.h
   trunk/glom/libglom/connectionpool_backends/postgres_central.cc
   trunk/glom/libglom/connectionpool_backends/postgres_central.h
   trunk/glom/libglom/connectionpool_backends/postgres_self.cc
   trunk/glom/libglom/connectionpool_backends/postgres_self.h
   trunk/glom/libglom/connectionpool_backends/sqlite.cc
   trunk/glom/libglom/connectionpool_backends/sqlite.h
   trunk/glom/libglom/data_structure/field.cc
   trunk/glom/libglom/data_structure/fieldtypes.cc
   trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc
   trunk/glom/libglom/test_connectionpool.cc
   trunk/glom/libglom/utils.cc
   trunk/glom/main.cc
   trunk/glom/mode_design/fields/box_db_table_definition.cc
   trunk/glom/mode_design/fields/dialog_fielddefinition.cc
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
   trunk/regression_tests/test_parsing_time.cc

Modified: trunk/config.h.in
==============================================================================
--- trunk/config.h.in	(original)
+++ trunk/config.h.in	Wed Dec 10 19:10:57 2008
@@ -70,6 +70,10 @@
 /* ISO codes prefix */
 #undef ISO_CODES_PREFIX
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
 /* Name of package */
 #undef PACKAGE
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Dec 10 19:10:57 2008
@@ -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-3.0 pygtk-2.0 >= 2.6.0 libgdamm-3.0 >= 2.9.82 libgda-3.0 >= 3.0.1 libgda-postgres-3.0 goocanvasmm-1.0 >= 0.13.0"
+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.0 libgda-4.0 >= 3.99.6 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

Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc	(original)
+++ trunk/glom/base_db.cc	Wed Dec 10 19:10:57 2008
@@ -56,6 +56,8 @@
 
 #include <sstream> //For stringstream
 
+#include <libgda/libgda.h> // gda_g_type_from_string
+
 namespace Glom
 {
 
@@ -193,7 +195,7 @@
       }
 #endif
     }
-
+        
     // TODO: Several functions call query_execute with non-select queries.
     // Before libgda-3.0, execute_single_command returned always a datamodel
     // on success. In case of a successful non-select command, we therefore
@@ -205,15 +207,15 @@
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
       try
       {
-        result = gda_connection->execute_select_command(strQuery);
+        result = gda_connection->statement_execute_select(strQuery);
       }
       catch(const Gnome::Gda::ConnectionError& ex)
       {
-        std::cout << "debug: Base_DB::query_execute(): exception from execute_select_command(): " << ex.what() << std::endl;
+        std::cout << "debug: Base_DB::query_execute(): exception from statement_execute_select(): " << ex.what() << std::endl;
       }
 #else
       std::auto_ptr<Glib::Error> error;
-      result = gda_connection->execute_select_command(strQuery, error);
+      result = gda_connection->statement_execute_select(strQuery, error);
       // Ignore error, empty datamodel is handled below
 #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
@@ -224,7 +226,7 @@
       int execute_result = -1;
       try
       {
-        execute_result = gda_connection->execute_non_select_command(strQuery);
+        execute_result = gda_connection->statement_execute_non_select(strQuery);
       }
       catch(const Gnome::Gda::ConnectionError& ex)
       {
@@ -232,7 +234,7 @@
       }
 #else
       std::auto_ptr<Glib::Error> error;
-      execute_result = gda_connection->execute_non_select_command(strQuery, error);
+      execute_result = gda_connection->gda_connection->statement_execute_non_select(strQuery, error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
       
       if(execute_result != -1)
@@ -288,11 +290,12 @@
   if(sharedconnection)
   {
     Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
+    std::list< Glib::RefPtr<Gnome::Gda::Holder> > empty_filter_list;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_schema(Gnome::Gda::CONNECTION_SCHEMA_TABLES);
+    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, empty_filter_list);
 #else
     std::auto_ptr<Glib::Error> error;
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_schema(Gnome::Gda::CONNECTION_SCHEMA_TABLES, error);
+    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, empty_filter_list, error);
     // Ignore error, data_model_tables presence is checked below
 #endif
     if(data_model_tables && (data_model_tables->get_n_columns() == 0))
@@ -306,12 +309,13 @@
       for(int i = 0; i < rows; ++i)
       {
         Gnome::Gda::Value value = data_model_tables->get_value_at(0, i);
-
+        
         //Get the table name:
         Glib::ustring table_name;
         if(G_VALUE_TYPE(value.gobj()) ==  G_TYPE_STRING)
         {
           table_name = value.get_string();
+          std::cout << "Found table: " << table_name << std::endl;
 
           bool add_it = true;
 
@@ -416,18 +420,17 @@
     return result;
 
   // These are documented here:
-  // http://www.gnome-db.org/docs/libgda/libgda-provider-class.html#LIBGDA-PROVIDER-GET-SCHEMA
+  // http://library.gnome.org/devel/libgda-4.0/3.99/connection.html#GdaConnectionMetaTypeHead
   enum GlomGdaDataModelFieldColumns
   {
     DATAMODEL_FIELDS_COL_NAME = 0,
     DATAMODEL_FIELDS_COL_TYPE = 1,
-    DATAMODEL_FIELDS_COL_SIZE = 2,
-    DATAMODEL_FIELDS_COL_SCALE = 3,
-    DATAMODEL_FIELDS_COL_NOTNULL = 4,
-    DATAMODEL_FIELDS_COL_PRIMARYKEY = 5,
-    DATAMODEL_FIELDS_COL_UNIQUEINDEX = 6,
-    DATAMODEL_FIELDS_COL_REFERENCES = 7,
-    DATAMODEL_FIELDS_COL_DEFAULTVALUE = 8
+    DATAMODEL_FIELDS_COL_GTYPE = 2,
+    DATAMODEL_FIELDS_COL_SIZE = 3,
+    DATAMODEL_FIELDS_COL_SCALE = 4,
+    DATAMODEL_FIELDS_COL_NOTNULL = 5,
+    DATAMODEL_FIELDS_COL_DEFAULTVALUE = 6,
+    DATAMODEL_FIELDS_COL_EXTRA = 6 // Could be auto-increment
   };
 
   //TODO: Bakery::BusyCursor busy_cursor(get_application());
@@ -448,16 +451,19 @@
   {
     Glib::RefPtr<Gnome::Gda::Connection> connection = sharedconnection->get_gda_connection();
 
-    Glib::RefPtr<Gnome::Gda::Parameter> param_table_name = Gnome::Gda::Parameter::create("name", table_name);
-    //Gnome::Gda::Parameter param_table_name("name", table_name);
-    Glib::RefPtr<Gnome::Gda::ParameterList> param_list = Gnome::Gda::ParameterList::create();
-    param_list->add_parameter(param_table_name);
-
+    Glib::RefPtr<Gnome::Gda::Holder> holder_table_name = Gnome::Gda::Holder::create(G_TYPE_STRING, "name");
+    Gnome::Gda::Value value(table_name);
+    holder_table_name->set_value(value);
+    std::list< Glib::RefPtr<Gnome::Gda::Holder> > holder_list;
+    holder_list.push_back (holder_table_name);
+    Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields = connection->get_schema(Gnome::Gda::CONNECTION_SCHEMA_FIELDS, param_list);
+    if (connection->update_meta_store())
+      data_model_fields = connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_FIELDS, holder_list);
 #else
     std::auto_ptr<Glib::Error> error;
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields = connection->get_schema(Gnome::Gda::CONNECTION_SCHEMA_FIELDS, param_list, error);
+    if (connection->update_meta_store(error))
+      data_model_fields = connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_FIELDS, holder_list, error);
     // Ignore error, data_model_fields presence is checked below
 #endif
 
@@ -492,21 +498,12 @@
         }
 
         //Get the field type:
-        //This is a string representation of the type, so we need to discover the GType for it:
-        Gnome::Gda::Value value_fieldtype = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_TYPE, row);
+        Gnome::Gda::Value value_fieldtype = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_GTYPE, row);
         if(value_fieldtype.get_value_type() ==  G_TYPE_STRING)
         {
-           Glib::ustring schema_type_string = value_fieldtype.get_string();
-           if(!schema_type_string.empty())
-           {
-             ConnectionPool* connection_pool = ConnectionPool::get_instance();
-             const FieldTypes* pFieldTypes = connection_pool->get_field_types();
-             if(pFieldTypes)
-             {
-               GType gdatype = pFieldTypes->get_gdavalue_for_schema_type_string(schema_type_string);
-               field_info->set_g_type(gdatype);
-             }
-           }
+          Glib::ustring type_string = value_fieldtype.get_string();
+          const GType gdatype = gda_g_type_from_string(type_string.c_str());
+          field_info->set_g_type(gdatype);
         }
 
         //Get the default value:
@@ -523,6 +520,7 @@
 
 
         //Get whether it is a primary key:
+#if 0 // TODO_gda
         Gnome::Gda::Value value_primarykey = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_PRIMARYKEY, row);
         if(value_primarykey.get_value_type() ==  G_TYPE_BOOLEAN)
           field_info->set_primary_key( value_primarykey.get_boolean() );
@@ -530,16 +528,16 @@
         //Get whether it is unique
         Gnome::Gda::Value value_unique = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_UNIQUEINDEX, row);
         if(value_unique.get_value_type() ==  G_TYPE_BOOLEAN)
-          field_info->set_unique_key( value_unique.get_boolean() );
-        else if(field_info->get_primary_key()) //All primaries keys are unique, so force this.
-          field_info->set_unique_key();
-
+          ;//TODO_gda:field_info->set_unique_key( value_unique.get_boolean() );
+        //TODO_gda:else if(field_info->get_primary_key()) //All primaries keys are unique, so force this.
+          //TODO_gda:field_info->set_unique_key();
         //Get whether it is autoincrements
         /* libgda does not provide this yet.
         Gnome::Gda::Value value_autoincrement = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_AUTOINCREMENT, row);
         if(value_autoincrement.get_value_type() ==  G_TYPE_BOOLEAN)
           field_info->set_auto_increment( value_autoincrement.get_bool() );
         */
+#endif
 
         sharedptr<Field> field(new Field()); //TODO: Get glom-specific information from the document?
         field->set_field_info(field_info);
@@ -598,7 +596,7 @@
         field_info->set_auto_increment( field_info_document->get_auto_increment() );
 
         //libgda does not tell us whether the field is auto_incremented, so we need to get that from the document.
-        field_info->set_primary_key( field_info_document->get_primary_key() );
+        //TODO_gda:field_info->set_primary_key( field_info_document->get_primary_key() );
 
         //libgda does yet tell us correct default_value information so we need to get that from the document.
         field_info->set_default_value( field_info_document->get_default_value() );
@@ -2796,10 +2794,19 @@
     g_warning("Base_DB::count_rows_returned_by(): connection failed.");
     return 0;
   }
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED  
   try
   {
-    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = sharedconnection->get_gda_connection()->execute_select_command(query_count);
+    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = sharedconnection->get_gda_connection()->statement_execute_select(query_count);
+#else
+    std::auto_ptr<Glib::Error> error;
+    Glib::RefPtr<Gnome::Gda::DataModel> datamodel = sharedconnection->get_gda_connection()->statement_execute_select(query_count, error);
+    if (error)
+    {
+      std::cerr << "count_rows_returned_by(): exception caught: " << ex.what() << std::endl;
+      return result;
+    }
+#endif
     if(datamodel && datamodel->get_n_rows() && datamodel->get_n_columns())
     {
       Gnome::Gda::Value value = datamodel->get_value_at(0, 0);
@@ -2810,6 +2817,7 @@
       else
         result = value.get_int();
     }
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch(const Glib::Exception& ex)
   {
@@ -2819,7 +2827,7 @@
   {
     std::cerr << "count_rows_returned_by(): exception caught: " << ex.what() << std::endl;
   }
-
+#endif
   //std::cout << "DEBUG: count_rows_returned_by(): Returning " << result << std::endl;
   return result;
 }

Modified: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc	(original)
+++ trunk/glom/libglom/connectionpool.cc	Wed Dec 10 19:10:57 2008
@@ -229,6 +229,7 @@
   m_epc_publisher(0),
   m_dialog_epc_progress(0),
 #endif // !GLOM_ENABLE_CLIENT_ONLY
+  m_backend(0),
   m_sharedconnection_refcount(0),
   m_ready_to_connect(false),
   m_pFieldTypes(0)
@@ -589,6 +590,7 @@
 
 void ConnectionPool::cleanup(Gtk::Window* parent_window)
 {
+
   if(m_backend.get())
     m_backend->cleanup(parent_window);
 

Modified: trunk/glom/libglom/connectionpool.h
==============================================================================
--- trunk/glom/libglom/connectionpool.h	(original)
+++ trunk/glom/libglom/connectionpool.h	Wed Dec 10 19:10:57 2008
@@ -288,8 +288,6 @@
 
 protected:
 
-  Glib::RefPtr<Gnome::Gda::Client> m_GdaClient;
-
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   EpcPublisher* m_epc_publisher;
   Gtk::Dialog* m_dialog_epc_progress; //For progress while generating certificates.

Modified: trunk/glom/libglom/connectionpool_backends/postgres_central.cc
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/postgres_central.cc	(original)
+++ trunk/glom/libglom/connectionpool_backends/postgres_central.cc	Wed Dec 10 19:10:57 2008
@@ -110,7 +110,7 @@
   return m_postgres_server_version;
 }
 
-Glib::RefPtr<Gnome::Gda::Connection> PostgresCentralHosted::attempt_connect(const Glib::RefPtr<Gnome::Gda::Client>& client, const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, float& postgres_server_version, std::auto_ptr<ExceptionConnection>& error)
+Glib::RefPtr<Gnome::Gda::Connection> PostgresCentralHosted::attempt_connect(const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, float& postgres_server_version, std::auto_ptr<ExceptionConnection>& error)
 {
   //We must specify _some_ database even when we just want to create a database.
   //This _might_ be different on some systems. I hope not. murrayc
@@ -130,19 +130,24 @@
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
-    connection = client->open_connection_from_string("PostgreSQL", cnc_string, username, password);
-    connection->execute_non_select_command("SET DATESTYLE = 'ISO'");
-    data_model = connection->execute_select_command("SELECT version()");
+    Glib::ustring auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", username, password);
+    connection = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string);
+    
+    connection->statement_execute_non_select("SET DATESTYLE = 'ISO'");
+    data_model = connection->statement_execute_select("SELECT version()");
   }
   catch(const Glib::Error& ex)
   {
 #else
-  std::auto_ptr<Glib::Error> glib_error;
-  connection = m_GdaClient->open_connection_from_string("PostgreSQL", cnc_string, m_user, m_password, glib_error);
-  if(!glib_error)
-    connection->execute_non_select_command("SET DATESTYLE = 'ISO'", error);
-  if(!glib_error)
-    data_model = connection->execute_select_command("SELECT version()", error);
+  std::auto_ptr<Glib::Error> error;
+  Glib::ustring auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", username, password);
+  connection = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string, Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+  
+  Glib::RefPtr<Gnome::Gda::SqlParser> parser = connection->create_parser();
+  if (!error)
+      connection->statement_execute_non_select("SET DATESTYLE = 'ISO'", error);
+  if (!error)
+      data_model = connection->statement_execute_select("SELECT version()", error);
 
   if(glib_error.get())
   {
@@ -156,13 +161,14 @@
 
     Glib::ustring cnc_string = cnc_string_main + ";DB_NAME=" + default_database;
     Glib::RefPtr<Gnome::Gda::Connection> temp_conn;
+    const Glib::ustring auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", username, password);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-      temp_conn = client->open_connection_from_string("PostgreSQL", cnc_string, username, password);
+      temp_conn = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string);
     } catch(const Glib::Error& ex) {}
 #else
-    temp_conn = client->open_connection_from_string("PostgreSQL", cnc_string, username, password, glib_error);
+    temp_conn = client->open_connection_from_string("PostgreSQL", cnc_string, auth_string, Gnome::Gda::CONNECTION_OPTIONS_NONE, glib_error);
 #endif
 
 #ifdef GLOM_CONNECTION_DEBUG
@@ -202,13 +208,6 @@
 
 Glib::RefPtr<Gnome::Gda::Connection> PostgresCentralHosted::connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error)
 {
-  if(!m_refGdaClient)
-  {
-    m_refGdaClient = Gnome::Gda::Client::create();
-    if(!m_refGdaClient)
-      return Glib::RefPtr<Gnome::Gda::Connection>();
-  }
-
   Glib::RefPtr<Gnome::Gda::Connection> connection;
 
   //Try each possible network port:
@@ -219,7 +218,7 @@
   if(port == 0)
     port = *iter_port ++;
 
-  connection = attempt_connect(m_refGdaClient, m_host, port, database, username, password, m_postgres_server_version, error);
+  connection = attempt_connect(m_host, port, database, username, password, m_postgres_server_version, error);
 
   // Remember port if only the database was missing
   bool connection_possible = false;
@@ -235,7 +234,7 @@
     while(!connection && iter_port != m_list_ports.end())
     {
       port = *iter_port;
-      connection = attempt_connect(m_refGdaClient, m_host, port, database, username, password, m_postgres_server_version, error);
+      connection = attempt_connect(m_host, port, database, username, password, m_postgres_server_version, error);
 
       // Remember port if only the database was missing
       if(error.get() && error->get_failure_type() == ExceptionConnection::FAILURE_NO_DATABASE)
@@ -269,23 +268,41 @@
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 bool PostgresCentralHosted::create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error)
 {
-  if(!m_refGdaClient)
+  const Glib::ustring auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", username, password);
+  const Glib::ustring cnc_string = Glib::ustring::compose("HOST=%1;PORT=%2", get_host(), get_port());
+  Glib::RefPtr<Gnome::Gda::Set> set = Gnome::Gda::Set::create();
+  Glib::RefPtr<Gnome::Gda::Connection> cnc;
+  Glib::RefPtr<Gnome::Gda::ServerOperation> op;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
   {
-    m_refGdaClient = Gnome::Gda::Client::create();
-    if(!m_refGdaClient)
-      return false;
+     cnc = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string);
+     op = cnc->create_operation(Gnome::Gda::SERVER_OPERATION_CREATE_DB, set);
   }
-
-  Glib::RefPtr<Gnome::Gda::ServerOperation> op = m_refGdaClient->prepare_create_database(database_name, "PostgreSQL");
+  catch(const Glib::Error& ex)
+  {
+    error.reset(new Glib::Error(ex));
+    return false;
+  }
+#else
+  cnc = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string, 
+                                                 Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+  if (error)
+    return false;
+  op = cnc->create_operation(Gnome::Gda::SERVER_OPERATION_CREATE_DB, set, error);
+  if (error)
+    return false;
+#endif
   g_assert(op);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
+    op->set_value_at("/DB_DEF_P/DB_NAME", database_name);
     op->set_value_at("/SERVER_CNX_P/HOST", get_host());
     op->set_value_at("/SERVER_CNX_P/PORT", port_as_string(m_port));
     op->set_value_at("/SERVER_CNX_P/ADM_LOGIN", username);
     op->set_value_at("/SERVER_CNX_P/ADM_PASSWORD", password);
-    m_refGdaClient->perform_create_database(op);
+    cnc->perform_operation(op);
   }
   catch(const Glib::Error& ex)
   {
@@ -293,13 +310,14 @@
     return false;
   }
 #else
+  op->set_value_at("/DB_DEF_P/DB_NAME", database_name, error);
   op->set_value_at("/SERVER_CNX_P/HOST", get_host(), error);
   op->set_value_at("/SERVER_CNX_P/PORT", port_as_string(m_port), error);
   op->set_value_at("/SERVER_CNX_P/ADM_LOGIN", username, error);
   op->set_value_at("/SERVER_CNX_P/ADM_PASSWORD", password, error);
 
   if(error.get() != NULL)
-    m_refGdaClient->perform_create_database(op);
+    cnc->perform_operation(op, error);
   else
     return false;
 #endif
@@ -310,6 +328,8 @@
 
 bool PostgresCentralHosted::check_postgres_gda_client_is_available_with_warning()
 {
+  // TODO_gda:
+#if 0
   Glib::RefPtr<Gnome::Gda::Client> gda_client = Gnome::Gda::Client::create();
   if(gda_client)
   {
@@ -336,8 +356,8 @@
   Hildon::Note note(Hildon::NOTE_TYPE_INFORMATION, message);
   note.run();
 #endif
-
-  return false;
+#endif
+  return true;
 }
 
 }

Modified: trunk/glom/libglom/connectionpool_backends/postgres_central.h
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/postgres_central.h	(original)
+++ trunk/glom/libglom/connectionpool_backends/postgres_central.h	Wed Dec 10 19:10:57 2008
@@ -63,14 +63,14 @@
    */
   static bool check_postgres_gda_client_is_available_with_warning();
 
-  static Glib::RefPtr<Gnome::Gda::Connection> attempt_connect(const Glib::RefPtr<Gnome::Gda::Client>& client, const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, float& postgres_server_version, std::auto_ptr<ExceptionConnection>& error);
+  static Glib::RefPtr<Gnome::Gda::Connection> attempt_connect(const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, float& postgres_server_version, std::auto_ptr<ExceptionConnection>& error);
 
 protected:
+
   virtual Field::sql_format get_sql_format() const { return Field::SQL_FORMAT_POSTGRES; }
   virtual bool supports_remote_access() const { return true; }
 
   virtual Glib::RefPtr<Gnome::Gda::Connection> connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error);
-
   /** Creates a new database.
    */
 #ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -81,7 +81,6 @@
   typedef std::list<Glib::ustring> type_list_ports;
   type_list_ports m_list_ports;
 
-  Glib::RefPtr<Gnome::Gda::Client> m_refGdaClient;
   Glib::ustring m_host;
   int m_port;
   bool m_try_other_ports;

Modified: trunk/glom/libglom/connectionpool_backends/postgres_self.cc
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/postgres_self.cc	(original)
+++ trunk/glom/libglom/connectionpool_backends/postgres_self.cc	Wed Dec 10 19:10:57 2008
@@ -471,39 +471,52 @@
 
 Glib::RefPtr<Gnome::Gda::Connection> PostgresSelfHosted::connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error)
 {
-  if(!m_refGdaClient)
-  {
-    m_refGdaClient = Gnome::Gda::Client::create();
-    if(!m_refGdaClient)
-      return Glib::RefPtr<Gnome::Gda::Connection>();
-  }
-
   if(!get_self_hosting_active())
     return Glib::RefPtr<Gnome::Gda::Connection>();
 
-  return PostgresCentralHosted::attempt_connect(m_refGdaClient, "localhost", port_as_string(m_port), database, username, password, m_postgres_server_version, error);
+  return PostgresCentralHosted::attempt_connect("localhost", port_as_string(m_port), database, username, password, m_postgres_server_version, error);
+
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 bool PostgresSelfHosted::create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error)
 {
-  if(!m_refGdaClient)
+  const Glib::ustring auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", username, password);
+  const Glib::ustring cnc_string = Glib::ustring::compose("HOST=localhost;PORT=%1;DB_NAME=%2", m_port, database_name);
+  Glib::RefPtr<Gnome::Gda::Set> set = Gnome::Gda::Set::create();
+  Glib::RefPtr<Gnome::Gda::Connection> cnc;
+  Glib::RefPtr<Gnome::Gda::ServerOperation> op;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
   {
-    m_refGdaClient = Gnome::Gda::Client::create();
-    if(!m_refGdaClient)
-      return false;
+    cnc = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string);
+    cnc = Gnome::Gda::Connection::create();
+    op = cnc->create_operation(Gnome::Gda::SERVER_OPERATION_CREATE_DB, set);
   }
-
-  Glib::RefPtr<Gnome::Gda::ServerOperation> op = m_refGdaClient->prepare_create_database(database_name, "PostgreSQL");
+  catch(const Glib::Error& ex)
+  {
+    error.reset(new Glib::Error(ex));
+    return false;
+  }
+#else
+  cnc = Gnome::Gda::Connection::open_from_string("PostgreSQL", cnc_string, auth_string, 
+                                                 Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+  if (error)
+    return false;
+  op = cnc->create_operation(Gnome::Gda::SERVER_OPERATION_CREATE_DB, set, error);
+  if (error)
+    return false;
+#endif
   g_assert(op);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
+    op->set_value_at("/DB_DEF_P/DB_NAME", database_name);
     op->set_value_at("/SERVER_CNX_P/HOST", "localhost");
     op->set_value_at("/SERVER_CNX_P/PORT", port_as_string(m_port));
     op->set_value_at("/SERVER_CNX_P/ADM_LOGIN", username);
     op->set_value_at("/SERVER_CNX_P/ADM_PASSWORD", password);
-    m_refGdaClient->perform_create_database(op);
+    cnc->perform_operation(op);
   }
   catch(const Glib::Error& ex)
   {
@@ -511,13 +524,14 @@
     return false;
   }
 #else
-  op->set_value_at("/SERVER_CNX_P/HOST", get_host(), error);
+  op->set_value_at("/DB_DEF_P/DB_NAME", database_name, error);
+  op->set_value_at("/SERVER_CNX_P/HOST", "localhost", error);
   op->set_value_at("/SERVER_CNX_P/PORT", port_as_string(m_port), error);
-  op->set_value_at("/SERVER_CNX_P/ADM_LOGIN", get_user(), error);
-  op->set_value_at("/SERVER_CNX_P/ADM_PASSWORD", get_password(), error);
+  op->set_value_at("/SERVER_CNX_P/ADM_LOGIN", username, error);
+  op->set_value_at("/SERVER_CNX_P/ADM_PASSWORD", password, error);
 
   if(error.get() != NULL)
-    m_refGdaClient->perform_create_database(op);
+    cnc->perform_operation(op, error);
   else
     return false;
 #endif

Modified: trunk/glom/libglom/connectionpool_backends/postgres_self.h
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/postgres_self.h	(original)
+++ trunk/glom/libglom/connectionpool_backends/postgres_self.h	Wed Dec 10 19:10:57 2008
@@ -97,7 +97,6 @@
   //bool directory_exists_filepath(const std::string& filepath);
   bool directory_exists_uri(const std::string& uri);
 
-  Glib::RefPtr<Gnome::Gda::Client> m_refGdaClient;
   std::string m_self_hosting_data_uri;
   int m_port;
 

Modified: trunk/glom/libglom/connectionpool_backends/sqlite.cc
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/sqlite.cc	(original)
+++ trunk/glom/libglom/connectionpool_backends/sqlite.cc	Wed Dec 10 19:10:57 2008
@@ -46,13 +46,6 @@
 
 Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error)
 {
-  if(!m_refGdaClient)
-  {
-    m_refGdaClient = Gnome::Gda::Client::create();
-    if(!m_refGdaClient)
-      return Glib::RefPtr<Gnome::Gda::Connection>();
-  }
-
   // Check if the database file exists. If it does not, then we don't try to
   // connect. libgda would create the database file if necessary, but we need
   // to ensure slightly different semantics.
@@ -66,17 +59,18 @@
     std::string database_directory = db_dir->get_path();
 
     const Glib::ustring cnc_string = "DB_DIR=" + database_directory + ";DB_NAME=" + database;
-
+    const Glib::ustring auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", username, password);
+    
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-      connection = m_refGdaClient->open_connection_from_string("SQLite", cnc_string, username, password);
+      connection = Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, auth_string);
     }
     catch(const Glib::Error& ex)
     {
 #else
     std::auto_ptr<Glib::Error> error;
-    connection = m_refGdaClient->open_connection_from_string("SQLite", cnc_string, username, password, error);
+    connection = Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, username, auth_string, Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
     if(error.get())
     {
       const Glib::Error& ex = *error.get();
@@ -100,24 +94,15 @@
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 bool Sqlite::create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error)
 {
-  if(!m_refGdaClient)
-  {
-    m_refGdaClient = Gnome::Gda::Client::create();
-    if(!m_refGdaClient)
-      return false;
-  }
-
-  Glib::RefPtr<Gnome::Gda::ServerOperation> op = m_refGdaClient->prepare_create_database(database_name, "SQLite");
-  g_assert(op);
-
-  // Convert URI to path, for DB_DIR in server operation
   Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(m_database_directory_uri);
-  std::string database_directory = file->get_path();
+  std::string database_directory = file->get_path(); 
+  const Glib::ustring cnc_string = Glib::ustring::compose("DB_DIR=%1;DB_NAME=%2", database_directory, database_name);
+
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
-    op->set_value_at("/DB_DEF_P/DB_DIR", database_directory);
-    m_refGdaClient->perform_create_database(op);
+    Glib::RefPtr<Gnome::Gda::Connection> cnc = 
+      Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, "");
   }
   catch(const Glib::Error& ex)
   {
@@ -125,14 +110,12 @@
     return false;
   }
 #else
-  op->set_value_at("/DB_DEF_P/DB_DIR", database_directory);
-
-  if(error.get() != NULL)
-    m_refGdaClient->perform_create_database(op);
-  else
-    return false;
+  Glib::RefPtr<Gnome::Gda::Connection> cnc = 
+    Gnome::Gda::Connection::open_from_string("SQLite", cnc_string, "", Gnome::Gda::CONNECTION_OPTIONS_NONE, error);
+  if (error.get() != 0)
+    return false
 #endif
-
+    
   return true;
 }
 #endif

Modified: trunk/glom/libglom/connectionpool_backends/sqlite.h
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/sqlite.h	(original)
+++ trunk/glom/libglom/connectionpool_backends/sqlite.h	Wed Dec 10 19:10:57 2008
@@ -53,7 +53,6 @@
 #endif
 
 private:
-  Glib::RefPtr<Gnome::Gda::Client> m_refGdaClient;
   std::string m_database_directory_uri;
 };
 

Modified: trunk/glom/libglom/data_structure/field.cc
==============================================================================
--- trunk/glom/libglom/data_structure/field.cc	(original)
+++ trunk/glom/libglom/data_structure/field.cc	Wed Dec 10 19:10:57 2008
@@ -645,22 +645,24 @@
 
 bool Field::get_primary_key() const
 {
-  return m_field_info->get_primary_key();
+  //TODO_gda: return m_field_info->get_primary_key();
+  return false;
 }
 
 void Field::set_primary_key(bool val)
 {
-  m_field_info->set_primary_key(val);
+  //TODO_gda: m_field_info->set_primary_key(val);
 }
 
 bool Field::get_unique_key() const
 {
-  return m_field_info->get_unique_key();
+  //TODO_gda: return m_field_info->get_unique_key();
+  return false;
 }
 
 void Field::set_unique_key(bool val)
 {
-  m_field_info->set_unique_key(val);
+  //TODO_gda: m_field_info->set_unique_key(val);
 }
 
 Gnome::Gda::Value Field::get_default_value() const
@@ -714,7 +716,7 @@
   Gnome::Gda::Value value = field->get_default_value();
   temp->set_default_value(value); //Don't compare this, because the data is incorrect when libgda reads it from the database.
 
-  temp->set_primary_key( field->get_primary_key() ); //Don't compare this, because the data is incorrect when libgda reads it from the database.
+  //TODO_gda: temp->set_primary_key( field->get_primary_key() ); //Don't compare this, because the data is incorrect when libgda reads it from the database.
 
   return temp->equal(field); 
 }

Modified: trunk/glom/libglom/data_structure/fieldtypes.cc
==============================================================================
--- trunk/glom/libglom/data_structure/fieldtypes.cc	(original)
+++ trunk/glom/libglom/data_structure/fieldtypes.cc	Wed Dec 10 19:10:57 2008
@@ -29,34 +29,42 @@
 FieldTypes::FieldTypes(const Glib::RefPtr<Gnome::Gda::Connection>& gda_connection)
 {
   // These are documented here:
-  // http://www.gnome-db.org/docs/libgda/libgda-provider-class.html#LIBGDA-PROVIDER-GET-SCHEMA
+  // http://library.gnome.org/devel/libgda-4.0/3.99/connection.html#GdaConnectionMetaTypeHead
   enum GlomGdaDataModelTypesColumns
   {
     DATAMODEL_FIELDS_COL_NAME = 0,
-    DATAMODEL_FIELDS_COL_OWNER = 1,
+    DATAMODEL_FIELDS_COL_GTYPE = 1,
     DATAMODEL_FIELDS_COL_COMMENTS = 2,
-    DATAMODEL_FIELDS_COL_GDATYPE = 3
+    DATAMODEL_FIELDS_COL_SYNONYMS = 3
   };
   
   if(gda_connection && gda_connection->is_opened())
   {
-    //Read the Types information, so that we can map the string representation of the type (returned by CONNECTION_SCHEMA_FIELDS) to
+    std::list< Glib::RefPtr<Gnome::Gda::Holder> > filters; // remains empty as we don't filter anything
+    //Read the Types information, so that we can map the string representation of the type (returned by CONNECTION_META_FIELDS) to
     //the Gda::ValueType used by Glib::RefPtr<Gnome::Gda::Column>.
+    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_schema(Gnome::Gda::CONNECTION_SCHEMA_TYPES);
+    if (gda_connection->update_meta_store())
+      data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES, filters);
 #else
     std::auto_ptr<Glib::Error> error;
-    Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_schema(Gnome::Gda::CONNECTION_SCHEMA_TYPES, error);
+    if (gda_connection->update_meta_store(error))
+      data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES, filters, error);
     // Ignore error here, we do not process data_model_tables if it is NULL
     // anyway
 #endif // GLIBMM_EXCEPTIONS_ENABLED
+    if (!data_model_tables)
+      std::cerr << "FieldTypes::FieldTypes(): Couldn't get datamodel" << std::endl;
     if(data_model_tables && (data_model_tables->get_n_columns() == 0))
     {
-      std::cerr << "FieldTypes::FieldTypes(): get_schema(Gnome::Gda::CONNECTION_SCHEMA_TYPES) failed." << std::endl;
+      std::cerr << "FieldTypes::FieldTypes(): get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES) failed." << std::endl;
     }
     else if(data_model_tables)
     {
       int rows = data_model_tables->get_n_rows();
+      if (!rows)
+        g_message ("FieldTypes::FieldTypes(): no rows from CONNECTION_META_TYPES");
       for(int i = 0; i < rows; ++i)
       {
         const Gnome::Gda::Value value_name = data_model_tables->get_value_at(DATAMODEL_FIELDS_COL_NAME, i);
@@ -65,21 +73,22 @@
         Glib::ustring schema_type_string;
         if(value_name.get_value_type() == G_TYPE_STRING)
           schema_type_string = value_name.get_string();
-    
+        
         if(!schema_type_string.empty())
         {
-          Gnome::Gda::Value value_gdatype = data_model_tables->get_value_at(DATAMODEL_FIELDS_COL_GDATYPE, i);
-          if(value_gdatype.get_value_type() == G_TYPE_ULONG) // TODO: I think this might change to G_TYPE_GTYPE in a future libgda
+          Gnome::Gda::Value value_gdatype = data_model_tables->get_value_at(DATAMODEL_FIELDS_COL_GTYPE, i);
+          if(value_gdatype.get_value_type() == G_TYPE_STRING)
           {
-            const GType gdatype = static_cast<GType>(value_gdatype.get_ulong());
+            Glib::ustring type_string = value_gdatype.get_string();
+            const GType gdatype = gda_g_type_from_string(type_string.c_str());
 
             //Save it for later:
-            //std::cout << "debug: schema_type_string=" << schema_type_string << ", gda type=" << gdatype << "(" << g_type_name(gdatype) << ")" << std::endl;
+            std::cout << "debug: schema_type_string=" << schema_type_string << ", gda type=" << gdatype << "(" << g_type_name(gdatype) << ")" << std::endl;
             
             m_mapSchemaStringsToGdaTypes[schema_type_string] = gdatype;
 
             Glib::ustring gdatypestring = gda_g_type_to_string(gdatype); // TODO: What is this actually used for?
-            //std::cout << "schema type: " << schema_type_string << " = gdatype " << (guint)gdatype << "(" << gdatypestring << ")" << std::endl;
+            std::cout << "schema type: " << schema_type_string << " = gdatype " << (guint)gdatype << "(" << gdatypestring << ")" << std::endl;
             
             m_mapGdaTypesToSchemaStrings[gdatype] = schema_type_string; //We save it twice, to just to make searching easier, without using a predicate.
             

Modified: trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc
==============================================================================
--- trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc	(original)
+++ trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc	Wed Dec 10 19:10:57 2008
@@ -230,10 +230,10 @@
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
             // TODO: Does this behave well if this throws an exception?
-            Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->execute_select_command(sql_query);
+            Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->statement_execute_select(sql_query);
 #else
             std::auto_ptr<Glib::Error> error;
-            Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->execute_select_command(sql_query, error);
+            Glib::RefPtr<Gnome::Gda::DataModel> datamodel =  gda_connection->statement_execute_select(sql_query, error);
             // Ignore error, datamodel return value is checked below
 #endif
             if(datamodel && datamodel->get_n_rows())
@@ -329,10 +329,10 @@
         //Get the aggregate value from the related records:
         const Glib::ustring sql_query = "SELECT " + aggregate + "(\"" + related_table + "\".\"" + field_name + "\") FROM \"" + related_table + "\""
           + " WHERE \"" + related_table + "\".\"" + related_key_name + "\" = " + *(self->m_from_key_value_sqlized);
-
+        
         //std::cout << "PyGlomRelatedRecord: Executing:  " << sql_query << std::endl;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-        Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->execute_select_command(sql_query);
+        Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->statement_execute_select(sql_query);
 #else
 	std::auto_ptr<Glib::Error> error;
         Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->execute_select_command(sql_query, error);

Modified: trunk/glom/libglom/test_connectionpool.cc
==============================================================================
--- trunk/glom/libglom/test_connectionpool.cc	(original)
+++ trunk/glom/libglom/test_connectionpool.cc	Wed Dec 10 19:10:57 2008
@@ -26,7 +26,7 @@
 int
 main(int argc, char* argv[])
 {
-  Gnome::Gda::init("test", "0.1", argc, argv);
+  Gnome::Gda::init();
 
   Glib::RefPtr<Gnome::Gda::Connection> gdaconnection;
 

Modified: trunk/glom/libglom/utils.cc
==============================================================================
--- trunk/glom/libglom/utils.cc	(original)
+++ trunk/glom/libglom/utils.cc	Wed Dec 10 19:10:57 2008
@@ -472,10 +472,10 @@
 
   //std::cout << "get_choice_values: Executing SQL: " << sql_query << std::endl;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = connection->get_gda_connection()->execute_select_command(sql_query);
+  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = connection->get_gda_connection()->statement_execute_select(sql_query);
 #else
   std::auto_ptr<Glib::Error> error;
-  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = connection->get_gda_connection()->execute_select_command(sql_query, error);
+  Glib::RefPtr<Gnome::Gda::DataModel> datamodel = connection->get_gda_connection()->statement_execute_select(sql_query, error);
 #endif
 
   if(datamodel)

Modified: trunk/glom/main.cc
==============================================================================
--- trunk/glom/main.cc	(original)
+++ trunk/glom/main.cc	Wed Dec 10 19:10:57 2008
@@ -159,7 +159,7 @@
 
   g_thread_init(NULL); //So we can use GMutex.
 
-  Gnome::Gda::init("glom", VERSION, argc, argv);
+  Gnome::Gda::init();
 #ifdef GLOM_ENABLE_MAEMO
   Hildon::init();
 #endif

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	Wed Dec 10 19:10:57 2008
@@ -416,11 +416,11 @@
 
     //Unique:
     const bool bUnique = m_AddDel.get_value_as_bool(row, m_colUnique);
-    fieldInfo->set_unique_key(bUnique);
+    //TODO_gda: fieldInfo->set_unique_key(bUnique);
 
     //Primary Key:
     const bool bPrimaryKey = m_AddDel.get_value_as_bool(row, m_colPrimaryKey);
-    fieldInfo->set_primary_key(bPrimaryKey);
+    ///TODO_gda: fieldInfo->set_primary_key(bPrimaryKey);
 
     fieldInfo->set_g_type(fieldType);
 

Modified: trunk/glom/mode_design/fields/dialog_fielddefinition.cc
==============================================================================
--- trunk/glom/mode_design/fields/dialog_fielddefinition.cc	(original)
+++ trunk/glom/mode_design/fields/dialog_fielddefinition.cc	Wed Dec 10 19:10:57 2008
@@ -219,7 +219,10 @@
 sharedptr<Field> Dialog_FieldDefinition::get_field() const
 {
   sharedptr<Field> field = glom_sharedptr_clone(m_Field); //Start with the old details, to preserve anything that is not in our UI.
-
+  // const_cast is necessary and save here for the window (jhs)
+  sharedptr<SharedConnection> sharedcnc = connect_to_server(const_cast<Dialog_FieldDefinition*>(this));
+  Glib::RefPtr<Gnome::Gda::Connection> cnc = sharedcnc->get_gda_connection();
+  
   //Get the field info from the widgets:
 
   Glib::RefPtr<Gnome::Gda::Column> fieldInfo = field->get_field_info(); //Preserve previous information.
@@ -228,8 +231,8 @@
 
   fieldInfo->set_g_type( Field::get_gda_type_for_glom_type( m_pCombo_Type->get_field_type() ) );
 
-  fieldInfo->set_unique_key(m_pCheck_Unique->get_active());
-  fieldInfo->set_primary_key(m_pCheck_PrimaryKey->get_active());
+  //TODO_gda: fieldInfo->set_unique_key(m_pCheck_Unique->get_active());
+  //TODO_gda: fieldInfo->set_primary_key(m_pCheck_PrimaryKey->get_active());
   fieldInfo->set_auto_increment(m_pCheck_AutoIncrement->get_active());
 
   if(!fieldInfo->get_auto_increment()) //Ignore default_values for auto_increment fields - it's just some obscure postgres code.

Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	(original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	Wed Dec 10 19:10:57 2008
@@ -264,19 +264,19 @@
     {
       Glib::RefPtr<Gnome::Gda::DataModelIter> iter = model.m_gda_datamodel->create_iter();
       if(iter) {
-        iter->set_at_row(row);
+        iter->move_at_row(row);
 
         //It is a row from the database;
         const int cols_count = model.m_data_model_columns_count;
         for(int i = 0; i < cols_count; ++i)
         {
-          Glib::RefPtr<Gnome::Gda::Parameter> param = iter->get_param_for_column(i);
-          m_db_values[i] = param->get_value();
+          Glib::RefPtr<Gnome::Gda::Holder> holder = iter->get_holder_for_field(i);
+          m_db_values[i] = holder->get_value();
           //std::cout << "  debug: col=" << i << ", GType=" << m_db_values[i].get_value_type() << std::endl;
         }
 
-        Glib::RefPtr<Gnome::Gda::Parameter> param = iter->get_param_for_column(model.m_column_index_key);
-        m_key = param->get_value();
+        Glib::RefPtr<Gnome::Gda::Holder> holder = iter->get_holder_for_field(model.m_column_index_key);
+        m_key = holder->get_value();
 
         m_extra = false;
         m_removed = false;
@@ -464,17 +464,20 @@
       }
 #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
-
+    Glib::RefPtr<Gnome::Gda::SqlParser> parser = m_connection->get_gda_connection()->create_parser();
+    Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string (sql_query);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
       //Specify the ITER_MODEL_ONLY parameter, so that libgda only gets the rows that we actually use.
-      Glib::RefPtr<Gnome::Gda::ParameterList> params = Gnome::Gda::ParameterList::create();
       Gnome::Gda::Value value;
       value.set(true);
-      params->add_parameter("ITER_MODEL_ONLY", value);
-
-      m_gda_datamodel = m_connection->get_gda_connection()->execute_select_command(sql_query, params);
+      Glib::RefPtr<Gnome::Gda::Holder> holder = Gnome::Gda::Holder::create(G_TYPE_BOOLEAN, "iter_model_only");
+      holder->set_attribute("ITER_MODEL_ONLY", value);
+      Glib::RefPtr<Gnome::Gda::Set> set = Gnome::Gda::Set::create();
+      set->add_holder (holder);
+      
+      m_gda_datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, set);
 
       if(app && app->get_show_sql_debug())
         std::cout << "  Debug: DbTreeModel::refresh_from_database(): The query execution has finished." << std::endl;
@@ -500,7 +503,7 @@
     }
 #else
     std::auto_ptr<Glib::Error> error;
-    m_gda_datamodel = m_connection->get_gda_connection()->execute_select_command(sql_query, error);
+    m_gda_datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, set, error);
     if(error.get())
     {
       m_gda_datamodel.clear(); //So that it is 0, so we can handle it below.
@@ -1125,11 +1128,13 @@
       //Ask the database how many records there are in the whole table:
       //TODO: Apparently, this is very slow:
       const Glib::ustring sql_query = "SELECT count(*) FROM \"" + m_found_set.m_table_name + "\"";
+      Glib::RefPtr<Gnome::Gda::SqlParser> parser = m_connection->get_gda_connection()->create_parser();
+      Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string (sql_query);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-      Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->execute_select_command(sql_query);
+      Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt);
 #else
       std::auto_ptr<Glib::Error> error;
-      Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->execute_select_command(sql_query, error);
+      Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, error);
       // Ignore error, datamodel presence is checked below
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 

Modified: trunk/regression_tests/test_parsing_time.cc
==============================================================================
--- trunk/regression_tests/test_parsing_time.cc	(original)
+++ trunk/regression_tests/test_parsing_time.cc	Wed Dec 10 19:10:57 2008
@@ -2,7 +2,7 @@
 
 int main(int argc, char* argv[])
 {
-  Gnome::Gda::init("test", "1.0", argc, argv);
+  Gnome::Gda::init();
 
   const Glib::ustring time_text_input = "01:00 PM";
   std::cout << "time_text_input=" << time_text_input << std::endl;



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