Functions, function strings, and function-string classes

In order to operate in a heterogeneous database environment, Replication Server differentiates database commands from the functions it uses to distribute data server requests to other sites. A function is a Replication Server object that represents a data server operation such as insert, delete, and begin transaction. Replication Server uses function strings to convert functions into data-server-specific commands. A function string is a template that Replication Server uses to generate a command the data server can interpret as a transaction-control directive or data-modification instruction.

A function-string class is the set of all function strings used with a database. Function-string classes are provided for Adaptive Server and DB2 data servers. Function strings for transaction control directives are defined just once for each function-string class. Function strings to insert a row, delete a row, or update a row are defined once for each replicated table in a database.

A function string can contain variables—identifiers enclosed in question marks (?)—that represent the values of columns, procedure parameters, system-defined information, and user-defined variables. Replication Server replaces the variables with actual values before sending the function strings to the data server.

Function strings can be used to generate either RPC or database commands such as SQL statements, depending on their format. An RPC-formatted function string contains a remote procedure call followed by a list of data parameters. Embedded variables can be used to assign runtime values to the parameters. Replication Server interprets RPC function strings, builds a remote procedure call, and replaces the variables with runtime data values. An RPC can execute a registered procedure in an Open Server™ gateway to a data server or a stored procedure in an Adaptive Server.

A language-formatted function string passes a database command to the data server. Replication Server does not attempt to interpret the string, except to replace embedded variables with runtime data values. For example, several relational database servers use the SQL database language. A SQL command should be represented as a language function string.

RPC function strings can be more efficient than language function strings because the network packets sent from Replication Server are more compact.

NoteReplication Server 15.2 and later includes function string classes pre-loaded with function strings for actively supported databases. See “Connection profiles,” in Chapter 7, “Managing Database Connections” in the Replication Server Administration Guide Volume 1.