#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
On some systems (here: Ubuntu, user report on grass-user), it is not
possible to run v.rast.stats properly when using the DBF driver as it is
internally executing a SQL transaction:
{{{
v.rast.stats -c vector=basin_250@PERMANENT raster=rainfall_idw@PERMANENT
colprefix=z
Updating the database ...
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected NAME processing
'BEGIN'
in statement:
BEGIN TRANSACTION
Error in db_execute_immediate()
ERROR: Error while executing: 'BEGIN TRANSACTION'
}}}
I would suggest to add stub functions for
* db_begin_transaction()
* db_commit_transaction()
to db/drivers/dbf/execute.c to make the DBMI interface happy.
Is attached patch ok? If yes, also add to GRASS 7?
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by mlennert):
Replying to [comment:1 neteler]:
> I modified the patch but don't know where to add these two items:
>
> * SQLP_BEGIN_TRANSACTION
> * SQLP_COMMIT_TRANSACTION
According to lib/db/sqlp/README:
"New types have to be added in yac.y, lex.l, print.c and
../../../include/sqlp.h."
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by neteler):
Thanks, attached patch updated which now compiles. Still not reaching the
desired effect to simply ignore the SQL transaction when using a DBF
driver...
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by mlennert):
Replying to [comment:3 neteler]:
> Thanks, attached patch updated which now compiles. Still not reaching
the desired effect to simply ignore the SQL transaction when using a DBF
driver...
You still are missing the additions to the other files mentioned. AFAICT,
with the current patch, st->command will never take the values
SQLP_BEGIN_TRANSACTION or SQLP_COMMIT_TRANSACTION as they are not
recognized by the parser, so your case statement will always be false.
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by mlennert):
Replying to [comment:5 neteler]:
> Replying to [comment:4 mlennert]:
> > You still are missing the additions to the other files mentioned.
>
> Ops, right.
> Updated patch attached, now it complains about double defined BEGIN...
After running make in lib/db/sqlp/ there is a file lex.yy.c which has the
following line 125:
{{{ #define BEGIN (yy_start) = 1 + 2 *
}}}
My wild guess is that this causes your problem, but I'm way out of my
league here (don't even know where this line comes from in that file), so
you would have to consult with a lex/yacc guru.
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
> After running make in lib/db/sqlp/ there is a file lex.yy.c which has
the following line 125:
>
{{{ #define BEGIN (yy_start) = 1 + 2 *
}}}
>
> My wild guess is that this causes your problem, but I'm way out of my
league here (don't even know where this line comes from in that file),
It's part of the boilerplate code which built into flex itself.
The bottom line is that you can't use "BEGIN" as a token identifier
(REJECT, ECHO and INITIAL are also unavailable; the other macro names are
unlikely to result in innocent collisions). Add a trailing underscore or
change the case to avoid a conflict.
Also the patch attempts to define the TRANSACTION token twice:
{{{
%token BEGIN TRANSACTION
%token COMMIT TRANSACTION
}}}
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by renatomichel):
Hello,
I copied the file v.rast.stats Version 6.4.3 in the
apps/grass/grass-6.4.4/scripts successfully, I no longer have the error
message. These scipts are different with quotes usage ?
#2457: DBF driver: stub functions for SQL TRANSACTION
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Database | Version: svn-releasebranch64
Keywords: dbf, sql | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by neteler):
Instead of trying to add SQL TRANSACTIONS to the DBF driver, I have now
simply conditionalized it in r63789. This will go into a future GRASS GIS
6.4.5.
The last comment did not belong here but to the list.
Since adding SQL TRANSACTIONs to the DBF driver appears to be too
complicated and essentially useless, I take liberty to close my own ticket
as wontfix. Thanks for the support, though.