rs_writetext

Description

Modifies text, unitext, or image data in a replicate database.

Examples

Example 1

Creates an rs_writetext function string that uses the RPC method to update the copy column in the blurbs table.

create function string
   blurbs_rep.rs_writetext;copy
 for gw_function_class
 output rpc
 'execute update_blurbs_copy
   @copy_chunk = ?copy!new?,
   @au_id = ?au_id!new?,
   @last_chunk = ?rs_last_text_chunk!sys?,
   @writetext_log = ?rs_writetext_log!sys?'

Example 2

Creates an rs_writetext function string that uses the writetext method to update the copy column. Replication Server modifies the copy column by using the I/O descriptor returned by the execution of the rs_get_textptr function for the copy column.

create function string
   blurbs_rep.rs_writetext;copy
 for rs_sqlserver2_function_class
 output writetext
 use primary log

For example, if you have a function string for rs_get_textptr, then the rs_writetext function modifies the repcopy column in the blurbs table, as follows:

create function string
   blurbs_rep.rs_get_textptr;copy
 for sqlserver2_function_class
 output language
 'select repcopy from blurbs
  where au_id = ?au_id!new?'

Example 3

Creates an rs_writetext function string that uses the none method to specify that the copy column should not be updated.

create function string
   blurbs_rep.rs_writetext;copy
 for rs_sqlserver2_function_class
 output none

Usage


Using the RPC Method

With the RPC method for creating an rs_writetext function string, Replication Server executes a remote procedure call repeatedly, providing up to 255 bytes of the text, unitext, or image value on each procedure execution.

The data is passed in the RPC in a varchar parameter for text or unitext data or in a varbinary parameter for image data. Replication Server ensures that the data chunks are partitioned on character boundaries for text or unitext columns. If a 1-byte character set is in use, the data is sent in 255-byte chunks.

Each time Replication Server executes the RPC, it sets the rs_last_text_chunk system variable, an int, to 0 if there is more data to follow or to 1 if this is the last RPC execution for this text column.


Using the writetext method

The writetext method for creating an rs_writetext function string provides the options shown in Table 4-6 to specify the logging behavior in the replicate database.

Table 4-6: writetext logging options

Logging option

Description

use primary log

Log the data in the replicate database transaction log if the logging option was specified in the primary database transaction log. Do not log if logging is not specified in the primary database transaction log.

with log

Log the data in the replicate database transaction log.

no log

Do not log the data in the replicate database transaction log.

The default function string for rs_sqlserver_function_class uses the use primary log option.


Using the none method

The none output template option for rs_writetext function strings instructs Replication Server not to use the Client-Library function ct_send_data to update a text, unitext, or image column value. This option provides necessary flexibility for using text, unitext, or image columns in a heterogeneous environment.

See the Replication Server Administration Guide Volume 2 for more information.

See also

rs_get_textptr, rs_textptr_init, rs_datarow_for_writetext