dbsqlite.mod incbin doesn't work?

BlitzMax Forums/Brucey's Modules/dbsqlite.mod incbin doesn't work?

Krischan(Posted 2011) [#1]
I tried to incbin a readonly sqlite database but unfortunately the connection doesn't open this way. I tried it with

Global DBname:String = "mydatabase.sqlite"
db:TDBConnection = LoadDatabase("SQLITE", "incbin::"+DBname)


but it didn't work. Then I tried

If sqlite3_open("incbin::" + convertISO8859toUTF8(_dbname), Varptr handle) = SQLITE_OK Then

in the Method "open" in "dbsqlite.bmx" but didn't work either. Is it possible somehow or can anybody help? Without incbin everything works like it should.

Last edited 2011


Brucey(Posted 2011) [#2]
SQLite doesn't support in-memory databases in that way.

You can create an in-memory database on-the-fly by using a database name of ":memory:", which will create a database in memory until it is closed.

Once you have your in-memory database, you could, in theory, populate it from a disk-based database, using an "INSERT ... INTO ... SELECT * FROM ..". query.

Hope this helps.


Brucey(Posted 2011) [#3]
Apparently, it may be possible to do the "load into memory" step in one go : http://www.sqlite.org/backup.html


Krischan(Posted 2011) [#4]
ahh ok - I implemented it now using a CSV as source data I could incbin now and populate the DB from there. But it takes some time in the beginning, I need to check this out further. Thanks!