Programming Guide |
Appends text to the end of a SELECT statement for automatic SQL generation
#include <tmusubs.h>int dm_gen_change_select_suffix(char *arg, char *suffix);
arg
- Reserved for future use.
suffix
- The suffix to append to the generated
SELECT
statement.
dm_gen_change_select_suffix
lets you append text to the end of a generatedSELECT
statement built with the SQL generator. For example, you can use this function to add aFOR UPDATE
clause to the end of aSELECT
statement. The data structure for theSELECT
statement, built by an earlier call to dm_gen_sql_info (generally in theTM_SEL_GEN
event), must already exist before this function is called.By default, the SQL generator builds the statement based on the widgets' and table view's property settings. For more information on the SQL generator, refer to Chapter 33, "Using Automated SQL Generation," in Application Development Guide.
You can use this function in a transaction manager event function that processes the
TM_SEL_BUILD_PERFORM
event. To modify the select processing for a server view, calldm_gen_change_select_suffix
from an event function that is attached to the first parent table view in the server view.For more information on writing transaction event functions, refer to Chapter 32, "Writing Transaction Event Functions," in Application Development Guide.
# JPL Procedure:
# Fetch data from titles for possible update.
# Function property is set to titles_select.
proc titles_select (event)
vars retval(5)
if (event == TM_SEL_BUILD_PERFORM)
{
retval = dm_gen_change_select_suffix("", "for update")
if (retval != 0)
return TM_FAILURE
}
return TM_PROCEED