Tclsql is a Windows-only C++-based SQL 3.0 ODBC extension for reading,inserting,updating, and deleting records from a database. The source code and nifty starkit on how to use tktable with SQL Server are included at the sourceforge project website. The starkit show's a working example of how to update a SQL table using the tktable widget.
Tclsql has been tested extensively on Windows using SQL Server 7 and SQL Server 2000. However, it should be able to work with Oracle, Access, etc. and compile under Linux with the right libraries. The original version was written a few years ago. I took a college course on C/C++ and wanted to apply what I had learned, and thought this would be something fun to program. I programmed it because at work I mostly program in Tcl and VB and do not get much of an opportunity to program in C or C++.
I added a few new Tcl commands to expose more of the C style ODBC methods to Tcl. I know there's a much more popular ODBC extension already available called TclODBC that has a more Tclish feel.
At the time when I wrote this, I didn't even know there was another flavor of Tcl ODBC available until after I programmed it and had posted it to sourceforge. I was still fairly new to Tcl and did not know about making an extension feel Tclish.
If anyone is interested in this extension then I can update the extension to make it be more Tclish. It does expose a few ODBC calls the original that TclODBC does not, and TclODBC has a few features this one does not too. Who knows, maybe it has some useful feature that's needed? You can also get to a database using tcom through ADO ActiveX calls.
I've tested this extension with Tcl Threads and it seems stable. The only gotcha I know is to make sure this runs in a separate Tcl thread than tdom.
The project files and the Windows compiled library (DLL) can be downloaded from SourceForge.net at the following link.
I have included the sources, and directions in the zipped file if you wish to review them.
Also, I've included a nifty dbtool starkit for a Windows Tk application under TclSQL 1.2 file releases. It's called DBTool.kit and DBTool.exe, and it allows a user to make changes to already existing SQL tables without having to use SQL Query Analyzer or SQL Enterprise Manager. It seems to work fine with SQL Server 7 and 2000. It should work with other DB's too, but the SQL update query within the Tcl source may have to be updated for the DBMS. The Tcl sources also show how to embed widgets into cells so a user does not fat finger a critical DB field.
I was going to put the the extension reference below, but it's included in the download anyway. Please let me know what you think of the extension and dbtool.kit package.
TclSQL uses ODBC 3.0. There's some code to covert all data types when they are returned to Tcl as TclStringObj's. I've tested SQL queries that use varchars, chars, ints, and datetimes with out problems. I'd say regarding datatypes NVARCHAR and NTEXT give it a try and find out. I'm guessing it will work. Most of the C ODBC API calls have been ported to Tcl. I am currently working on porting SQLPrepareStmt in the API too. This function allows for the fastest updates and inserts because the query gets precompiled. I also am working on trying to make the Tcl commands more Tclish. Right now the Tcl commands match the underlying C function calls. I do remove some of the C complexities and put this behind the scenes.