Input templates are used only for non-bulk materialization and for dematerialization with purge—those situations where Replication Server must select data to add or delete from selected tables. rs_select and rs_select_with_lock are the only function strings that can contain input templates. Replication Server determines which function string to use with a subscription during materialization or dematerialization by:
Matching the subscription’s replication definition
Matching the input template with the where clause used in the subscription
rs_select and rs_select_with_lock also contain output templates to specify the actual select statements or other operations that perform the desired materialization or dematerialization.
For the system-provided classes, Replication Server generates default function strings for the rs_select and rs_select_with_lock functions when you create a replication definition. Generally, you only need to customize these function strings if multiple subscriptions exist for your replication definition.
Function strings for the rs_select and rs_select_with_lock functions are most often used for materialization. If you plan multiple subscriptions to the same replication definition, create the function strings before you create the subscriptions. See “Subscription materialization methods” on page 381 in the Replication Server Administration Guide Volume 1 for more information about subscription materialization.
Function strings for rs_select and rs_select_with_lock may also be used for subscription dematerialization, which uses the where clause of the command used to create the subscription. The function strings for these functions must exist before you drop the subscriptions. See “Using the drop subscription command” on page 409 in the Replication Server Administration Guide Volume 1 for more information about dematerialization.
An input template can contain user-defined variables whose values come from constants in the where clause of a subscription. No other types of function-string variables are allowed in input templates. An output template in the same function string can reference these user-defined variables.
If you need to customize an output template to select materialization data, you can omit the input template from an rs_select or rs_select_with_lock function string. Doing so creates a default function string that can match any select statement when no other function string’s input template matches the select command.
As with other functions with replication-definition scope, you create function strings for the rs_select and rs_select_with_lock functions in the primary Replication Server where the replication definition was created.