[GRASS-dev] DBF driver: semicolon and select troubles

Hi,

when having a semicolon at the end of a statement, the DBF driver gives
an error:

echo "select start_map, end_map, start_mp, start_off, end_mp, end_off,
lid from route_lrs where lcat = 1;" | db.select
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected $undefined, expecting $end
processing ';'
in statement:
select start_map, end_map, start_mp, start_off, end_mp, end_off, lid
from route_lrs where lcat = 1;
Error in db_open_select_cursor()

This is a problem, because other drivers seem to require it (see
v.lrs.label).

Without semicolon, it works:
echo "select start_map, end_map, start_mp, start_off, end_mp, end_off,
lid from route_lrs where lcat = 1" | db.select
start_map|end_map|start_mp|start_off|end_mp|end_off|lid
185.206836|596.743043|6|0|7|0|22

How to enable the DBF driver to also accept the semicolon here?

markus

------------------
ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
ITC -> since 1 March 2007 Fondazione Bruno Kessler
------------------

Markus Neteler wrote:

Hi,

when having a semicolon at the end of a statement, the DBF driver gives
an error:

echo "select start_map, end_map, start_mp, start_off, end_mp, end_off,
lid from route_lrs where lcat = 1;" | db.select
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected $undefined, expecting $end
processing ';'
in statement:
select start_map, end_map, start_mp, start_off, end_mp, end_off, lid
from route_lrs where lcat = 1;
Error in db_open_select_cursor()

This is a problem, because other drivers seem to require it (see
v.lrs.label).

Without semicolon, it works:
echo "select start_map, end_map, start_mp, start_off, end_mp, end_off,
lid from route_lrs where lcat = 1" | db.select
start_map|end_map|start_mp|start_off|end_mp|end_off|lid
185.206836|596.743043|6|0|7|0|22

How to enable the DBF driver to also accept the semicolon here?

Untested:

--- lib/db/sqlp/yac.y 4 Mar 2007 08:34:44 -0000 1.27
+++ lib/db/sqlp/yac.y 1 Jul 2007 06:39:47 -0000
@@ -102,6 +102,7 @@
   | y_select
   | y_update
   | y_delete
+ | y_sql ';'
   ;
   
y_alter:

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote:

Markus Neteler wrote:

Hi,

when having a semicolon at the end of a statement, the DBF driver gives
an error:

echo "select start_map, end_map, start_mp, start_off, end_mp, end_off,
lid from route_lrs where lcat = 1;" | db.select
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected $undefined, expecting $end
processing ';'
in statement:
select start_map, end_map, start_mp, start_off, end_mp, end_off, lid
from route_lrs where lcat = 1;
Error in db_open_select_cursor()

This is a problem, because other drivers seem to require it (see
v.lrs.label).

Without semicolon, it works:
echo "select start_map, end_map, start_mp, start_off, end_mp, end_off,
lid from route_lrs where lcat = 1" | db.select
start_map|end_map|start_mp|start_off|end_mp|end_off|lid
185.206836|596.743043|6|0|7|0|22

How to enable the DBF driver to also accept the semicolon here?

Untested:

--- lib/db/sqlp/yac.y 4 Mar 2007 08:34:44 -0000 1.27
+++ lib/db/sqlp/yac.y 1 Jul 2007 06:39:47 -0000
@@ -102,6 +102,7 @@
   | y_select
   | y_update
   | y_delete
+ | y_sql ';'
   ;
   
y_alter:

--
Glynn Clements <glynn@gclements.plus.com>

Excellent, works. I have added it to 6.2.2-CVS, too.

Unrelated: I get these warnings on Mandriva:

bison -y -d -v yac.y
yac.y:74.15-19: Warnung: symbol TABLE redeclared
yac.y:75.8-11: Warnung: symbol DROP redeclared
yac.y:75.13-17: Warnung: symbol TABLE redeclared

bison --version
bison (GNU Bison) 2.3

It this harmful?

Markus
--
View this message in context: http://www.nabble.com/DBF-driver%3A-semicolon-and-select-troubles-tf3994416.html#a11380125
Sent from the Grass - Dev mailing list archive at Nabble.com.

Markus Neteler wrote:

Unrelated: I get these warnings on Mandriva:

bison -y -d -v yac.y
yac.y:74.15-19: Warnung: symbol TABLE redeclared
yac.y:75.8-11: Warnung: symbol DROP redeclared
yac.y:75.13-17: Warnung: symbol TABLE redeclared

bison --version
bison (GNU Bison) 2.3

It this harmful?

I don't think so. They've always been there, and they're due to:

63 %token DROP
73 %token ALTER TABLE
74 %token CREATE TABLE
75 %token DROP TABLE

DROP is defined on 63 then defined again on 75. TABLE is defined on 73
then again on 74 and 75. A %token directive with multiple tokens is
exactly equivalent to multiple %token directives.

You can eliminate the warnings with:

--- lib/db/sqlp/yac.y 1 Jul 2007 08:52:49 -0000 1.28
+++ lib/db/sqlp/yac.y 2 Jul 2007 03:30:05 -0000
@@ -71,8 +71,7 @@
%token OR
%token NOT
%token ALTER TABLE
-%token CREATE TABLE
-%token DROP TABLE
+%token CREATE
%token NULL_VALUE
%token VARCHAR
%token INT

--
Glynn Clements <glynn@gclements.plus.com>