glom r1799 - in trunk: . glom glom/libglom/data_structure
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1799 - in trunk: . glom glom/libglom/data_structure
- Date: Fri, 12 Dec 2008 02:45:48 +0000 (UTC)
Author: murrayc
Date: Fri Dec 12 02:45:48 2008
New Revision: 1799
URL: http://svn.gnome.org/viewvc/glom?rev=1799&view=rev
Log:
2008-12-12 Murray Cumming <murrayc murrayc com>
* glom/libglom/data_structure/fieldtypes.cc: Constructor,
* glom/base_db.cc: get_fields_for_table_from_database():
Use the new get_meta_store_data() method overload with no filter
parameter to simplify the code slightly.
Add debug output to show how often we call update_meta_store() and
how awfully slow it is.
Modified:
trunk/ChangeLog
trunk/glom/base_db.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 02:45:48 2008
@@ -290,14 +290,15 @@
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_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, empty_filter_list);
+ Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES);
#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, empty_filter_list, error);
+ Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, error);
// Ignore error, data_model_tables presence is checked below
#endif
+
if(data_model_tables && (data_model_tables->get_n_columns() == 0))
{
std::cerr << "Base_DB_Table::get_table_names_from_database(): libgda reported 0 tables for the database." << std::endl;
@@ -455,17 +456,26 @@
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);
+ 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())
+ {
+ 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))
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)
{
@@ -473,7 +483,7 @@
}
else if(data_model_fields->get_n_columns() == 0)
{
- std::cerr << "BBase_DB::get_fields_for_table_from_database(): libgda reported 0 fields for the table." << std::endl;
+ std::cerr << "Base_DB::get_fields_for_table_from_database(): libgda reported 0 fields for the table." << std::endl;
}
else if(data_model_fields->get_n_rows() == 0)
{
@@ -501,7 +511,7 @@
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 type_string = value_fieldtype.get_string();
+ const 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);
}
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 02:45:48 2008
@@ -40,22 +40,23 @@
if(gda_connection && gda_connection->is_opened())
{
- 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
if (gda_connection->update_meta_store())
- data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES, filters);
+ data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES);
#else
std::auto_ptr<Glib::Error> error;
if (gda_connection->update_meta_store(error))
- data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES, filters, error);
+ data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES, 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_meta_store_data(Gnome::Gda::CONNECTION_META_TYPES) failed." << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]