OsmSharp / ui

The UI components.
http://osmsharp.com/
GNU General Public License v2.0
138 stars 91 forks source link

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

Open Lotto2 opened 9 years ago

Lotto2 commented 9 years ago

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;-)

xivk commented 9 years ago

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