glom r1800 - in trunk: . glom glom/libglom glom/libglom/data_structure



Author: murrayc
Date: Fri Dec 12 03:22:31 2008
New Revision: 1800
URL: http://svn.gnome.org/viewvc/glom?rev=1800&view=rev

Log:
2008-12-12  Murray Cumming  <murrayc murrayc com>

* glom/libglom/connectionpool.cc: connect(): Call update_meta_store() 
here.
* glom/libglom/data_structure/fieldtypes.cc: Constructor,
* glom/base_db.cc: get_fields_for_table_from_database(): Do not call 
update_meta_store() here, because ConnectionPool::connect() has 
already called it. This makes things faster but there is still some 
slowness.

Modified:
   trunk/ChangeLog
   trunk/glom/base_db.cc
   trunk/glom/libglom/connectionpool.cc
   trunk/glom/libglom/data_structure/fieldtypes.cc

Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc	(original)
+++ trunk/glom/base_db.cc	Fri Dec 12 03:22:31 2008
@@ -309,14 +309,14 @@
       const int rows = data_model_tables->get_n_rows();
       for(int i = 0; i < rows; ++i)
       {
-        Gnome::Gda::Value value = data_model_tables->get_value_at(0, i);
+        const 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;
+          std::cout << "DEBUG: Found table: " << table_name << std::endl;
 
           bool add_it = true;
 
@@ -459,22 +459,18 @@
     holder_list.push_back(holder_table_name);
 
     Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields;
-    std::cout << "DEBUG: Base_DB::get_fields_for_table_from_database(): Calling update_meta_store() ..." << std::endl;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    if (connection->update_meta_store())
+    if(true) //Already done in ConnectionPool::connect(): connection->update_meta_store())
     {
-      std::cout << "  DEBUG: Base_DB::get_fields_for_table_from_database(): Calling get_meta_store_data() ..." << std::endl;
       data_model_fields = connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_FIELDS, holder_list);
-      std::cout << "  DEBUG: ... get_meta_store_data() returned." << std::endl;
     }
 #else
     std::auto_ptr<Glib::Error> error;
-    if (connection->update_meta_store(error))
+    if(true) //Already done in ConnectionPool::connect(): 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
-    std::cout << "DEBUG: ... update_meta_store() returned." << std::endl;
 
 
     if(!data_model_fields)

Modified: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc	(original)
+++ trunk/glom/libglom/connectionpool.cc	Fri Dec 12 03:22:31 2008
@@ -352,11 +352,14 @@
       }
       else
       {
+        //Allow get_meta_store_data() to succeed:
+        m_refGdaConnection->update_meta_store();
+
         // Connection succeeded
-        //Create the fieldtypes member if it has not already been done:
+        // Create the fieldtypes member if it has not already been done:
         if(!m_pFieldTypes)
-          m_pFieldTypes = new FieldTypes(m_refGdaConnection);  
-
+          m_pFieldTypes = new FieldTypes(m_refGdaConnection);
+          
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 #ifndef G_OS_WIN32
         //Let other clients discover this server via avahi:
@@ -583,7 +586,7 @@
 #endif // !G_OS_WIN32
 
   //If we crash while running (unlikely, hopefully), then try to cleanup.
-  //previous_sig_handler = signal(SIGSEGV, &on_linux_signal);
+  previous_sig_handler = signal(SIGSEGV, &on_linux_signal);
 
   return true;
 }

Modified: trunk/glom/libglom/data_structure/fieldtypes.cc
==============================================================================
--- trunk/glom/libglom/data_structure/fieldtypes.cc	(original)
+++ trunk/glom/libglom/data_structure/fieldtypes.cc	Fri Dec 12 03:22:31 2008
@@ -42,9 +42,10 @@
   {
     //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>.
+    //This first call to update_meta_store() is also necessary for other calls to get_meta_store_data() elsewhere to succeed.
     Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    if (gda_connection->update_meta_store())
+    if(true) //Already done in ConnectionPool::connect(): gda_connection->update_meta_store())
       data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES);
 #else
     std::auto_ptr<Glib::Error> error;



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