Opened 11 years ago

Closed 11 years ago

#400 closed defect (fixed)

Bogus SQL error message handling in db_execute_immediate

Reported by: marisn Owned by: grass-dev@…
Priority: critical Milestone: 6.4.0
Component: Database Version: svn-develbranch6
Keywords: Cc:
CPU: Unspecified Platform: Unspecified

Description

I was trying to import shapefile with v.in.ogr and it failed while trying to create database. Only problem - there was no meaningfull error message displayed. Using same SQL expression with db.execute also failed to produce readable error message. After subsequent runs I once got some wired character as error message most likely coming from bogous printf statement argument. Still I was not able to identify origin of that error message to check printf arguments.
Revision: 34900 make distclean && make

$ echo "create table gps_pents_osl (cat integer, SHAPEID integer, ELE double precision, NAME varchar ( 80 ), DESC varchar ( 80 ), AUGST double precision)" | db.execute
DBMI-DBF driver error:
SQL parser error: �۷
in statement:
create table gps_pents_osl (cat integer, SHAPEID integer, ELE double precision, NAME varchar ( 80 ), DESC varchar ( 80 ), AUGST double precision)

Error in db_execute_immediate()

Change History (3)

comment:1 Changed 11 years ago by neteler

Summary: Bogous SQL error message handling in db_execute_immediateBogus SQL error message handling in db_execute_immediate

AFAIK "DESC" is a reserved SQL word which cannot be a column name.

See "ERROR MESSAGES" in the v.in.ogr manual. Apparently the vector modules catch the error while the db.* modules don't.

Markus

comment:2 Changed 11 years ago by hamish

the "SQL parser error: �۷" indicates e.g. %s of an uninitialized variable.

Hamish

comment:3 Changed 11 years ago by marisn

Resolution: fixed
Status: newclosed

Error message was used after freeing it. Fixed in r36326.

Note: See TracTickets for help on using tickets.