Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on May 14, 2020, 07:46:08 am



Title: Ask Reuben 23 - SQLite In-memory Database
Post by: Reuben B. on May 14, 2020, 07:46:08 am
With libraries, samples etc that are in the FourJs Genero GitHub repository such as fgl_zoom, we need to run the program against a database.  However we want the program to run out of the box, we don't want you to have to configure to your own databases or to have to cater for database differences not catered for by the ODI layer   We want the repository to be as simple as possible so that it can be downloaded, compiled, and executed in 3 simple steps.

A technique I use is to take advantage of the fact that SQLite has a built-in in-memory database.  That is rather than having the SQLite database stored in an ordinary disk file, it is stored in memory.  With SQLite this is achieved with a special database filename of ":memory:".  For our Genero configuration this simply means that when specifying a connection to a SQLite database to also use this special filename of ":memory:” . You will see this in our repositories with a line of code ...

Code
  1. CONNECT TO “:memory:+driver=‘dbmsqt’ "

This in-memory database has a lot of potential uses.

Read more at https://4js.com/ask-reuben/ig-23/