Datatype translation

In general, datatype translation can be divided into two categories: trivial and nontrivial.

Trivial datatype translation

Trivial datatype translations can be reduced to a translation between two Replication Server native datatypes (for example, int to char, datetime to char, or decimal to real). These translations are supported by the Open Client/Server function cs_convert. Refer to the Open Client/Server documentation on cs_convert for the kinds of translations supported and any limitations.

Nontrivial datatype translation

Nontrivial datatype translations are those in which the target datatype is a user-defined datatype, and where the user-altered attributes include more than just delimiters. For example, translation from the Sybase datetime datatype to the DB2 TIMESTAMP datatype is considered nontrivial, because these two temporal datatypes support different ranges of values. However, a translation from binary to the DB2 CHAR FOR BIT DATA datatype is trivial, because the two sets of attributes are identical except for their delimiters.

Levels of datatype translation

In Replication Server, datatype translations can be specified at:

Each Replication Server connection is associated with exactly one function-string class. Therefore, the datatype translations defined for a function-string class are associated with each connection that is defined with that function-string class. Class-level translations define default translations for the connection by specifying a set of source and target datatypes so that any value sent over that connection with a datatype that matches the source datatype is translated into the associated target datatype.

Unlike function strings, class-level translations are not inherited. Moreover, class-level translations offer the only means to translate values associated with system-defined variables.

Replication Server has no user interface for creating class-level translations. Therefore, Sybase supplies SQL scripts to create class-level translations that support some of the more common datatype translations.

Column-level translations can be specified in a replication definition for a given column by using the map to clause of the create replication definition or alter replication definition command. You can use column-level translations to fine-tune datatype translation on a column-by-column basis, per replication definition.

Column-level translations provide a performance advantage over class-level translations. However, only class-level translations can be used to translate values of system-defined variables.