NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use trunk.foswiki.org to view this page for some minimal testing.
Use Item9693 for docu changes for 1.2 and 2.0.

Item11502: %QUERY containing where clause can fail if only one item is being examined

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine QUERY  
I traced the bug in OP_where.pm in the 1.1 release branch. The version of this file in trunk did not have this bug. Here is an example:

%QUERY{"'Testweb.DeadHerring'/META:FIELD[name='Wibble'].value"}%

Instead of returning the value of the field, it returns the string "value".

-- KipLubliner - 04 Feb 2012

I'm running "Foswiki version Foswiki-1.1.4, Tue, 20 Dec 2011, build 13483, Plugin API version 2.1" I have a similar issue:
 %QUERY{"'TopicWithOneAttachment'/attachments[0].comment"}% 
Returns the string "comment" instead of the actual comment. When there is more than one attachment in the source topic however, the above works correctly.

-- NigelWinterbottom - 13 Mar 2012

This is fixed in Foswiki 1.1.5, which isn't released yet. You can try replacing your copy of OP_where.pm with the current version in SVN, assuming this file is compatible with Foswiki 1.1.4 (I'm sure it is, but I haven't tested).

-- PaulHarvey - 14 Mar 2012

The changes were minimal (a single line)
www-data@foswiki:/var/www/foswiki/lib/Foswiki/Query$ diff OP_where.pm /home/foswiki/OP_where.pm
48c48
<         return $b->evaluate( data => $lval, tom => $domain{tom} );
---
>         return $b->evaluate( data => $lval, tom => $domain{tom} ) ? $lval : [];
I replaced the file and have to report that the above example still does not work; it returns a null string instead of the actual comment.

I tried OP_where.pm & OP.pm from trunk and can report that the above example does work as expected.

Flipping CurrentState back to New because this Item is not fixed in Foswiki 1.1.5

-- NigelWinterbottom - 26 Mar 2012

Confirmed - this is still broken on 1.1.5RC2.

Note that the attachments issue is a different problem, covered by Item11730.

-- GeorgeClark - 05 Apr 2012

changed state back to Waiting for Release - this patch fixes the problem in the case of a where clause that needs to be evaluated. Item11730 is the case of a where clause that is an array index.

-- KipLubliner - 06 Apr 2012
 
Topic revision: r15 - 11 Apr 2012, GeorgeClark
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads