glom r1806 - in trunk: . glom glom/libglom/document
- From: arminb svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1806 - in trunk: . glom glom/libglom/document
- Date: Mon, 15 Dec 2008 19:32:21 +0000 (UTC)
Author: arminb
Date: Mon Dec 15 19:32:20 2008
New Revision: 1806
URL: http://svn.gnome.org/viewvc/glom?rev=1806&view=rev
Log:
2008-12-15 Armin Burgmeier <armin openismus com>
* glom/libglom/document/document_glom.cc (set_table_fields): Fixed
logic so that the document is set to be modified when the new fields
differ from the old fields, not when they compare equal.
* glom/libglom/document/document_glom.h: Also copy the m_info member
in DocumentTableInfo's copy constructor and assignment operator.
* glom/base_db.cc: Update the libgda meta store after having created a
new table, so that get_fields_for_table_from_database works correctly
for the new table. These changes fix creating new tables.
Modified:
trunk/ChangeLog
trunk/glom/base_db.cc
trunk/glom/libglom/document/document_glom.cc
trunk/glom/libglom/document/document_glom.h
Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc (original)
+++ trunk/glom/base_db.cc Mon Dec 15 19:32:20 2008
@@ -1114,6 +1114,41 @@
document->add_table(table_info);
document->set_table_fields(table_info->get_name(), fields);
}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ sharedptr<SharedConnection> sharedconnection = connect_to_server();
+#else
+ std::auto_ptr<ExceptionConnection> error;
+ sharedptr<SharedConnection> sharedconnection = connect_to_server(0, error);
+ // TODO: Rethrow?
+#endif
+
+ if(!sharedconnection)
+ {
+ g_warning("Base_DB::create_table_with_default_fields: connection failed.");
+ }
+ else
+ {
+
+ // Update meta store, so that get_fields_for_table_from_database
+ // returns the fields correctly for the new table.
+ sharedconnection->get_gda_connection()->update_meta_store();
+
+ // Don't do full update_meta_store() here because that's too slow.
+ // TODO: Maybe we should create the table directly via libgda instead of
+ // executing an SQL query ourselves, so that libgda has the chance to
+ // do this meta store update automatically.
+ // TODO: This doesn't work:
+#if 0
+ GdaMetaContext context;
+ context.table_name = const_cast<char*>(table_name.c_str());
+ context.size = 0;
+ context.column_names = NULL;
+ context.column_values = NULL;
+
+ gda_connection_update_meta_store(sharedconnection->get_gda_connection()->gobj(), &context, NULL);
+#endif
+ }
}
return created;
Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc (original)
+++ trunk/glom/libglom/document/document_glom.cc Mon Dec 15 19:32:20 2008
@@ -811,7 +811,7 @@
}
DocumentTableInfo& info = get_table_info_with_add(table_name);
- const bool will_change = (info.m_fields == vecFields); //TODO: Does this do a deep comparison?
+ const bool will_change = (info.m_fields != vecFields); //TODO: Does this do a deep comparison?
info.m_fields = vecFields;
set_modified(will_change);
Modified: trunk/glom/libglom/document/document_glom.h
==============================================================================
--- trunk/glom/libglom/document/document_glom.h (original)
+++ trunk/glom/libglom/document/document_glom.h Mon Dec 15 19:32:20 2008
@@ -494,7 +494,8 @@
//TODO: Avoid the use of this:
DocumentTableInfo(const DocumentTableInfo& src)
- : m_fields(src.m_fields),
+ : m_info(src.m_info),
+ m_fields(src.m_fields),
m_relationships(src.m_relationships),
m_layouts(src.m_layouts),
m_reports(src.m_reports),
@@ -511,6 +512,7 @@
//TODO: Avoid the use of this:
DocumentTableInfo& operator=(const DocumentTableInfo& src)
{
+ m_info = src.m_info;
m_fields = src.m_fields;
m_relationships = src.m_relationships;
m_layouts = src.m_layouts;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]