You are here: Foswiki>Tasks Web>Item11502 (11 Apr 2012, GeorgeClark)Edit Attach

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

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Engine
Component: QUERY
Branches: Release01x01 trunk
Reported By: KipLubliner
Waiting For:
Last Change By: GeorgeClark
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 Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy