[GRASS5] [bug #4142] (grass) sql statemts in d.m

Kirk wrote:

I may have found a bug in d.m. However, I may not be issuing the sql
statement properly in d.m. For example If issue the following
command on the command line:

d.vect test fcolor=none where="type='JAPI'"

the expected polygons are displayed.

However, in d.m, if I type in the SQL where statement field:

"type = 'JAPI'"

which I believe is the same command minus the (where=) that worked
on the command line, no vectors are displayed. Console output is as
follows:

d.vect map=test color=0:0:0 lcolor=0:0:0 fcolor=none display=shape
type=point,line,boundary,centroid,area icon=basic/x size=5 layer=1
lsize=8 xref=left yref=center llayer=1 {where="type = 'JAPI'"}

Am I misusing the sql field in d.m, or should this be working?

If you put type = 'JAPI' (no " ") in d.m it should work, does it?

Please confirm.

Maciek

-------------------------------------------- Managed by Request Tracker

Hi Maciek,

Sorry for taking so long in response.
On Mar 6, 2006, at 3:34 PM, Maciek Sieczka via RT wrote:

Kirk wrote:

I may have found a bug in d.m. However, I may not be issuing the sql
statement properly in d.m. For example If issue the following
command on the command line:

d.vect test fcolor=none where="type='JAPI'"

the expected polygons are displayed.

However, in d.m, if I type in the SQL where statement field:

"type = 'JAPI'"

which I believe is the same command minus the (where=) that worked
on the command line, no vectors are displayed. Console output is as
follows:

d.vect map=test color=0:0:0 lcolor=0:0:0 fcolor=none display=shape
type=point,line,boundary,centroid,area icon=basic/x size=5 layer=1
lsize=8 xref=left yref=center llayer=1 {where="type = 'JAPI'"}

Am I misusing the sql field in d.m, or should this be working?

If you put type = 'JAPI' (no " ") in d.m it should work, does it?

Yes, single quotes work. However, without double quotes is it possible to do a complex query?

For example: type = 'JAPI' and 'SP' does not work, and adding the double quotes like this: "type = 'JAPI' and 'SP'" does not work either.

Please confirm.

Maciek

-------------------------------------------- Managed by Request Tracker

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Kirk R. Wythers wrote:

Hi Maciek,

Sorry for taking so long in response.
On Mar 6, 2006, at 3:34 PM, Maciek Sieczka via RT wrote:

Kirk wrote:

I may have found a bug in d.m. However, I may not be issuing the sql
statement properly in d.m. For example If issue the following
command on the command line:

d.vect test fcolor=none where="type='JAPI'"

the expected polygons are displayed.

However, in d.m, if I type in the SQL where statement field:

"type = 'JAPI'"

which I believe is the same command minus the (where=) that worked
on the command line, no vectors are displayed. Console output is as
follows:

d.vect map=test color=0:0:0 lcolor=0:0:0 fcolor=none display=shape
type=point,line,boundary,centroid,area icon=basic/x size=5 layer=1
lsize=8 xref=left yref=center llayer=1 {where="type = 'JAPI'"}

Am I misusing the sql field in d.m, or should this be working?

If you put type = 'JAPI' (no " ") in d.m it should work, does it?

Yes, single quotes work. However, without double quotes is it possible to do a complex query?

For example: type = 'JAPI' and 'SP' does not work, and adding the double quotes like this: "type = 'JAPI' and 'SP'" does not work either.

This should be type='JAPI' and type='SP'.

As far as I know, type='JAPI' and 'SP' is not standard SQL.

Moritz

Hi Moritz,

On Mar 7, 2006, at 8:36 AM, Moritz Lennert wrote:

This should be type=‘JAPI’ and type=‘SP’.

My understanding from examples in the docs (http://grass.itc.it/grass61/manuals/html61_user/sql.html) is that the use of double quotes to allow more than one query run in a single statment. Am I wrong on this?

Text-string matching requires the text part to be ‘single quoted’ and multiple queries should be contained in “double quotes”. e.g.
d.vect map where=“individual=‘juvenile’ and area=‘beach’”

As far as I know, type=‘JAPI’ and ‘SP’ is not standard SQL.

Moritz

Kirk R. Wythers wrote:

Hi Moritz,

On Mar 7, 2006, at 8:36 AM, Moritz Lennert wrote:

This should be type='JAPI' and type='SP'.

My understanding from examples in the docs (http://grass.itc.it/grass61/manuals/html61_user/sql.html) is that the use of double quotes to allow more than one query run in a single statment. Am I wrong on this?

Text-string matching requires the text part to be 'single quoted' and multiple queries should be contained in "double quotes". e.g.
d.vect map where="individual='juvenile' and area='beach'"

The quoting issue is a different one from the fact that [type='JAPI' and 'SP'] is invalid as you have to repeat the field/column name.

As was already hinted at by others, the quoting rules in the documentation target the command line. Quoting is handled differently in the GUI interface.

So in the command line, you would have to type:

where="type='JAPI' and type='SP'"

but in the GUI you put

type='JAPI' and type='SP'

into the "where" text field.

As far as I know, type='JAPI' and 'SP' is not standard SQL.

Moritz

Mortiz

> My understanding from examples in the docs
> (http://grass.itc.it/grass61/manuals/html61_user/sql.html) is that
> the use of double quotes to allow more than one query run in a
> single statment. Am I wrong on this?
>
> Text-string matching requires the text part to be 'single quoted'
> and multiple queries should be contained in "double quotes". e.g.
> d.vect map where="individual='juvenile' and area='beach'"

The quoting issue is a different one from the fact that [type='JAPI'
and 'SP'] is invalid as you have to repeat the field/column name.

As was already hinted at by others, the quoting rules in the
documentation target the command line. Quoting is handled differently
in the GUI interface.

I have updated the help page to clarify that you only need the double
quotes when specifying the query from the command line.

Hamish