Not logged in

Tcl wrapper for SQLite3 dataset

Note: dataset location is DBROOT enviroment variable or current directory.

See debian package.

Package provide some functions in ::dataset:: namespace. These are

For more examples see Tcl test files in debian package.

In the example below we will open in-memory database and attach ./telephony/current.db, create and populate table test, print csv output of all records from table test and drop single record from table test by id. The first argument of "with" function is database handler, second argument is primary database name and next zero or more arguments are attached databases names and the last argument is script body.

package require sqlite3-dataset
::dataset::with mydb :memory: telephony,current {
    puts [mydb eval {pragma database_list}]
    puts [string repeat = 70]
    mydb eval {create table test(id INTEGER PRIMRY KEY, a)}
    ::dataset::insert test {a myvalue}
    ::dataset::insert test {id 10 a myvalue2}
    puts [::dataset::table2csv test {id a}]
    ::dataset::delete test {id 10}

The result:

0 main {} 2 telephony,current /srv/test/sqlite3/./telephony/current.db