[glom] test_fake_connection: Avoid unnecessary warnings about metadata.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_fake_connection: Avoid unnecessary warnings about metadata.
- Date: Thu, 8 Dec 2011 20:36:49 +0000 (UTC)
commit f63c2146b3a579eb5056382c898d33186724bb10
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Dec 8 21:36:39 2011 +0100
test_fake_connection: Avoid unnecessary warnings about metadata.
* glom/libglom/connectionpool.cc: Avoid printing exceptions to stderr
about failed attempts to get types and tables metadata, because
this is not used by fake connections, for instance by java-libglom.
There will be a warning later if it is really used.
* glom/libglom/db_utils.cc: Add some comments.
ChangeLog | 10 ++++++++++
glom/libglom/connectionpool.cc | 24 +++++++++++++++++++++---
glom/libglom/db_utils.cc | 3 +++
3 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a3da1c6..7eb6936 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-12-08 Murray Cumming <murrayc murrayc com>
+ test_fake_connection: Avoid unnecessary warnings about metadata.
+
+ * glom/libglom/connectionpool.cc: Avoid printing exceptions to stderr
+ about failed attempts to get types and tables metadata, because
+ this is not used by fake connections, for instance by java-libglom.
+ There will be a warning later if it is really used.
+ * glom/libglom/db_utils.cc: Add some comments.
+
+2011-12-08 Murray Cumming <murrayc murrayc com>
+
Document: Clarify that set_file_uri() does not trigger a save.
* glom/libglom/document/document.[h|cc]: set_file_uri(): The check for
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 01deaed..56e4fc0 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -324,7 +324,13 @@ sharedptr<SharedConnection> ConnectionPool::connect()
}
catch(const Glib::Error& ex)
{
- std::cerr << G_STRFUNC << ": update_meta_store_data_types() failed: " << ex.what() << std::endl;
+ //If the conneciton was not opened, because it is a fake connection,
+ //then we should not be surprised that this fails,
+ //and a warning will only be useful later when get_meta_store_data() fails when used in FieldTypes, from Field::set_*().
+ if(!m_fake_connection)
+ {
+ std::cerr << G_STRFUNC << ": update_meta_store_data_types() failed: " << ex.what() << std::endl;
+ }
}
//std::cout << "DEBUG: ... update_meta_store_data_types() has finished." << std::endl;
@@ -338,7 +344,13 @@ sharedptr<SharedConnection> ConnectionPool::connect()
}
catch(const Glib::Error& ex)
{
- std::cerr << G_STRFUNC << ": update_meta_store_table_names() failed: " << ex.what() << std::endl;
+ //If the conneciton was not opened, because it is a fake connection,
+ //then we should not be surprised that this fails,
+ //and a warning will only be useful later when get_meta_store_data() fails when used in get_table_names_from_database().
+ if(!m_fake_connection)
+ {
+ std::cerr << G_STRFUNC << ": update_meta_store_table_names() failed: " << ex.what() << std::endl;
+ }
}
//std::cout << "DEBUG: ... update_meta_store_table_names() has finished." << std::endl;
@@ -439,7 +451,13 @@ bool ConnectionPool::convert_backup(const SlotProgress& slot_progress, const std
}
catch(const Glib::Error& ex)
{
- std::cerr << "ConnectionPool::connect(): update_meta_store_table_names() failed: " << ex.what() << std::endl;
+ //If the conneciton was not opened, because it is a fake connection,
+ //then we should not be surprised that this fails,
+ //and a warning will only be useful later when get_meta_store_data() fails when used in get_table_names_from_database().
+ if(!m_fake_connection)
+ {
+ std::cerr << "ConnectionPool::connect(): update_meta_store_table_names() failed: " << ex.what() << std::endl;
+ }
}
return result;
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 69c82f1..0fb48f6 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -840,6 +840,8 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields;
try
{
+ //This should work because we called update_meta_store_tables() in ConnectionPool,
+ //and that gets the tables' fields too.
data_model_fields = connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_FIELDS, holder_list);
}
catch(const Gnome::Gda::MetaStoreError& ex)
@@ -1052,6 +1054,7 @@ type_vec_strings get_table_names_from_database(bool ignore_system_tables)
Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables;
try
{
+ //This should work because we called update_meta_store_tables() in ConnectionPool.
data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES);
}
catch(const Gnome::Gda::MetaStoreError& ex)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]