Opened 17 years ago

Closed 14 years ago

#1856 closed defect (worksforme)

SQLite files incomplete

Reported by: darkblueB Owned by:
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: sqlite kml
Cc: Markus Neteler

Description

Some minimal KML files, coverted to SQLite, generate an incomplete SQLite file

ex. ogr2ogr -f SQLite t.sqlite Polygon.kml

ogrinfo will read the file as containing a polygon, but opening the file with SQLite3 will show "Incomplete SQL: SQLite format 3xxx", where xxx is the table defintion. This occurs for many minimal files converted to SQLite.

Attachments (3)

Polygon.kml (975 bytes ) - added by darkblueB 17 years ago.
ca_places_sqlite_ERR.txt (2.0 KB ) - added by darkblueB 17 years ago.
poly_KML_SQLite_ERR.txt (1.7 KB ) - added by darkblueB 17 years ago.

Download all attachments as: .zip

Change History (10)

by darkblueB, 17 years ago

Attachment: Polygon.kml added

comment:1 by darkblueB, 17 years ago

... looking at the error string from the sqlite3 command line monitor, this curious file [ca_places_sqlite_ERR.txt] tells perhaps a little more about what is going on.. looks like a badly termintated string, or unitialized buffer, for the CREATE string

by darkblueB, 17 years ago

Attachment: ca_places_sqlite_ERR.txt added

comment:2 by darkblueB, 17 years ago

... added a memset/NULL to init the command buffer in OGRSQLiteDataSource::CreateLayer(). That does not appear to have solved the problem. However, closer inspection of the file build sequence shows not less than 6 calls to CREATE TABLE when making a trivial conversion of Polygon.kml [poly_KML_SQLite_ERR.txt]

by darkblueB, 17 years ago

Attachment: poly_KML_SQLite_ERR.txt added

comment:3 by darkblueB, 17 years ago

thinking of a fix which is just 'CREATE TABLE IF NOT EXISTS ... ', but, foiled by SQLIte versions... not a good fix as many (like me) would not have the latest and greatest SQLite3 installed...


Subject: Re: Create table IF NOT EXISTS Group: Sqlite-users From: Thomas Chust Date: 2 Mar 2006

On Thu, 2 Mar 2006, Sripathi Raj wrote:

[...] Is the IF NOT EXISTS constraint supported? When I try to use it, I get an error message saying that there is a syntax error at 'NOT'? I'm using Sqlite 3 on Windows and I'm trying to connect to it from Perl. [...]

Hello,

the information that you are using version 3 is not precise enough to answer this question with yes or no ;)

I know the IF [NOT] EXISTS syntax is *not* supported in SQLite 3.1.3 but it *is* supported in SQLite 3.3.4. A quick glance at the changelog says the syntax was introduced with 3.3.0 alpha.

However I recently ran into the pitfall, that with SQLite 3.3.4 the compilation of an IF [NOT] EXISTS qualified statement may result in a NULL statement handle being returned in case the IF [NOT] EXISTS clause does not apply. If this is a problem for you, you should use the current CVS version of SQLite3 which has that behaviour fixed.

cu, Thomas

comment:4 by Markus Neteler, 17 years ago

Cc: Markus Neteler added

comment:5 by Mateusz Łoskot, 16 years ago

Owner: changed from warmerdam to Mateusz Łoskot
Status: newassigned

comment:6 by Mateusz Łoskot, 16 years ago

Owner: Mateusz Łoskot removed
Status: assignednew

comment:7 by Even Rouault, 14 years ago

Resolution: worksforme
Status: newclosed

Works fine with FWTools which uses a pretty ancient sqlite3 (3.0.2 apparently)

Note: See TracTickets for help on using tickets.