Opened 12 years ago

Closed 7 years ago

#136 closed defect (fixed)

sqlite: confusing error message

Reported by: neteler Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Default Version: svn-trunk
Keywords: sqlite Cc:
CPU: Unspecified Platform: Unspecified

Description

I tried to import

cat tin.asc
cat,x,y,z
1,0,0,0
1,0,10,1
1,0,20,2
2,10,0,1
2,10,10,3
2,10,20,4
3,20,0,1
3,20,10,4
3,20,20,5

Import:

v.in.ascii -z tin.asc out=tinpoints z=3 fs=comma skip=1 cat=1 --o
Scanning input for column types...
Maximum input row length: 10
Maximum number of columns: 4
Minimum number of columns: 4
Importing points...
DBMI-SQLite driver error:
Error in sqlite3_step():
SQL logic error or missing database

ERROR: Unable to insert new record: insert into tinpoints values ( 1, 0,
      10, 1)

but this is the wrong (confusing) error:

Trying the same on console:

sqlite3 ddd.sb
SQLite version 3.4.2
Enter ".help" for instructions
sqlite> create table tinpoints ( int_1 integer, int_2 integer, int_3
integer, int_4 integer );
sqlite> create unique index tinpoints_int_1 on tinpoints ( int_1 );
sqlite> insert into tinpoints values ( 1, 0, 0, 0);
sqlite> insert into tinpoints values ( 1, 0, 10, 1);
SQL error: column int_1 is not unique
sqlite>

That's the right error.... would like to see that message in GRASS, too. The code is in db/drivers/sqlite/execute.c line 47

strange that it isn't identical...

Change History (2)

comment:1 Changed 8 years ago by mmetz

CPU: Unspecified
Platform: Unspecified

Fixed in trunk r48530.

Please test.

Markus M

comment:2 Changed 7 years ago by neteler

Resolution: fixed
Status: newclosed

With wrong parameters the error message is better now:

GRASS 6.4.3svn (nc_spm_08):~ > v.in.ascii -z tin.asc out=tinpoints z=3 fs=comma skip=1 cat=1 --o
Scanning input for column types...
Maximum input row length: 10
Maximum number of columns: 4
Minimum number of columns: 4
Column: 1 type: integer
Column: 2 type: integer
Column: 3 type: integer
Column: 4 type: integer
Importing points...
DBMI-SQLite driver error:
Error in sqlite3_step():
column int_1 is not unique

ERROR: Unable to insert new record: insert into tinpoints values ( 1, 0,
       10, 1)

With correct parameters it works:

GRASS 6.4.3svn (nc_spm_08):~ > v.in.ascii -z tin.asc out=tinpoints x=2 y=3 z=4 fs=comma skip=1 cat=1 --o
Scanning input for column types...
Maximum input row length: 10
Maximum number of columns: 4
Minimum number of columns: 4
Importing points...
 100%
Building topology for vector map <tinpoints>...
Registering primitives...
9 primitives registered
9 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 9
Number of primitives: 9
Number of points: 9
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii complete.

Hence, closing.

Note: See TracTickets for help on using tickets.