Search code examples
databasesqliterealbasic

Can I store an SQLite database within another SQLite database?


I am actually using an old version of Realbasic (2008) and have been using VB Script to back up several small databases as Zip files.

I now find that thnis method doesn't work On Windows 8 and is also not cross-platform.

As I would like the backup to be in a single file so that it can be incremental, I though of using a large database to hold the copies of the smaller ones.

Is this possible?

I have no intention of buying a plug-in for this.


Solution

  • Similar to Pauls answer. You can read the binary data of the file you want to store into a MemoryBlock and then save the resulting string into the database. We've done this in several applications. Don't expect it to be speedy as all of that happens in RAM first and then gets written to the database.

    Ideally, I think, you'd like to compress the file/string before saving. But there is no gzip built-in to Xojo so you'd have to result to using a 3rd party solution for compression or making an OS call via Declares.