Heterogeneous replication and text, unitext, image, and rawobject data

To replicate text, unitext, image, and rawobject data from a non-ASE data server into an Adaptive Server database, you must include the text, unitext, image, and rawobject data in the replication definition so that a subscription can be created for the Adaptive Server database. However, you might not want to replicate the text, unitext, image, and rawobject data into other replicate data servers, whether they are other foreign data servers or other Adaptive Servers.

With the none output template option, you can customize rs_writetext function strings to map operations to a smaller table at a replicate site and to instruct the rs_writetext function string not to perform any text, unitext, image, or rawobject operation against the replicate site.

There is one rs_writetext function string for each text, unitext, image, and rawobject column in the replication definition. If you do not want to replicate a certain text, unitext, image, or rawobject column, customize the rs_writetext function string for that column. Specify the column name in the create or alter function string command, as shown in the example below. You may also need to customize the rs_insert function string.

Example

Assume that a replication definition does not allow null values in a text, unitext, image, or rawobject column and that you do not require certain text, unitext, image, or rawobject columns at the replicate site.

If inserts occur in those columns at the primary site, you must customize the rs_writetext function strings for the text, unitext, image, or rawobject columns that are not needed at the replicate site. You must also customize the rs_insert function string for the replication definition.

For example, assume that you have primary table foo:

foo (int a, b text not null, c image not null)

In foo, you perform the following insert:

insert foo values (1, "111111", 0x11111111)

By default, Replication Server translates rs_insert into the following form for application by the DSI thread into the replicate table foo:

insert foo (a, b, c) values (1, "", "")

The DSI thread calls:

Because null values are not allowed for the text column b and the image column c, the DSI thread shuts down if the replicate table does not contain either column b or column c.

If the replicate table only contains columns a and b, you need to customize the rs_writetext function for column c to use output none, as follows:

alter function string foo_repdef.rs_writetext;c
	for rs_sqlserver_function_class
	output none

You must specify the column name (c in this example) as shown to alter the rs_writetext function string for that column.

If the replicate table only contains columns a and b, you also need to customize the rs_insert function string for the replication definition so that it will not attempt to insert into column c, as follows:

alter function string foo_repdef.rs_insert
	for rs_sqlserver_function_class
	output language
	'insert foo (a, b) values (?a!new?, "")'

You do not have to customize rs_insert if the replication definition specifies that null values are allowed for column c. By default, rs_insert does not affect any text, unitext, or image columns where null values are allowed.