nscerqueira Some examples of tcl and sqlite usage:
NOTE: the name of the database is opendb
package require sqlite3 sqlite3 opendb "database.db" ; # Open up an existing database or create a new empty one. set tableNames [opendb eval {SELECT tbl_name FROM sqlite_master}] puts $tableNames
opendb eval "SELECT * FROM $tableName LIMIT 1" x {set columnName $x(*)} puts $columnName
jnc You can also use the PRAGMA statement table_info(table_name) to retrieve column information. See http://sqlite.org/pragma.html for a list of all PRAGMA statements.
set columns [opendb eval "PRAGMA table_info($tableName)"] puts $columns
opendb eval "Select * FROM $i" values { set columnNames $values(*) set rowList {} foreach column $columnNames { lappend rowList $values($column) } puts $rowList }
JOB Anyone interested in some date arithmetics - the sqlite database can do it all! The classical days between date function the SQL way goes like this:
-- note: sqlite doesn't need select ... from dual SELECT julianday ( current_date ) - julianday( DATE('....-09-25'));