To configure Gen for using the database-related commands, you need to do the following four steps:
Note that Gen is currently set only for SQLite usage and does not use TDBC.
This is simply the command sqlite3 dbcmd database-name
, for instance: sqlite3 mydb c:/my.db
.
Note that with Gen, you are responsible for opening and closing connections and telling Gen what connection to use (see next section).
Here you only have to give Gen the dbcmd you set up in the previous step. You want to set the GenNS::DatabaseName
variable. For instance, set GenNS::DatabaseName mydb
.
This is used whenever Gen has to interact with a database. Gen does not have capabilities to change around connections on a per-command basis (perhaps in the future we will add flags for that). However, you can yourself do a set GenNS::DatabaseName
again to change the connection.
If you want Gen to use something other than "globals" for the name of its globals table, then you set GenNS::GlobalsTable
. For instance, you could do set GenNS::GlobalsTable my_globals
or set GenNS::GlobalsTable the_globals
, etc.
To do this you can run the following code:
RunSqlCreateTable globals {id {integer primary key} desc text intvalue integer realvalue real textvalue text}
Note that you can, alternatively edit gen-config.tcl
by hand to set the variables (though you must take care when you upgrade to a new version of Gen, since those values may be overwritten).