ui icon indicating copy to clipboard operation
ui copied to clipboard

Pulling .PBF-File into an SQLite-DB results in empty tables, missing commit?

Open Lotto2 opened this issue 10 years ago • 1 comments

Hello,

i was experimenting with pulling Osm.PBF-files into databases. it worked fine with SQL-Server and PostgreSQL.

when i tried an SQLite-DB i found tables but no data in them after executing.

before pulling sqliteconnection.AutoCommit was true, afterwards false. so i tried to apply a commit after pulling and before closing the connection. now tables were filled.

i tried to trace it but i didn't find out where in the sources a commit might be added.

VB-code:

Dim con As SQLiteConnection = New SQLiteConnection("Data Source=C:\MySqlite.Db3;Version=3;AutoCommit=True") con.Open() 'con.AutoCommit is true

Dim target As OsmSharp.Osm.Streams.OsmStreamTarget = New OsmSharp.Data.SQLite.Osm.Streams.SQLiteOsmStreamTarget(con) target.Initialize()

Dim source As OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource = New OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource(New FileInfo("C:\MyOsmFile.Osm.PBF").OpenRead()) target.RegisterSource(source) target.Pull()

'con.AutoCommit is false -> transaction not closed?

'without commit, the tables node,...,ways were created but empty Dim sqliteCmd As SQLiteCommand = con.CreateCommand() sqliteCmd.CommandText = "Commit" sqliteCmd.ExecuteNonQuery()

con.Close() con = Nothing

by the way: i never approached SQLite before. don't hit me if it's my fault;-)

Lotto2 avatar Feb 12 '15 15:02 Lotto2

Does it work if you use target.Close() after target.Pull()?

xivk avatar May 25 '15 17:05 xivk