commas in CONNECTION string cause MapSe rver to fail

Stephane Lessard LESSARDST at DFO-MPO.GC.CA
Thu Apr 20 15:15:55 EDT 2006


Hi Mark, Frank,
 
In my case, it only seems to work when I put the layer definition all on the
same line in the map file... 
 
CONNECTION "............"
 
Strange... I haven't tried the DATA approach.
 
Stephane
 
 


  _____  

De : Mark Adams [mailto:Mark.Adams at dpra.com] 
Envoyé : 20 avril 2006 14:50
À : LESSARDST at dfo-mpo.gc.ca; MAPSERVER-USERS at LISTS.UMN.EDU
Cc : Mark Adams
Objet : RE: [UMN_MAPSERVER-USERS] commas in CONNECTION string cause
MapServer to fail



Like I said, if I put this in the OVF file instead of including it inline,
it works. Inline, it craps out at the first comma. I can test this by
removing the tablename from the SrcDataSource element for example, and then
it craps out at SrcSQL instead - first comma it finds. Here is the LAYER
definition:

 

LAYER

 NAME 'References'

 CONNECTIONTYPE OGR

 #CONNECTION
"ODBC:MINFWHSE_P1/MINFWHSE_P1 at MINFWHSE_P1,MINFT_WH2_REFER_REFERENCE"

 #CONNECTION "REFERENCES_minf_read.ovf"

 CONNECTION "<OGRVRTDataSource>

    <OGRVRTLayer name='Reference_Query'>

 
<SrcDataSource>ODBC:system/normin at normin_dev,MINFT_WH2_REFER_REFERENCE</SrcD
ataSource> 

            <SrcSQL>SELECT
MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE.GEOMETRY,MINFWHSE_P1.MINFT_WH2_REFER_R
EFERENCE.C_REFER_REFERENCE_NBR FROM MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE
WHERE MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE.GEOMETRY IS NOT NULL</SrcSQL>

            <GeometryType>wkbPolygon</GeometryType> 

            <GeometryField encoding='WKT' field='GEOMETRY'/> 

    </OGRVRTLayer>

</OGRVRTDataSource>"

 STATUS off

 TYPE Polygon

 TRANSPARENCY 100

 TOLERANCE 7

 TOLERANCEUNITS pixels

 TEMPLATE "null"

 METADATA

  WMS_SRS  'epsg:4326'

  WMS_TITLE 'WMSTitel'

  WMS_FEATURE_INFO_MIME_TYPE 'text/html'

 END #METADATA

 

 PROJECTION

  'init=epsg:99999'

 END

 

   CLASS

     NAME 'References'

     STYLE

      #COLOR 150 180 250

      OUTLINECOLOR 0 0 0

      WIDTH 1.5

     END #STYLE

  END #CLASS

 

  

END #LAYER

 

 

------------------------------

Mark Adams

Senior Analyst & Project Manager

Cuesta Systems (DPRA Canada)

5230 South Service Road

Burlington, ON L7L 5K2

Phone: 905-333-4544 x14

Fax: 905-333-0455

Email: mark.adams at dpra.com

 


  _____  


From: LESSARDST at dfo-mpo.gc.ca [mailto:LESSARDST at dfo-mpo.gc.ca] 
Sent: April 20, 2006 2:02 PM
To: Mark Adams; MAPSERVER-USERS at LISTS.UMN.EDU
Subject: RE: [UMN_MAPSERVER-USERS] commas in CONNECTION string cause
MapServer to fail

 

Hi Mark,

 

It has to be a syntax error. I use commas all the time.  Could you provide
the whole virtual layer definition?

 

Stephane

 


  _____  


De : UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] De la
part de Mark Adams
Envoyé : 20 avril 2006 10:38
À : MAPSERVER-USERS at LISTS.UMN.EDU
Objet : [UMN_MAPSERVER-USERS] commas in CONNECTION string cause MapServer to
fail

Hi all,

 

We're working on an application that uses a virtual spatial layer coming
from an Oracle database using WKT geometry. For performance and presentation
reasons, we are setting the CONNECTION string dynamically based on the
user's selected parameters on a query form. The CONNECTION is being set by
including the OGR virtual layer definition in-line, such as:

 

CONNECTION "<OGRVRTDataSource>

    <OGRVRTLayer name='Reference_Query'>

        <SrcDataSource>ODBC:system/normin at normin_dev</SrcDataSource> 

            <SrcSQL>SELECT * FROM MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE
WHERE MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE.C_REFER_REFERENCE_NBR IS NOT
NULL</SrcSQL>

            <GeometryType>wkbPolygon</GeometryType> 

            <GeometryField encoding='WKT' field='GEOMETRY'/> 

    </OGRVRTLayer>

</OGRVRTDataSource>"

 

The above example works fine. However, when we include commas in the SrcSQL
element, such as "SELECT FIELD1,FIELD2 FROM TABLE1,TABLE2", mapserver
crashes with:

 

"

[MapServer Error]: msOGRFileOpen(): Open failed for OGR connection
`<OGRVRTDataSource>

    <OGRVRTLayer name='Reference_Query'>

        <SrcDataSource>ODBC:system/normin at normin_dev</SrcDataSource> 

            <SrcSQL>SELECT
MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE.C_REFER_REFERENCE_NBR'.

Parse error at EOF, not all elements have been closed,

starting with SrcSQL

"

 

Is this behaviour expected, i.e. are commas disallowed in the MAP file, and
if so is there a way to escape them? I can put the exact same string in an
OVF file and set the CONNECTION to that file, and then it works, so I know
there is nothing wrong with the string itself.

 

Thanks.

 

------------------------------

Mark Adams

Senior Analyst & Project Manager

Cuesta Systems (DPRA Canada)

5230 South Service Road

Burlington, ON L7L 5K2

Phone: 905-333-4544 x14

Fax: 905-333-0455

Email: mark.adams at dpra.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060420/a2c6aa52/attachment.html


More information about the mapserver-users mailing list