Make your own free website on Tripod.com

SQLforms database tool

What's SQLforms | Downloads | Home


What's happening now

I have been cleaning query.tcl and testing it in several practical examples. Introduced a error function (with bgerror), because errors from the backend are left undetected otherwise.

Finally I've got some time to finish all table creation/copying/deleting in the popup menu. Some small bugfixes done too.

See by yourself. This is the fourth (last?) snapshot of today. I'm planning to redo all tktable stuff to make it reusable in other applications, because it is becoming too mucky.

new editor
The new editor is becoming easy to use.

Some cosmetic changes and a bunch of anoying bugs removed. This is the third snapshot today!! I would like to receive some feedback. Are you testing this program? Please send me a small e-mail telling what you like or dislike about it. Perhaps some changes in the design. Now is the time for the big changes!

It is doing some attribute editing now (sort of). We may ędd or remove columns from a table now, maintaining all data, as long as we don't change the old columns (attributes) properties. The only thing in the popup menu that's working is "edit table". The remaining entries are easier to do :)

Now I have done most of table data editing. To delete a row, put the mouse at any field of it and press Shift-Delete. Widget redrawing is being done better too. I also did remove all spurious queries taking place when we're not modifying any field, just moving around.

The new snapshot (see downloads section) now edit table data. If you input new data to the last (blank) row in the table, the new tuple will be inserted into the table. If otherwise, you just change the values of some fields, the tuple will be updated, not inserted as a new data. The default indexing attribute is the first field, so don't change it, or something strange may occur...

To run this script it's needed TkTable. After much time spent trying to make lots of entries arranged with the grid command, I found it too slow to be useful in a real application. TkTable is very much faster! Look for it at http://www.unifix-online.com or your favorite tcl/tk repository.


What's SQLforms

sqlforms edit
Fig.1 The editor features a hierarchy (BLT's hierbox) widget for selecting the database table to be modified or viewed.

SQLforms is an interactive application generator for integrating PostgreSQL queries into tcl/tk forms. It is not very dissimilar to MS-Access®, Paradox®, and other database tools. Nevertheless, not everything is already done. I plan to improve it gradually, as my free time allows.

The first implementation, uploaded to Metalab, suffered from severe restrictions that made it difficult to scale well. That's why I have redesigned it, trying to make it more modular. (I have learned a lot of tcl since then too!) Here you will find some screenshots of it running, and snapshots of the package. If you make some improvements, or simply have a suggestion, please send to my e-mail address and I'll include it in the next snapshot ( and acknowledge your contribution, of course :)

fields definition dialog
Fig.2 The dialog for fields definition in a table.

We have actually several disconnected programs, mostly for experimenting some ideas: query.tcl implements a library for automating the most commonly used queries; database.tcl have some useful system tables queries; editdb.tcl is the editing tool (fig.1 and fig.2) for creating and editing tables or their content data; multi.tcl is an example of a multi-record access through tcl arrays.

If you follow some naming conventions for the table's fields, most queries can be assembled automatically by the query library:

If those rules don't apply, you can define by yourself the select, update, insert or delete query strings.

old sqlforms

The old sqlforms was similar to my Slidedraw program, doing the form editing into a canvas. The objects could be entries, labels (text), or lines, rectangles and such things, mostly for decorating purposes. The relations and it's relationships are assigned by some menu commands, aned saved to array variables. The generated form is just a bunch of canvas commands, intermixed with tcl's set statements to recover the state of the variables.

Fig.3 The old sqlforms with it's navigation bar and a sample form opened.

For instance, the form at fig.3 (file clientes.frm in the old sqlforms distribution) have the following statements, besides the canvas commands:

dbConnect estoque
set base nvclient
set frm(.c.descconv) {nvconv descconv {}}
set frm(.c.nome) {nvclient nome {}}
set frm(.c.end) {nvclient ender {}}
set frmv(.c.reg) {$sld(ntuplas) ? $sld(iconsulta)+1 : 0}
set frmv(.c.num) {$sld(ntuplas)}
set rel(nvclient,nvconv) {{nvclient convcli} {nvconv codconv}}
These commands are difficult to change, if we need some non-automated queries. So, it had to be changed, preferably by redesigning everthing!

Downloads

Here are the latest snapshots, from newest to oldest:

The old sqlforms could be got elsewhere (see my main page, for instance), but beware it will not be supported anymore.


Home