[Mapserver-users] OGR Layer with SQL

Blaine Hackett blaine_hack1 at yahoo.com
Wed Jul 28 15:16:07 EDT 2004


All

I made a mistake on my last email.  Actually disregard
that one and read this one instead. 

I am having a problem using SQL with OGR.

This SQL statement will work(ID is a number field):
<SrcSQL>SELECT * FROM subset WHERE (ID > 35) </SrcSQL>
This one will NOT:
<SrcSQL>SELECT * FROM subset WHERE (ID > 0) AND (ID <
35)</SrcSQL> 
I get the following error: 
"msOGRFileOpen(): OGR error. Open failed for OGR
connection ` ODBC:ODBC:user/pass at minnesotadata SELECT
* FROM subset WHERE (ID > 0) AND (ID < 50) wkbPoint
WGS84 '. File not found or unsupported format. "

When I try to use it with a date field such as this:
<SrcSQL>SELECT * FROM subset WHERE (time >
7:13)</SrcSQL>
I get virtually the same error as above (But with the
other SQL syntax)

However if I replace the date value with a number like
this: <SrcSQL>SELECT * FROM subset WHERE (time >
7)</SrcSQL>
I get no points on my map but I do not get an error.

Sorry for my confusion. Hopefully this is clear and
someone can help me.

Thanks
Blaine

--- Blaine Hackett <blaine_hack1 at yahoo.com> wrote:
> All
> 
> I am having a problem using SQL with OGR.  The
> following SQL statement works:
> <SrcSQL>SELECT * FROM subset (time > '6:00:00 AM'
> </SrcSQL>
> 
> but if I make it complex like this:
> <SrcSQL>SELECT * FROM subset (time > '6:00:00 AM')
> AND
> (time < '7:30:00 AM')  </SrcSQL>
> 
> It throws this error:
> msOGRFileOpen(): OGR error. Open failed for OGR
> connection ` ODBC:ODBC:user/pass at minnesotadata
> SELECT
> * FROM subset (time > '6:00:00 AM') AND (time <
> '7:30:00 AM') wkbPoint WGS84 '. File not found or
> unsupported format. 
> 
> The SQL syntax I am using is exactly like the syntax
> shown on
> http://www.remotesensing.org/gdal/ogr/ogr_sql.html.
> 
> I have tried every combination of quotes and
> parenthesis and uppercase and lowercase without
> success. I have also tried copying and pasting from
> the Access SQL window since that is the database I
> am
> linking to but that does not work at all. 
> 
> Anyone have any ideas what I am doing wrong?
> 
> Blaine
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Y! Messenger - Communicate in real time. Download
> now. 
> http://messenger.yahoo.com
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
>
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 



		
__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com



More information about the mapserver-users mailing list