[GRASSLIST:3783] Re: Fun with dbf in GRASS57

Hello,
I want to select some areas from a vector map connected to a dbf file. The
wanted area must match a given string pattern, but I can't get passed this
message:

DBMI-DBF driver error:
SQL parser error in statement:
SELECT * FROM NHD_HU11d WHERE HUC_11 LIKE '02040101%'

The GRASS SQL implementation doesn't use the operator 'like' (It also doesn't use 'in')

Could anybody point me to some generic references about what a dbf server can
or cannot do, and how easy is it to switch to another driver (seems that I'll
have to use postgresql eventually...)

I had a similar question and Radim pointed me to this brief but useful guide in the GRASS 5.7 manual. Here is the address for the on-line version.

<http://grass.itc.it/grass57/manuals/html57_user/sql.html&gt;

Cheers,
Michael

____________________
C. Michael Barton, Professor
School of Human Origins, Cultures, & Societies
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Wednesday 30 June 2004 07:25, Michael Barton wrote:

> Hello,
> I want to select some areas from a vector map connected to a dbf file.
> The
> wanted area must match a given string pattern, but I can't get passed
> this
> message:
>
> DBMI-DBF driver error:
> SQL parser error in statement:
> SELECT * FROM NHD_HU11d WHERE HUC_11 LIKE '02040101%'

The GRASS SQL implementation doesn't use the operator 'like' (It also
doesn't use 'in')

> Could anybody point me to some generic references about what a dbf
> server can
> or cannot do, and how easy is it to switch to another driver (seems
> that I'll
> have to use postgresql eventually...)

I had a similar question and Radim pointed me to this brief but useful
guide in the GRASS 5.7 manual. Here is the address for the on-line
version.

<http://grass.itc.it/grass57/manuals/html57_user/sql.html&gt;

It should be called 'Subset of SQL implemented in dbf driver'
or something like that.

WHERE HUC_11 ~ '02040101%'
could work.

Radim

> I had a similar question and Radim pointed me to this brief but useful
> guide in the GRASS 5.7 manual. Here is the address for the on-line
> version.
>
> <http://grass.itc.it/grass57/manuals/html57_user/sql.html&gt;

YES ! Thansk a lot !

WHERE HUC_11 ~ '02040101%' could work.

AAMOF, it does not. The "~" operator works like in gawk (it seems), you don't
need the wildcards, and so the proper answer is

WHERE HUC_11 ~ '02040101'

Well, new problem: you can't precise what part of the string to match (start?
end?), I guess that comes from the dbf driver limitations... Fair enough.

Thanks again !

--
Soil & Water Laboratory
Dept. of Biological & Environmental Engineering
Cornell University
ITHACA, NY 14853
Tel: (607)255.2463