[GRASS-user] 'where' sql command in d.vect and others

Hi,

I have a vector of points with the following data:

v.info -c communities
Displaying column types/names for database connection of layer 1:
INTEGER|cat
CHARACTER|str_1
CHARACTER|str_2
CHARACTER|str_3
DOUBLE PRECISION|dbl_1
DOUBLE PRECISION|dbl_2
INTEGER|int_1

and have been trying to subset this in d.vect like this:

d.vect communities where="str_3 = 'some string'"

but it's not subsetting as expected. Is this the right syntax for
constructing the 'where' parameter?

Cheers,

--
Seb

On Sat, 24 Mar 2007 08:35:56 -0500,
Seb <spluque@gmail.com> wrote:

[...]

but it's not subsetting as expected. Is this the right syntax for
constructing the 'where' parameter?

I think this is a quoting issue. The data look like this:

db.select communities
cat|str_1|str_2|str_3|dbl_1|dbl_2|int_1
1|"312"|"East Whitefish"|"W Arctic"|||58

Does the double quote need to be escaped somehow? Thanks.

--
Seb

On Sat, 24 Mar 2007 08:46:32 -0500,
Seb <spluque@gmail.com> wrote:

[...]

db.select communities

cat> str_1|str_2|str_3|dbl_1|dbl_2|int_1
1> "312"|"East Whitefish"|"W Arctic"|||58

Does the double quote need to be escaped somehow? Thanks.

After some fiddling, I found out the 'where' parameter needs to be set as:

where="str_3='\"W Arctic\"'"

However, the same doesn't work within the display manager with, for
instance, d.vect. In that case, the 'where' parameter ends up within
braces in the actual call.

--
Seb

On Sat, 24 Mar 2007 12:05:05 -0500,
Seb <spluque@gmail.com> wrote:

[...]

However, the same doesn't work within the display manager with, for
instance, d.vect. In that case, the 'where' parameter ends up within
braces in the actual call.

Some more fiddling led me to find out the correct syntax in display
manager:

str_3='"W Arctic"'

which creates a valid sql query and the map plots correctly. However,
this runs into another problem with d.out.file from a display of the
queried map and says:

Sorry <Arctic'> is not a valid option

Could this be a bug? If the 'where' statement does its job with this
string, I would have expected d.out.file to work too.

Cheers,

--
Seb