![]() | Programming Guide | ![]() |
Fetches data from the database to be updated
int sm_tm_command ("SELECT [tableViewName[tableViewScope] ]");
tableViewName- The name of a server view in the current transaction. This parameter is case sensitive.
If
tableViewNameis specified, the command is applied according to thetableViewScopeparameter. (Since the entire table view tree might not be included, this is known as a partial command, andsm_tm_commandsetsTM_FULLto0.) The specified table view must either be a server view or be the server view to which the desired table view belongs.If
tableViewNameis not specified, the command is applied for each table/server view, starting with the root table view. This is known as a full command, andsm_tm_commandsetsTM_FULLto1.tableViewScope- One of the following parameters, which must be preceded by a table view name.
TV_AND_BELOWwhich applies the command to the specified table view and all table views below it on the tree. If no parameter is specified, the transaction manager acts as thoughTV_AND_BELOWwas supplied.
BELOW_TVwhich applies the command to the table views below the specified table view.
TV_ONLYwhich applies the command to the specified table view only.
SV_ONLYwhich applies the command only to the table views of the specified server view.
SELECTfetches data from the database so it can be modified. In order to success fully update data or insert new data, all the fields in a server view which are included in the select list need to have the same number of occurrences.After you choose
SELECT, the following steps occur:
- If you have made changes in the table views on which this command operates in a previous
NEW,COPY,COPY_FOR_UPDATE, orSELECT, you are prompted to discard your changes. If you chooseOK, changes are discarded and fields in the specified table views are cleared. If you chooseCancel, you return to the screen so you can save your changes.- The transaction mode is set to update unless a table view is specified and the mode is not initial mode. By default, update mode protects the primary key fields from data entry and sets the display attributes differently for key and non-key fields.
- If the Count Select property is set to Yes, the transaction manager issues a SELECT statement using
COUNT(*) to find the number of rows in the select set. If this number exceeds the amount set in the Count Threshold property, a message box offers the user the choice of discontinuing data selection.- The screen displays the first set of data for all linked table views. When you choose
SELECT, the standard transaction models have the SQL generator execute aSELECTstatement for the database table named in the root table view and any table views connected to it via a server link. Then, recursively,SELECTstatements are issued for the child table views having sequential links, and any table views connected to those child table views by server links.- The before image, or snapshot, of the screen is taken for the screen\Qs updatable table views. An updatable table view must have its primary key fields on screen. Any changes made to the screen following this step can then be processed using a
SAVEcommand.Push buttons and menu selections for the
SELECTcommand can choose to set the class property toview_button. By default,view_buttonis active in initial or view modes.
If you want to select a specific record or group of records, set the widget's
use_in_whereproperty toPV_YESand the type of operator (where_operator) to be used in theWHEREclause. Then, in the transaction manager, chooseCLEARto clear the fields, enter a value in your query field, and then chooseSELECT. The screen displays the specified information.
If the server view's Count Select and Count Warning properties are set to Yes, the application will warn users about large select sets; however, the
SELECTstatement is performed twice, and the tables must remain locked for the result to be the same for both statements.
To save the changes or additions made to the selected data, choose
SAVEas the next transaction command.To display the next row of information, choose
CONTINUEas the next transaction command. If you have updated the data on the screen, you are prompted to discard your changes. If you chooseOK, changes are discarded. If you chooseCancel, you return to the screen so you can save your changes.To discard any changes you have made to the screen, choose
CLOSEorFORCE_CLOSE. For some database engines, such as SYBASE CT-Lib, theCLOSEcommand does not release the database locks when aSELECTcommand is not followed by aSAVEcommand. In this case, follow theCLOSEwith theRELEASEcommand which gives up the locks on the database.
The following request events can be generated by the
SELECTcommand to ascertain whether the changes from the previous command have been saved and, if desired, discard those changes:
TM_PRE_CLOSE(described underCLOSE)
TM_CLOSE(described underCLOSE)
TM_QUERY(described underCLOSE)
The
SELECTcommand generatesTM_CLEARrequests ifTM_SELECTfor a parent table view returns no data. In that case,TM_CLEARis generated for all subordinate table views, but not for table views at the same level of the tree.TM_CLEARrequests are described underCLEAR.
Table 8-31 Table 29. the SELECT command.
If
TM_SELECTfor a parent table view returns no data,TM_CLEARrequests are generated for all subordinate table views, but not for table views at the same level of the tree.TM_CLEARrequests are described underCLEAR.
![]()
![]()
![]()
![]()