You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2017/08/18 17:32:33 UTC
svn commit: r1805449 - in /tcl/rivet/trunk: ChangeLog
rivet/packages/dio/dio.tcl
Author: mxmanghi
Date: Fri Aug 18 17:32:33 2017
New Revision: 1805449
URL: http://svn.apache.org/viewvc?rev=1805449&view=rev
Log:
* rivet/packages/dio/dio.tcl: method build_where_clause treated
single value key differently, but this failed to remove braces
for the representation of a single element list containing space
characters. The method has been changed the have an uniform
way to handle this
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/rivet/packages/dio/dio.tcl
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1805449&r1=1805448&r2=1805449&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Fri Aug 18 17:32:33 2017
@@ -1,3 +1,10 @@
+2017-08-18 Massimo Manghi <mx...@apache.org>
+ * rivet/packages/dio/dio.tcl: method build_where_clause treated
+ single value key differently, but this failed to remove braces
+ for the representation of a single element list containing space
+ characters. The method has been changed the have an uniform
+ way to handle this
+
2017-08-07 Massimo Manghi <mx...@apache.org>
* src/mod_rivet_ng/mod_rivet.c: Rivet_ServerInit is now implementing
the recommended mechanism to avoid the double load of external
Modified: tcl/rivet/trunk/rivet/packages/dio/dio.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/dio/dio.tcl?rev=1805449&r1=1805448&r2=1805449&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/packages/dio/dio.tcl (original)
+++ tcl/rivet/trunk/rivet/packages/dio/dio.tcl Fri Aug 18 17:32:33 2017
@@ -232,18 +232,24 @@ proc handle {interface args} {
# together.
#
protected method build_key_where_clause {myKeyfield myKey} {
- ## If we're not using multiple keyfields, just return a simple
- ## where clause.
- if {[llength $myKeyfield] < 2} {
- return " WHERE $myKeyfield = [makeDBFieldValue $table $myKeyfield $myKey]"
- }
- # multiple fields, construct it as a where-and
- set req " WHERE 1 = 1"
- foreach field $myKeyfield key $myKey {
- append req " AND $field = [makeDBFieldValue $table $field $key]"
+ # rewritten from scratch abandoning
+ # the former approach that treated single
+ # element keys differently (anche missing the
+ # correct handling of single element lists) and
+ # also generating a clean WHERE clause
+ #
+ # mxmanghi 18/08/2017
+
+ set keyvalue_conditions {}
+
+ while {([llength $myKeyfield] > 0) && ([llength $myKey] > 0)} {
+ set myKeyfield [lassign $myKeyfield field]
+ set myKey [lassign $myKey key]
+ lappend keyvalue_conditions "$field = [makeDBFieldValue $table $field $key]"
}
- return $req
+
+ return [format " WHERE %s;" [join $keyvalue_conditions " AND "]]
}
##
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org