On Sat, May 1, 2010 at 9:25 AM, Tim Romano <tim.romano...@gmail.com> wrote:
> I am aware that SQLite supports > loadable extensions, but would the SQLite architecture also permit the > integration of an interpreted scripting language? An integrated scripting > language makes an already powerful database engine orders of magnitude more > useful especially when one is solving ad hoc data problems requiring very > rapid turnaround. > See http://www.sqlite.org/tclsqlite.html for the original. SQLite began life as a TCL extension. In fact, we often think of SQLite as a TCL extension that escaped into the wild. The integration between TCL and SQLite is very tight. If you know where to look, you will see that many features of SQLite were designed specifically to support integration with TCL. An example of TCL using SQLite: db eval {SELECT name FROM people WHERE personid=$personid} { puts name=$name } The "db" is an TCL object which represents an open SQLite database connection. "eval" is the "evaluation" method. Within the SQL text, we see a TCL variable $personid. That is really implemented as an SQL parameter, but the TCL wrapper knows to loop over all SQL parameters, look up the corresponding TCL variables, and bind them. The stuff that follows is a script that runs for each row returned. The columns of the SELECT statement are stored in TCL variables making them very easy to access. If you want to compile a TCL interpreter than includes SQLite, it is simple to do. Just obtain the tclsqlite3.c amalgamation (available on the download page) and run this: cc -o tclsh -DTCLSH=1 tclsqlite3.c -ltcl -ldl -lpthread -lm You might have to adjust the list of libraries at the end of the compiler command-line, but that is basically all that is required. The resulting "tclsh" is a script interpreter that includes full SQLite integration. Yes, SQLite can be bound to other scripting languages. But it was designed for TCL and the integration with TCL is very tight, seamless, and easy to use. In all other wrappers that I am aware of, the binding of parameters and the looping over result rows are separate explicit steps, not built into the language the way their are with TCL. A tclsh with integrated SQLite support is a very convenient tool to have at hand for many common tasks. -- --------------------- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users