id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
957	msQueryByAttributes monkey's with a layer's filter causing a segfault	hobu	sdlime	"{{{
I don't know if this is a bug or a feature, but here is what was provoking my
problem.

I have a layer that has null attributes in it.  This layer is in SDE.  I have a
filter defined to FILTER ""where COUNT_ is not NULL"" to prevent it from querying
out <null> values that cause the expression parser to choke.

So, once this is done, I want to be able to queryByAttributes from the layer as
well.  This time, however, I'm querying from the STATE column.  When I attempt
to do this from mapscript with a layer that already has its FILTER set, a
segfault erupts.

Am I misusing FILTER's?
---------------------------------------------------
Python script that provokes the error:
---------------------------------------------------
#!/usr/bin/python
import mapscript
amap = mapscript.mapObj('/home/hobu/prs/prs.map')
counties = amap.getLayerByName(""counties"")
qstring = ""UPPER(STATE) = '46'""
qryresult = counties.queryByAttributes(amap,'STATE',qstring,mapscript.MS_MULTIPLE)
print 'done'
---------------------------------------------------

---------------------------------------------------
Relevant mapfile definition
---------------------------------------------------
  LAYER  
    NAME         counties
    TYPE         POLYGON
    CONNECTION ""sde.cssm.iastate.edu,port:5151,sde,username,password""
    CONNECTIONTYPE sde
    DATA ""SDEDATA.SDEDATA_counties_noreg,shape,SDE.DEFAULT""
    TEMPLATE ""/home/hobu/psudataview/templates/footer.html""
    STATUS       ON
    DEBUG ON
    FILTER ""where COUNT_ is not NULL""
END
---------------------------------------------------

---------------------------------------------------
GDB output
---------------------------------------------------
0x00c80343 in strlen () from /lib/tls/libc.so.6
(gdb) bt
#0  0x00c80343 in strlen () from /lib/tls/libc.so.6
#1  0x00c80085 in strdup () from /lib/tls/libc.so.6
#2  0x0022a21f in msQueryByAttributes (map=0xb75af008, qlayer=163439776,
qitem=0x9b7431c ""STATE"", 
    qstring=0x0, mode=1) at mapquery.c:258
#3  0x001d00de in layerObj_queryByAttributes (self=0x0, map=0x0, qitem=0x0,
qstring=0x0, mode=0)
    at mapscript_wrap.c:1672
#4  0x001ec3d0 in _wrap_layerObj_queryByAttributes (self=0x0, args=0x0) at
mapscript_wrap.c:15534
#5  0x080d18e4 in PyCFunction_Call ()
#6  0x080b3d67 in PyObject_Call ()
#7  0x0807d0a3 in PyEval_GetFuncDesc ()
#8  0x0807b031 in PyEval_EvalCode ()
#9  0x0807b65e in PyEval_EvalCodeEx ()
#10 0x0807cbbb in PyEval_GetFuncDesc ()
#11 0x0807ab33 in PyEval_EvalCode ()
#12 0x0807b65e in PyEval_EvalCodeEx ()
#13 0x08078555 in PyEval_EvalCode ()
#14 0x08098569 in PyRun_FileExFlags ()
#15 0x080974d0 in PyRun_SimpleFileExFlags ()
#16 0x08096e1a in PyRun_AnyFileExFlags ()
#17 0x08053ac9 in Py_Main ()
#18 0x08053519 in main ()
---------------------------------------------------
}}}"	defect	closed	high		MapServer C Library	unspecified	normal	later		
