Programming Guide



dm_gen_get_tv_alias

Gets the correlation name or alias for a table view

#include <tmusubs.h>
char *dm_gen_get_tv_alias(char *tv_name);

tv_name
Specifies the table view name.

Returns

Description

dm_gen_get_tv_alias returns the correlation name, or alias, for the specified table view name.

Generally, the SQL generator uses the value in the table view's Name property as the table's correlation name in a generated SELECT statement. However, if the table view name contains illegal characters for a correlation name, the SQL generator removes the offending characters.

The SQL generator calls this function to generate correlation names. If you modify generated SQL statements with one of the dm_gen_change functions and any argument supplies a column name, you must supply the proper correlation name.

Example

# JPL Procedure:
# Adds a column to the select list for the current \
# server view and sets copy as the target.

proc rentals_hook(event)
{
vars retval(5) colexp(64)

if (event==TM_SEL_BUILD_PERFORM)
{
colexp=dm_gen_get_tv_alias\
(sm_tm_pinquire(TM_TV_NAME) ## ".copy_num")

retval=dm_gen_change_select_list\
("", colexp, "copy", DM_GEN_APPEND)
}
return TM_PROCEED
}