glom r1825 - in trunk: . glom glom/mode_design/fields



Author: murrayc
Date: Mon Dec 22 11:47:21 2008
New Revision: 1825
URL: http://svn.gnome.org/viewvc/glom?rev=1825&view=rev

Log:
2008-12-22  Murray Cumming  <murrayc murrayc com>

* glom/base_db.h: Documented two methods.
* glom/mode_design/fields/box_db_table_definition.cc: on_adddel_changed():
Warn on stdcerr if the newly-added field seems unknown to the database, 
showing that the GdaMetaStore is not being updated automatically.

Modified:
   trunk/ChangeLog
   trunk/glom/base_db.h
   trunk/glom/mode_design/fields/box_db_table_definition.cc

Modified: trunk/glom/base_db.h
==============================================================================
--- trunk/glom/base_db.h	(original)
+++ trunk/glom/base_db.h	Mon Dec 22 11:47:21 2008
@@ -126,7 +126,20 @@
   bool get_table_exists_in_database(const Glib::ustring& table_name) const;
   bool get_relationship_exists(const Glib::ustring& table_name, const Glib::ustring& relationship_name);
 
+  /** Get all the fields for a table, including any from the datasbase that are not yet known in the document.
+   *
+   * @param table_name The name of the table whose fields should be listed.
+   * @param including_system_fields Whether extra non-user-visible fields should be included in the list.
+   * @result A list of fields.
+   */
   type_vecFields get_fields_for_table(const Glib::ustring& table_name, bool including_system_fields = false) const;
+
+  /** Get a single field definition for a table, even if the field is in the datasbase but not yet known in the document.
+   *
+   * @param table_name The name of the table whose fields should be listed.
+   * @param field_name The name of the field for which to get the definition.
+   * @result The field definition.
+   */
   sharedptr<Field> get_fields_for_table_one_field(const Glib::ustring& table_name, const Glib::ustring& field_name) const;
 
   sharedptr<Field> get_field_primary_key_for_table(const Glib::ustring& table_name) const;

Modified: trunk/glom/mode_design/fields/box_db_table_definition.cc
==============================================================================
--- trunk/glom/mode_design/fields/box_db_table_definition.cc	(original)
+++ trunk/glom/mode_design/fields/box_db_table_definition.cc	Mon Dec 22 11:47:21 2008
@@ -170,6 +170,7 @@
     {
       //Show the new field (fill in the other cells):
 
+      //Update our list of database fields.
       fill_fields();
 
       //fill_from_database(); //We cannot change the structure in a cell renderer signal handler.
@@ -323,7 +324,9 @@
 
     //Get DB field info: (TODO: This might be unnecessary).
     type_vecFields::const_iterator iterFind = std::find_if( m_vecFields.begin(), m_vecFields.end(), predicate_FieldHasName<Field>(strFieldNameBeingEdited) );
-    if(iterFind != m_vecFields.end()) //If it was found:
+    if(iterFind == m_vecFields.end()) //If it was not found:
+      std::cerr << "Box_DB_Table_Definition::on_adddel_changed(): field not found." << std::endl;
+    else
     {
       sharedptr<const Field> constfield = *iterFind;
       m_Field_BeingEdited = constfield;
@@ -586,6 +589,7 @@
 
 void Box_DB_Table_Definition::fill_fields()
 {
+  //Update the fields (also checking the actual database):
   m_vecFields = get_fields_for_table(m_table_name);
 }
 



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