Opened 20 years ago

Closed 17 years ago

#480 closed defect (fixed)

[MapScript] QueryByAttributes() requires qitem arg even if unused

Reported by: dmorissette Owned by: mapserverbugs
Priority: high Milestone: 5.0 release
Component: MapScript-PHP Version: 4.1
Severity: normal Keywords:
Cc: mapserver@…

Description (last modified by dmorissette)

It seems that MapScript's QueryByAttributes() (v4.0) requires a non-empty value
for the qitem field even if you use a logical expression which doesn't need a qitem.

Here is the problem report from the mailing list:

-------- Original Message --------
Subject: AW: AW: [Mapserver-users] PHP/Mapscript - Mapserver 4.0 -
$oLayer->queryByAttributes()
Date: Wed, 12 Nov 2003 09:52:20 +0100
From: Alexander Gabriel <alexander.gabriel@blubbermania.com>
To: Mapserver List <mapserver-users@lists.gis.umn.edu>
CC: Daniel Morissette <morissette@dmsolutions.ca>

Hi,

[code]
$query = '([GEMARKUNG] = 7725 AND [FLUR] = 0 AND \'[FLSTNR]\' = \'3000\')';
@$myLayer->queryByAttributes("ANYVALIDITEMINTHESHAPE", $query, MS_MULTIPLE);
[/code]

works.
But is that really the way it should be?
I'd say, this is just a workaround but i don't know C and cannot say, if it
is intent to give the method any dummy-values if they aren't needed.

perhaps someone makes a patch to fix this.

thx
Alexander Gabriel



-----Ursprungliche Nachricht-----
Von: Daniel Morissette [mailto:morissette@dmsolutions.ca]
Gesendet: Freitag, 31. Oktober 2003 20:27
An: Alexander Gabriel
Cc: mapserver-users@lists.gis.umn.edu
Betreff: Re: AW: [Mapserver-users] PHP/Mapscript - Mapserver 4.0 -
$oLayer->queryByAttributes()


Alexander Gabriel wrote:
> Hello,
>
> thx for your reply.
> i've tried
>
> [code]
> $query = '([GEMARKUNG] = 7725 AND [FLUR] = 0 AND \'[FLSTNR]\' =
\'3000\')';
> @$myLayer->queryByAttributes("", $query, MS_MULTIPLE);
> [/code]
>
> But it didn't work :(
>

Change History (4)

comment:1 by sdlime, 20 years ago

Status: newassigned
Hmmmm... The CGI doesn't require it. I'll fix it. Should be able to set to NULL 
in whatever scripting language you use.

comment:2 by mapserver@…, 20 years ago

Cc: mapserver@… added

comment:3 by dmorissette, 20 years ago

Milestone: 4.4 release

comment:4 by dmorissette, 17 years ago

Description: modified (diff)
Resolution: fixed
Status: assignedclosed

Steve had fixed msQueryByAttributes() to accept qitem=NULL, but MapScript passes an empty string, so I have fixed msQueryByAttributes() to treat an non-NULL but empty qitem the same way and the error goes away.

Fixed in r6600.

Note: See TracTickets for help on using tickets.