This package provides a command named editDb that allows to edit
postgreSQL tables; it relays on Tktable .
The main proc is
editDb -sql "select * from products where code ~'ABC'" -maskwill pop a window of the result of the sql statement above. Opt. -mask allows to have a view in a mask (as shown aside) instead of a TkTable. Two views can coexist.
Hooks are provided to trigger validation on row and cell change. Single field can be turned not editable. Filter abilities is provided in very simple way, on the resulting table/mask.
bind $e <Return> {
# get what has been written in $e
set cond [ifVar %W -cond {job_code ~'@v'} ]
# $cond is empty or a complete 'where statement'
set sql "select job_code,job_description from jobs $cond"
# the query...
popSqlQuery $pg::p -sql $sql -arr Arr
-cmd {ShowJob $R(job_code)}
-msg0 "Sorry, no jobs w/ this code"
-cmd0 "sd::Tell {Try changing something}"
}
Where the last two opts are there just to show that there are ways to tell
what to do in case of no match. In case of many matches a listbox is popped
w/ all the alternatives.
After each click on the elements of the listbox the cmd (-cmd opt) is triggered and the array Arr gets defined (As from above would be A(job_code), A(job_description))
It is possible to have a table view and a "mask" view (shown in the figure)
In my application I needed a simple replication system. I arranged a proc (pg::exec) that calls pg_exec but if variable pg::log_table is defined it also stores the sql statement in table $pg::log_tabe.
More information in doc/Replica.txt