Modifications to text or image data

The rs_datarow_for_writetext and rs_writetext forms of the applied subcommand are used to distribute modifications to text or image data. These subcommands are built on the Replication Server version 10.1 performance feature of packing data as structured tokens. Each text or image column has a special character and length field, followed by the actual data value. Packing the data in this way eliminates the need for Replication Server to interpret every byte of data, which provides performance benefits.

rs_datarow_for_writetext carries an image of the data row associated with a text or non-image column that has been modified by the Transact-SQL writetext command, by the Client-Library™ function, ct_send_data, or by the DB-Library™ functions dbwritetext and dbmoretext. The image is used by Replication Server to construct the primary key for subsequent modification at the replicate database. The syntax for rs_datarow_for_writetext is:

distribute command_tags applied
 'table'.rs_datarow_for_writetext
 yielding datarow column_list

yielding datarow column_list carries the column names, the values of non-text or image columns, and the replication status of text or image columns. The replication status can be always_rep, rep_if_changed, or never_rep. The column_list field also carries additional information, called text_status, about the text or image columns. The text_status can be one of the following keywords:

Table B-5: Text_status values for text and image data

Keyword

Description

tpnull

The column has a null text pointer. There are no modifications to text or image columns.

tpinit

Modifications were made at the primary database, which caused a text pointer allocation.

hastext

The current text or image data value follows.

notrep

The text or image column is not replicated. No commands are required in the replicate database because the data did not change value and the text or image column has a replicate_if_changed status.

zerolen

The text or image column contains a null value after an operation at the primary database. For example, after a text pointer has been allocated, there may be data values in a text or image column and an application at the primary database sets them to null.

rs_insert and rs_update also carry the replication status and additional text_status information for text and image columns. rs_delete carries the replication status only.

The rs_writetext form of the applied subcommand carries the text or image data. rs_writetext can carry up to 4K of the text or image data, so the data can be segmented and carried in multiple rs_writetext iterations. The syntax for rs_writetext is:

distribute command_tags applied
 'table'.rs_writetext
 append [first] [last] [changed] [with log]
 [textlen=100] column_list