NAME
LinkVarToDbGlobal — Put trace on variable so the database global gets writ also.
SYNOPSIS
LinkVarToDbGlobal VarName ?DbGlobalName?
DESCRIPTION
Return Value
None.
Arguments
VarNameName of variable to put trace on.
DbGlobalNameName of variable in globals table to update whenever traced variable is written to.
More Info
This command will begin by writing a database global with the current value of the variable. If either the Tcl variable or the database global does not exist, then it will be created.

Currently, there is no option for this command to begin the link by first reading the database global value into the Tcl variable. However, it is still possible to accomplish this yourself with a series of commands (viz. GetDbGlobal).

To stop updates, call UnlinkVarFromDbGlobal

You may wish to take a look at the documentation about the XxxDbGlobal commands: About XxxGlobal.

Check About Configuration for Database Use for info about how to set up Gen for using database-related commands.


For information regarding exceptions / errors, see here.
EXAMPLES

This code: (1) Creates a variable, (2) Links it to a database global, (3) Shows that the database global has the same value, (4) Changes the value, (5) Shows that the database global also changes.

% set MyVar 123
% LinkVarToDbGlobal MyVar
% puts [GetDbGlobal MyVar]
123
% set MyVar 345
345
% puts [GetDbGlobal MyVar]
345
SEE ALSO
UnlinkVarFromDbGlobal
KEYWORDS
sql