#1901: v.mkgrid near ",": syntax error, no batch insert
-------------------------+--------------------------------------------------
Reporter: pertusus | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Keywords: | Platform: Linux
Cpu: Unspecified |
-------------------------+--------------------------------------------------
A v.mkgrid leads to:
{{{
v.mkgrid map=grid_map_v grid=$rows,$cols
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near ",": syntax error
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near ",": syntax error
ERREUR :Unable to insert new record: insert into grid_map_v values ( 1, 1,
1 ), ( 2, 1, 2 ), ( 3, 1, 3 ), ( 4, 1, 4 ), ( 5, 1, 5 ), ( 6, 1, 6
), ( 7, 1, 7 ), ( 8, 1, 8 ), ( 9, 1, 9 ), ( 10, 1, 10 ), ( 11, 1,
11 ), ( 12, 1, 12 ), ( 13, 1, 13 ), ( 14, 1, 14 ), ( 15, 1, 15 ),
(
16, 1, 16 ), ( 17, 1, 17 ), ( 18, 1, 18 ), ( 19, 1, 19 ), ( 20, 1,
20 )
}}}
Trying manually:
{{{
db.execute sql=" insert into grid_map_v values ( 3, 1, 3 ), ( 4, 1, 4 )"
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near ",": syntax error
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near ",": syntax error
}}}
And trying in sqlite directly:
{{{
sqlite> create table grid_map_v ( cat INTEGER, row INTEGER, col INTEGER );
sqlite> insert into grid_map_v values ( 1, 1, 1), ( 2, 1, 2 );
Error: near ",": syntax error
sqlite> insert into grid_map_v values ( 1, 1, 1);
}}}
The batch insertion is shown in http://www.sqlite.org/lang_insert.html,
however I am not sure that it is standard sql. I don't know where to find
the standard, but on http://troels.arvin.dk/db/rdbms/#insert-multiple it
is described as optional.
The commit that introduced that issue is the last commit
{{{
r53891 | marisn | 2012-11-18 13:40:34 +0100 (dim. 18 nov. 2012) | 1 ligne
Make some errors more fatal; Write attribute data in batches per 20 to
speed up module 16x times
}}}
I will set BATCH_SIZE 1 for now but I am not sure it is the correct fix.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1901>
GRASS GIS <http://grass.osgeo.org>