Ticket #1856 (closed defect: worksforme)

Opened 6 years ago

Last modified 4 years ago

SQLite files incomplete

Reported by: darkblueB Owned by:
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: sqlite kml
Cc: 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

Polygon.kml Download (1.0 KB) - added by darkblueB 6 years ago.
ca_places_sqlite_ERR.txt Download (2.0 KB) - added by darkblueB 6 years ago.
poly_KML_SQLite_ERR.txt Download (1.7 KB) - added by darkblueB 6 years ago.

Change History

Changed 6 years ago by darkblueB

Changed 6 years ago by darkblueB

... 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

Changed 6 years ago by darkblueB

Changed 6 years ago by darkblueB

... 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]

Changed 6 years ago by darkblueB

Changed 6 years ago by darkblueB

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

Changed 6 years ago by neteler

  • cc neteler added

Changed 6 years ago by mloskot

  • owner changed from warmerdam to mloskot
  • status changed from new to assigned

Changed 5 years ago by mloskot

  • owner mloskot deleted
  • status changed from assigned to new

Changed 4 years ago by rouault

  • status changed from new to closed
  • resolution set to worksforme

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

Note: See TracTickets for help on using tickets.