[Mapserver-users] OGR Layer with SQL
Blaine Hackett
blaine_hack1 at yahoo.com
Wed Jul 28 21:18:38 PDT 2004
Frank
That worked great! Thanks!
Now, however, I need to find out how to do this with a
date/time field.
I tried using the same syntax but with the time:
<SrcSQL>SELECT * FROM subset WHERE(tim_time >
'7:00:00 AM') AND (tim_time < '7:30:00
AM')</SrcSQL>
but that threw me the "Open Failed" error. There must
be someplace that discusses how you might format SQL
for time/date field but I can't find anything.
Got any ideas?
Blaine
--- Frank Warmerdam <warmerdam at pobox.com> wrote:
> Blaine Hackett wrote:
> > 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.
>
> Blaine,
>
> I am now suspecting that the problem relates to your
> use of unescaped
> greater than and less than signs in the XML. Try
> converting
> your expression to something like:
>
> <SrcSQL>SELECT * FROM subset WHERE (ID > 0) AND
> (ID < 35)</SrcSQL>
>
> Otherwise it is likely that the XML parser will get
> confused. I still
> don't understand why you are getting exactly the
> error message you see
> though.
>
> Best regards,
>
> --
>
---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up | Frank
> Warmerdam, warmerdam at pobox.com
> light and sound - activate the windows |
> http://pobox.com/~warmerdam
> and watch the world go round - Rush | Geospatial
> Programmer for Rent
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
>
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
More information about the MapServer-users
mailing list