The following is organized more like a reference manual, there is little tutorial material. You may want to look at the sample scripts to get a quick idea.
The SQLDBTYPE environment variable decides what database code is going to be used. It has two possible values:
The default if the variable is not set is to use MYSQL. Don't depend on it.
This variable can be set inside the script, before the first call to sqlscreen. (It is set to MYSQL inside the sample scripts). Of course, the value of this variable must be consistent with what extensions are available to the TCL interpreter (See installation).
The SQLSCLOG environment variable can be set to the name of a file where Sqlscreens will log the SQL statements it executes. The default is to log to stdout.
The SQLSCHOST, SQLSCUSER, and SQLSCPASSWORD variables can be used to set the connection parameters. These are only used by the sample scripts, not the core package.
MYSQL_TCP_PORT should be used if you need to change the default MySQL connection port.
Each screen has a set of buttons to perform the following operations:
starts a SELECT. The WHERE clause is built with the values currently shown on the screen and the nodisplay fields).
fetches the next record in the current query
gets back to the first record in the current query. This has different effects depending on the database: in INFORMIX this actually reruns the query so that changes in the database will be visible. With MySQL, this just rewinds the local result buffer.
clears all visible and hidden fields in the screen.
inserts the current values. There is special handling for auto_increment fields, see SQL generation
updates the row according to the current values (how the where clause is built is described later, see updateindex and Sql generation ).
deletes the row(s) selected by the current values. It will prompt for confirmation if more than one row would be affected.
The Update and Add buttons may not exist on all screens (some screens may be set up only for querying).
Delete is not created by default (See allowdelete ).
The SQL generation section describes how the SQL statements are generated for the different actions.
Often, when doing data entry, it is inconvenient to have to reach for the mouse to perform an action. A set of keyboard shortcuts is provided to make things smoother:
goes to the next field in the screen.
in any field will start a SELECT.
will fetch the next row.
will rewind the query.
will start an INSERT.
will start an UPDATE.
will reset the current screen (clear all fields).
The Update and Add shortcuts will have no effects in query only screens. There is no Delete shortcut.
The '<' and '>' characters will be interpreted when entered as the first character in a non-string field. Actually, if such a field begins with '<', '>', or '=', whatever is entered in it will be included in the WHERE clause when querying. For example:
If you enter ">10" in a field named "quantity", a "quantity > 10" condition will be inserted in the WHERE clause. You could also enter ">10 and quantity < 20", or whatever condition you need. (See also the paragraph about SQL generation ).