[glom/glom-1-10] Speedup initial meta store update by only fetching public tables



commit 1a6ccf472c4a60a5437e556017594808efe975a1
Author: Armin Burgmeier <armin arbur net>
Date:   Wed May 20 23:14:43 2009 +0200

    Speedup initial meta store update by only fetching public tables
    
    	* glom/libglom/connectionpool_backends/backend.h:
    	* glom/libglom/connectionpool_backends/postgres.h:
    	* glom/libglom/connectionpool_backends/sqlite.h: Added
    	get_public_schema_name() virtual function and implementations for both
    	backends.
    
    	* glom/libglom/connectionpool.cc: Only update the meta store tables
    	for the public schema of the corresponding backend. This considerably
    	speeds up the initial meta store update. This requires latest libgdamm
    	from git.

 ChangeLog                                       |   13 ++
 glom/libglom/connectionpool.cc                  |   12 +-
 glom/libglom/connectionpool_backends/backend.h  |   12 ++
 glom/libglom/connectionpool_backends/postgres.h |    1 +
 glom/libglom/connectionpool_backends/sqlite.h   |    1 +
 po/Makefile.in.in                               |  217 -----------------------
 6 files changed, 33 insertions(+), 223 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 67575cb..318f991 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-05-20  Armin Burgmeier  <armin openismus com>
+
+	* glom/libglom/connectionpool_backends/backend.h:
+	* glom/libglom/connectionpool_backends/postgres.h:
+	* glom/libglom/connectionpool_backends/sqlite.h: Added
+	get_public_schema_name() virtual function and implementations for both
+	backends.
+
+	* glom/libglom/connectionpool.cc: Only update the meta store tables
+	for the public schema of the corresponding backend. This considerably
+	speeds up the initial meta store update. This requires latest libgdamm
+	from git.
+
 2009-07-10  Murray Cumming  <murrayc murrayc com>
 
 	Export: Don't open the format dialog behind the FileChooser dialog.
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 55533c9..11bea06 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -695,11 +695,11 @@ bool ConnectionPool::add_column(const Glib::ustring& table_name, const sharedptr
   const bool result = m_backend->add_column(m_refGdaConnection, table_name, field, error);
   if(error.get()) throw *error;
 
-  m_refGdaConnection->update_meta_store_table(table_name);
+  m_refGdaConnection->update_meta_store_table(table_name, m_backend->get_public_schema_name());
 #else
   const bool result = m_backend->add_column(m_refGdaConnection, table_name, field, error);
   if(result)
-    result = m_refGdaConnection->update_meta_store_table(table_name, error);
+    result = m_refGdaConnection->update_meta_store_table(table_name, m_backend->get_public_schema_name(), error);
 #endif
 
   return result;
@@ -732,11 +732,11 @@ bool ConnectionPool::drop_column(const Glib::ustring& table_name, const Glib::us
   const bool result = m_backend->drop_column(m_refGdaConnection, table_name, field_name, error);
   if(error.get()) throw *error;
 
-  m_refGdaConnection->update_meta_store_table(table_name);
+  m_refGdaConnection->update_meta_store_table(table_name, m_backend->get_public_schema_name());
 #else
   const bool result = m_backend->drop_column(m_refGdaConnection, table_name, field_name, error);
   if(result)
-    result = m_refGdaConnection->update_meta_store_table(table_name, error);
+    result = m_refGdaConnection->update_meta_store_table(table_name, m_backend->get_public_schema_name(), error);
 #endif
 
   return result;
@@ -785,11 +785,11 @@ bool ConnectionPool::change_columns(const Glib::ustring& table_name, const type_
   const bool result = m_backend->change_columns(m_refGdaConnection, table_name, old_fields, new_fields, error);
   if(error.get()) throw *error;
 
-  m_refGdaConnection->update_meta_store_table(table_name);
+  m_refGdaConnection->update_meta_store_table(table_name, m_backend->get_public_schema_name());
 #else
   const bool result = m_backend->change_columns(m_refGdaConnection, table_name, old_fields, new_fields, error);
   if(result)
-    result = m_refGdaConnection->update_meta_store_table(table_name, error);
+    result = m_refGdaConnection->update_meta_store_table(table_name, m_backend->get_public_schema_name(), error);
 #endif
 
   return result;
diff --git a/glom/libglom/connectionpool_backends/backend.h b/glom/libglom/connectionpool_backends/backend.h
index bd2192e..fdeb6b5 100644
--- a/glom/libglom/connectionpool_backends/backend.h
+++ b/glom/libglom/connectionpool_backends/backend.h
@@ -101,6 +101,18 @@ protected:
    */
   virtual Glib::ustring get_string_find_operator() const = 0;
 
+  /** This specifies the database schema which contains the non-internal
+   * tables. This is used to speedup the libgda meta store update by only
+   * updating the non-internal tables. libgda might later be able to do this
+   * without us specifying it explicitely. See #575235.
+   */
+  virtual const char* get_public_schema_name() const = 0;
+
+  /** This callback should show UI to indicate that work is still happening.
+   * For instance, a pulsing ProgressBar.
+   */
+  typedef sigc::slot<void> SlotProgress;
+  
   /** This method is called for one-time initialization of the database
    * storage. No need to implement this function if the data is centrally
    * hosted, not managed by Glom.
diff --git a/glom/libglom/connectionpool_backends/postgres.h b/glom/libglom/connectionpool_backends/postgres.h
index 7beabb2..9d3890c 100644
--- a/glom/libglom/connectionpool_backends/postgres.h
+++ b/glom/libglom/connectionpool_backends/postgres.h
@@ -60,6 +60,7 @@ private:
   virtual Field::sql_format get_sql_format() const { return Field::SQL_FORMAT_POSTGRES; }
   virtual bool supports_remote_access() const { return true; }
   virtual Glib::ustring get_string_find_operator() const { return "ILIKE"; } // ILIKE is a postgres extension for locale-dependent case-insensitive matches.
+  virtual const char* get_public_schema_name() const { return "public"; }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   virtual bool change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vecConstFields& old_fields, const type_vecConstFields& new_fields, std::auto_ptr<Glib::Error>& error);
diff --git a/glom/libglom/connectionpool_backends/sqlite.h b/glom/libglom/connectionpool_backends/sqlite.h
index f0a2f95..e4be503 100644
--- a/glom/libglom/connectionpool_backends/sqlite.h
+++ b/glom/libglom/connectionpool_backends/sqlite.h
@@ -48,6 +48,7 @@ private:
   virtual Field::sql_format get_sql_format() const { return Field::SQL_FORMAT_SQLITE; }
   virtual bool supports_remote_access() const { return false; }
   virtual Glib::ustring get_string_find_operator() const { return "LIKE"; }
+  virtual const char* get_public_schema_name() const { return "main"; }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, GdaMetaTableColumn* column, unsigned int i, std::auto_ptr<Glib::Error>& error);



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