[glom/modification: 33/33] Corrected merge, hopefully, though git is generally being weird.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom/modification: 33/33] Corrected merge, hopefully, though git is generally being weird.
- Date: Thu, 4 Jun 2009 17:02:06 -0400 (EDT)
commit 666b1083040c04b328b4281b2d6527cb610e9b5d
Merge: 2e9b33e... 0b8e2a0...
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jun 4 23:00:49 2009 +0200
Corrected merge, hopefully, though git is generally being weird.
ChangeLog | 23 +++++++++++++++++++++++
glom/base_db.cc | 3 +--
glom/base_db.h | 1 -
3 files changed, 24 insertions(+), 3 deletions(-)
diff --cc ChangeLog
index 62677b5,65883fe..02e490c
--- a/ChangeLog
+++ b/ChangeLog
@@@ -185,8 -6,31 +185,31 @@@
Added private update_go_to_details_button_sensitivity() method and
called it whenever the value is changed by the user or set via
set_value(). Fixes bug #565023.
+ record_new(): Take a table_name.
+
+ * glom/base_db_table_data.[h|cc]: record_new(): Take a table_name,
+ so we can use this to add related records too, to make sure we get all
+ the necessary default values, lookups, calculatoins, and extra field
+ values, and generally reduce duplication.
+ add_related_record_for_field():
+ * glom/dialog_import_csv_progress.cc: on_idle_import():
+ * glom/mode_data/box_data_details.cc: on_button_new(),
+ on_flowtable_field_edited():
+ * glom/utility_widgets/db_adddel/db_adddel.cc: user_added(): Adapt.
+
+ 2009-05-07 Murray Cumming <murrayc murrayc-x61>
+
+ Tables now have creation and modification fields, appropriately set.
+
+ * glom/base_db.[h|cc]: Added static m_extra_modification_field_values,
+ to store the field information for the extra modification fields, filled in
+ init_extra_modification_fields.
+ set_field_value_in_database(): Also set the extra modification field
+ values.
+ * glom/base_db_table_data.cc: record_new(): Set values for the extra
+ creation fields, and show them if they are on the layout.
-2009-05-07 Murray Cumming <murrayc murrayc-x61>
+2009-05-07 Murray Cumming <murrayc murrayc com>
Allow non-network-shared connections when using IPv6.
diff --cc glom/base_db.cc
index 5e4f29c,41c92a9..646fe4d
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@@ -1590,6 -1590,36 +1590,7 @@@ Glib::RefPtr<Gnome::Gda::Connection> Ba
}
-/** A predicate for use with std::find_if() to find a std::pair whose
- * first item is the same field.
- */
-class predicate_pair_has_field
-{
-public:
- predicate_pair_has_field(const sharedptr<const Field>& field)
- {
- m_field = field;
- }
-
- template <class T_Second>
- bool operator() (const std::pair<sharedptr<Field>, T_Second>& element)
- {
- sharedptr<Field> field = element.first;
-
- if(!field && !m_field)
- return true;
-
- if(!field || !m_field)
- return false;
-
- //TODO: Check more than just the name:
- return (m_field->get_name() == field->get_name());
- }
-
-private:
- sharedptr<const Field> m_field;
-};
+
bool Base_DB::record_new(const Glib::ustring& table_name, const Gnome::Gda::Value& primary_key_value, const type_field_values& field_values)
{
sharedptr<const Field> fieldPrimaryKey = get_field_primary_key_for_table(table_name);
@@@ -2735,7 -2765,7 +2736,6 @@@ bool Base_DB::set_field_value_in_databa
if(field_name.empty()) //This should not happen.
return false;
--
Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
params->add_holder(field_in_record.m_field->get_holder(field_value));
params->add_holder(field_in_record.m_key->get_holder(field_in_record.m_key_value));
@@@ -2744,7 -2774,7 +2744,6 @@@
Glib::ustring strQuery = "UPDATE \"" + field_in_record.m_table_name + "\"";
strQuery += " SET \"" + field_name + "\" = " + field_in_record.m_field->get_gda_holder_string();
--
//Set these extra fields too, each time we change a value:
//We check for existence because the user may delete these fields:
//TODO: Only do this if not using Postgres?
diff --cc glom/base_db.h
index cf4665e,7461473..ea4aa8b
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@@ -423,43 -423,8 +423,42 @@@ private
/// Fill m_extra_field_values with the extra field definitions.
void init_extra_modification_fields();
+ //TODO: This probably shouldn't be here, but is needed because
+ //record_new() calls methods that need to data that is entered in the UI.
+ virtual Gtk::TreeModel::iterator get_row_selected();
+
protected:
+/** A predicate for use with std::find_if() to find a std::pair whose
+ * first item is the same field.
+ */
+class predicate_pair_has_field
+{
+public:
+ predicate_pair_has_field(const sharedptr<const Field>& field)
+ {
+ m_field = field;
+ }
+
+ template <class T_Second>
+ bool operator() (const std::pair<sharedptr<const Field>, T_Second>& element)
+ {
+ sharedptr<const Field> field = element.first;
+
+ if(!field && !m_field)
+ return true;
+
+ if(!field || !m_field)
+ return false;
+
+ //TODO: Check more than just the name:
+ return (m_field->get_name() == field->get_name());
+ }
+
+private:
+ sharedptr<const Field> m_field;
+};
+
-
type_field_calcs m_FieldsCalculationInProgress; //Prevent circular calculations and recalculations.
//Extra creation/modification fields to set:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]