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/[EMAIL PROTECTED],MINFT_WH2_REFER_REFERENCE"

 #CONNECTION "REFERENCES_minf_read.ovf"

 CONNECTION "<OGRVRTDataSource>

    <OGRVRTLayer name='Reference_Query'>

        <SrcDataSource>ODBC:system/[EMAIL PROTECTED],MINFT_WH2_REFER_REFERENCE</SrcDataSource>

            <SrcSQL>SELECT MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE.GEOMETRY,MINFWHSE_P1.MINFT_WH2_REFER_REFERENCE.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: [EMAIL PROTECTED]

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: April 20, 2006 2:02 PM
To: Mark Adams; [email protected]
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:[EMAIL PROTECTED] De la part de Mark Adams
Envoyé : 20 avril 2006 10:38
À : [email protected]
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/[EMAIL PROTECTED]</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/[EMAIL PROTECTED]</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: [EMAIL PROTECTED]

 

Reply via email to