-
Notifications
You must be signed in to change notification settings - Fork 1
In Memory Database
SQLite databases have the concept of an in-memory database https://www.sqlite.org/inmemorydb.html
Genero introduced database drivers for use with SQLite databases in 2.20 http://www.4js.com/online_documentation/fjs-fgl-manual-html/#fgl_whatsnew_220.html
As a result, Genero can utilise in-memory databases. These are very handy for small examples, tutorial programs etc whereby we can ship programs and avoid any possibility of mis-configuration of databases.
So you can use a line like
CONNECT TO ":memory:+driver='dbmsqt'"
which says connect to a database named ":memory:" using the SQLite driver (dbmsqt), and where :memory: is the reserved word used by SQLite to indicate the database is in memory rather than an external file.
If you want to try a quick example for yourself, try this code with Genero 3.0
MAIN
DEFINE l_count INTEGER
CONNECT TO ":memory:+driver='dbmsqt'"
#CONNECT TO ":memory:" -- you can use this syntax if default database driver in FGLPROFILE is SQLite
CREATE TABLE foo (bar INTEGER)
INSERT INTO foo VALUES (1)
INSERT INTO foo VALUES (2)
SELECT COUNT(*)
INTO l_count
FROM foo
DISPLAY l_count
END MAIN
I would encourage you to learn this syntax and use it if you ever need to send code samples to support where you need some database but don't need your entire database.