ADB - A(nother) database engine for Tcl/Tk Developed by [Roalt Aalmoes] Important websites concerning ADB/ADBSQL: * http://adbsql.sourceforge.net/adb.html - Manual page of ADB * http://adbsql.sourceforge.net/adbsql.html - Manual page of ADBSQL * http://sourceforge.net/projects/adbsql/ - Sourceforge page where the project is stored and can be downloaded. ADB together with its MySQL database connectivity module [adbsql] are a Tcl/Tk package useful for Tcl/Tk programmers that want to store their data in a database-kind of way with tables and fields. ADB support at this moment one database at a time, but within this database multiple table can be defined. Two (optional) features of ADB that may make it worthwhile for you: * Writing the database as XML output and later of course the ability to read it. For this purpose, the well-known [tDOM] package has to be installed. * Connecting directly to a MySQL database. For this purpose the [mysqltcl] package has to be installed as well. The fun part of ADB is that you can either use it as a full pure tcl library, or you can use these advanced features. Short history: This package has been used for many years in my [ATDOR] program. A Track and Field meeting organisation program. I've decided that the database engine in this program might be useful for many other purposes. The [ATDOR] program, currently uses an older version of this library, will be re-released later to use this version. So see http://www.atdor.com for a application of approx. 20k lines of code using it. **Examples of how to use it** To initalise a table: ====== proc AthletesDBKey { rec } { return [[lindex $rec 0]] } set structure { {no "Licence number" 10 p alphanum} {firstname "First name" 20 {} alphanum} {surname "Surname" 20 {} alphanum} {sex "Sex" 10 {} alpha} {birthday "Birthday" 4 {} int} {club "Club" 30 {} alphanum} {category "Category" 10 {} alphanum} } ADB::Init Athletes $structure AthletesDBKey ====== To add a new record: ====== ADB::GetEmptyArray Athletes new_arr set new_arr(no) 12445 set new_arr(firstname) John set new_arr(surname) Doe set new_arr(birthday) "01-01-2001" ADB::Add Athletes [[array get new_arr]] ====== To fill an array with a record: ====== ADB::GetArray Athletes 12445 athletearr ====== To parse over all records in a table: ====== proc ForAllAthletes { } { set atlkey [[ADB::FirstKey Athletes]] while { "$atlkey" != "" } { ADB::GetArray Athletes $atlkey athletearr # Do something with array athletearr, for instance: puts "Surname is $athletearr(surname)" set atlkey [[ADB::NextKey Athletes]] } } ====== An example.tcl file is included that contains these and other examples. ---- [ZB] 14.07.2008 - I think, that every TCL-er interested in database applications is more familiar with SQLite - so "quick comparison" would be handy. ---- <> Database