[glom] Catch libgda meta-store exceptions.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom] Catch libgda meta-store exceptions.
- Date: Mon, 6 Jul 2009 23:55:34 +0000 (UTC)
commit e7fc57523b1390480ffb9311473a3956302ba5df
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jul 7 01:55:14 2009 +0200
Catch libgda meta-store exceptions.
* glom/base_db.cc: get_table_names_from_database():
* glom/libglom/connectionpool.cc: connect(): Added try/catch around
calls to Gda::Connection::update_meta_store_*() because they now
throw a MetaStoreError exception, though we do not know why yet.
ChangeLog | 9 +++++++++
glom/base_db.cc | 29 ++++++++++++++++++++++++-----
glom/libglom/connectionpool.cc | 11 +++++++++--
3 files changed, 42 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 27788da..0e500ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-07 Murray Cumming <murrayc murrayc-x61>
+
+ Catch libgda meta-store exceptions.
+
+ * glom/base_db.cc: get_table_names_from_database():
+ * glom/libglom/connectionpool.cc: connect(): Added try/catch around
+ calls to Gda::Connection::update_meta_store_*() because they now
+ throw a MetaStoreError exception, though we do not know why yet.
+
2009-07-05 Murray Cumming <murrayc murrayc com>
* glom/dialog_existing_or_new.h: #include config.h to avoid a crash
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 7a9ad96..8fdb40b 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -51,7 +51,7 @@
#include <glibmm/i18n.h>
//#include <libgnomeui/gnome-app-helper.h>
-
+//#include <libgdamm/metastore.h> //For MetaStoreError
#include <sql-parser/gda-sql-parser.h> //For gda_sql_identifier_remove_quotes().
#ifdef GLOM_ENABLE_MAEMO
@@ -432,8 +432,20 @@ Base_DB::type_vec_strings Base_DB::get_table_names_from_database(bool ignore_sys
{
Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
+ Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES);
+ try
+ {
+ data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES);
+ }
+ catch(const Gnome::Gda::MetaStoreError& ex)
+ {
+ std::cerr << "Base_DB::get_table_names_from_database(): MetaStoreError: " << ex.what() << std::endl;
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << "Base_DB::get_table_names_from_database(): Error: " << ex.what() << std::endl;
+ }
#else
std::auto_ptr<Glib::Error> error;
Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, error);
@@ -644,14 +656,21 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- if(true) //Already done in ConnectionPool::connect(): connection->update_meta_store())
+ try
{
data_model_fields = connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_FIELDS, holder_list);
}
+ catch(const Gnome::Gda::MetaStoreError& ex)
+ {
+ std::cerr << "Base_DB::get_fields_for_table_from_database(): MetaStoreError: " << ex.what() << std::endl;
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << "Base_DB::get_fields_for_table_from_database(): Error: " << ex.what() << std::endl;
+ }
#else
std::auto_ptr<Glib::Error> 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);
+ 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
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 7c1aafa..550ec1e 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -382,7 +382,14 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
//Allow get_meta_store_data() to succeed:
//Hopefully this (and the update_meta_store_for_table() calls) is all we need.
//std::cout << "DEBUG: Calling update_meta_store_data_types() ..." << std::endl;
- m_refGdaConnection->update_meta_store_data_types();
+ try
+ {
+ m_refGdaConnection->update_meta_store_data_types();
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << "ConnectionPool::connect(): update_meta_store_data_types() failed: " << ex.what() << std::endl;
+ }
//std::cout << "DEBUG: ... update_meta_store_data_types() has finished." << std::endl;
//std::cout << "DEBUG: Calling update_meta_store_table_names() ..." << std::endl;
@@ -394,7 +401,7 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
}
catch(const Glib::Error& ex)
{
- std::cerr << "update_meta_store_table_names() failed: " << ex.what() << std::endl;
+ std::cerr << "ConnectionPool::connect(): update_meta_store_table_names() failed: " << ex.what() << std::endl;
}
//std::cout << "DEBUG: ... update_meta_store_table_names() has finished." << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]