[glom] Doubly-related Records: Correct the SQL.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom] Doubly-related Records: Correct the SQL.
- Date: Tue, 29 Sep 2009 21:06:38 +0000 (UTC)
commit ff38232e0519d13601de310a936963afbdfd5167
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Sep 29 23:06:23 2009 +0200
Doubly-related Records: Correct the SQL.
* glom/base_db.cc: set_found_set_where_clause_for_portal():
For doubly-related records, use the correct relationship for the GROUP BY to
avoid a SQL error about a non-existant field. We must have been lucky before.
However, we now need to fix the SQL error (maybe new in a recent PostgreSQL
version) about not mentioning all viewed fields in the GROUP BY.
ChangeLog | 11 +++++++++++
glom/base_db.cc | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e5b076c..9b9c9ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2009-09-29 Murray Cumming <murrayc murrayc com>
+ Doubly-related Records: Correct the SQL.
+
+ * glom/base_db.cc: set_found_set_where_clause_for_portal():
+ For doubly-related records, use the correct relationship for the GROUP BY to
+ avoid a SQL error about a non-existant field. We must have been lucky before.
+
+ However, we now need to fix the SQL error (maybe new in a recent PostgreSQL
+ version) about not mentioning all viewed fields in the GROUP BY.
+
+2009-09-29 Murray Cumming <murrayc murrayc com>
+
Design: Related Records Portal: Prevent use of inappropriate relationships.
* glom/mode_design/layout/dialog_layout_list_related.cc:
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 07dfa96..b9e2143 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -3474,7 +3474,7 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
found_set.m_extra_join = "LEFT OUTER JOIN \"" + relationship->get_to_table() + "\" AS \"" + uses_rel_temp->get_sql_join_alias_name() + "\" ON (\"" + uses_rel_temp->get_sql_join_alias_name() + "\".\"" + relationship_related->get_from_field() + "\" = \"" + relationship_related->get_to_table() + "\".\"" + relationship_related->get_to_field() + "\")";
//Add an extra GROUP BY to ensure that we get no repeated records from the doubly-related table:
- sharedptr<Field> to_table_primary_key = get_field_primary_key_for_table( relationship->get_to_table() );
+ sharedptr<Field> to_table_primary_key = get_field_primary_key_for_table( relationship_related->get_to_table() );
if(to_table_primary_key)
found_set.m_extra_group_by = "GROUP BY \"" + found_set.m_table_name + "\".\"" + to_table_primary_key->get_name() + "\"";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]