Transferring SQLite database file to memory

  1. 8 months ago

    Nathan W

    22 Oct 2019 Testers, Xojo Pro Europe (UK, Jersey)

    Is there an easy way to load a SQLite database from file to an in memory database, work on it in memory and then write the whole in memory database back to the database file?

    Perhaps it was before it became Xojo. Basically the steps are you create your in-memory database, attach the physical db and then use a bunch of select into statements to copy tables & data into your in-memory version. You would reverse the process to write the data back to the physical db file.

  2. Wayne G

    22 Oct 2019 Testers, Xojo Pro, MVP Auckland, New Zealand

    Search the Xojo Blog site. @Geoff P did a blog on how they do this for their Eddies web demo.

  3. Nathan W

    22 Oct 2019 Testers, Xojo Pro Europe (UK, Jersey)

    @Wayne G Search the Xojo Blog site. @Geoff P did a blog on how they do this for their Eddies web demo.

    Hi Wayne, i have just search the Xojo blog for SQLite but cannot find any posts by Geoff or about Eddies web demo.

  4. Wayne G

    22 Oct 2019 Testers, Xojo Pro, MVP Answer Auckland, New Zealand

    Perhaps it was before it became Xojo. Basically the steps are you create your in-memory database, attach the physical db and then use a bunch of select into statements to copy tables & data into your in-memory version. You would reverse the process to write the data back to the physical db file.

  5. Nathan W

    23 Oct 2019 Testers, Xojo Pro Europe (UK, Jersey)

    Thanks Wayne, that makes sense.

  6. Jay M

    23 Oct 2019 Testers, Xojo Pro NC, USA

    Javier wrote about it here .

  7. Maurizio R

    23 Oct 2019 Testers, Xojo Pro

    SQLiteDatabase.Backup

  8. Oliver O

    24 Oct 2019 Testers, Xojo Pro https://udemy.seminar.pro
    Edited 8 months ago

    I used to instantiate a sqlitedatabase object without database file, so it exists in memory. Then attach a database to it And select into the memory db from the file db.

    Now deprecated:
    https://docs.xojo.com/SQLiteDatabase.AttachDatabase

  9. Dave S

    24 Oct 2019 San Diego, California USA
    Edited 8 months ago

    Using the above mentioned BACKUP feature built in to SQLite is much easier, and faster.... just 2 or 3 lines of code, and no need to worry about the schema layout (ie. you don't need to know the table and field (oops row) names)

    and AttachDatabase has been renamed to AddDatabase (even though SQLite themselves uses ATTACH)

  10. Norman P

    24 Oct 2019 Testers, Xojo Pro outside admiring the sunshine,...

    AddDatabase sounds much more like CreateDatabase but .....

  11. Dave S

    24 Oct 2019 San Diego, California USA

    Createing a NEW database connection would be "adding".... while "Attach" is exactly that.. it extends a current connection

  12. Norman P

    24 Oct 2019 Testers, Xojo Pro outside admiring the sunshine,...

    right .. attach was the right word before and still is
    but when you have to change something well .... :)

  13. Dave S

    24 Oct 2019 San Diego, California USA
    Edited 8 months ago

    dunno.. but the word "STUPID" comes to mind

or Sign Up to reply!