MSAccess OGR VRT - Dynamic Control of Virtual Sources - SrcSQL WHERE Clause Quote Issues
Marty Petach
mpetach at NEWFIELDS.COM
Wed Apr 5 01:00:36 PDT 2006
Hi MapServer Wizards
I have a "static" OGR VRT data source working well in Mapserver 4.8.3 (MS4W
1.5) Windows XP, connecting to Microsoft Access 2002 table using Microsoft
Access Driver 4.00.6304.00 ODBC driver, but I'm having trouble getting the
data source to work correctly with a replaceable URL parameter, apparently
due to quoting text string challenges.
Here is the working "static" definition which correctly selects and draws
the appropriate points:
LAYER
NAME "NONLWG Sampling Data"
CONNECTION "<OGRVRTDataSource>
<OGRVRTLayer name='nonlwg'>
<SrcDataSource>ODBC:user/pass at NONLWGCHEM</SrcDataSource>
<SrcSQL>SELECT X, Y, CHEM FROM chemTable
WHERE CHEM = 'Silver'</SrcSQL>
<GeometryField encoding='pointFromColumns' x='X' y='Y'/>
<GeometryType>wkbPoint</GeometryType>
</OGRVRTLayer>
</OGRVRTDataSource>"
CONNECTIONTYPE OGR
DATA "nonlwg"
TYPE POINT
...
When I try to use a URL parameter, chemname, (which I can use successfully
use on the HTML form), the OGR VRT layer does not draw - it does nothing, no
errors as far as I can see, but no data from this layer are drawn. Other
layers draw as expected. I've tried many different combinations of quotes,
" ' ' " ''' \' etc, but nothing seems to work. Any hints?
This does nothing:
LAYER
NAME "NONLWG data"
CONNECTION "<OGRVRTDataSource>
<OGRVRTLayer name='nonlwg'>
<SrcDataSource>ODBC:user/pass at POPNONLWG</SrcDataSource>
<SrcSQL>SELECT X, Y, CHEM FROM chemTable
WHERE CHEM = '%chemname%'</SrcSQL>
<GeometryField encoding='pointFromColumns' x='X' y='Y'/>
<GeometryType>wkbPoint</GeometryType>
</OGRVRTLayer>
</OGRVRTDataSource>"
CONNECTIONTYPE OGR
DATA "nonlwg"
TYPE POINT
...
The trouble seems to be with the part of the statement
WHERE CHEM = '%chemname%'
I hope to use the "chemname" to dynamically display the appropriate results
based on user input from a selection list on an HTTP form...
Marty Petach
NewFields Boulder, LLC
4720 Walnut St., Suite 200
Boulder, CO 80301
Phone (303)-442-0267
Fax (303)-442-3679
mpetach at newfields.com
More information about the MapServer-users
mailing list