A replicated function that carries SQLDML to Replication Server.
create proc rs_sqldml @rs_operator char(1), @rs_status int, @rs_insert_column varchar(16384), @rs_from varchar(16384), @rs_where varchar(16384), @rs_set varchar(16384), @rs_select varchar(16384), @rs_owner varchar(255), @rs_object varchar(255), @rs_rowcount int
U – update
D – delete
I – insert select
S – select into
<rs_object> – the operated table name
<rs_owner> – the operated table owner. If the owner status of the table is off, owner name will be null.
C1 – statements that can be applied at any replicated database and will generate identical result set.
C2 – statements that can be applied only at warm standby or MSA database to generate identical result set.
<rs_status> – the SQLDML status.
<rs_set> – the set clause in an UPDATE statement
<rs_where> – the where clause
<rs_select> – the select clause in an INSERT SELECT or SELECT INTO statement
<rs_from> – the from clause in an INSERT SELECT or SELECT INTO statement
<rs_insert_column> – the column list of an INSERT SELECTstatement
<rs_rowcount> – the number of impacted rows, which is available only at the end of rs_sqldml.
rs_sqldml is sent to Replication Server as a replicated function. If a SQLDML does not have a responding clause, the parameter will be set to null.
SELECT INTO cannot be executed inside a user-defined transaction and is replicated as a system transaction.
RepAgent sends both rs_sqldml and its affected row log records to Replication Server, and Replication Server decides whether to apply SQLDML or the affected rows to a target.
Adaptive Server logs execbegin rs_sqldml to indicate the beginning of a SQLDML, an execend rs_sqldml to indicate the ending of a SQLDML. SQLDML is packed inside the execbegin command. <@rs_rowcount> is packed inside execend command.
To prevent log SQLDML that changes less than SQLDML replication threshold rows, Adaptive Server performs deferred logging for execbegin. It does not log execbegin when a SQLDML until it changes more than the threshold rows. RepAgent flags the first log record of a SQLDML.
SQLDML deferred logging is not required. A non-Adaptive Server replication agent, for example, may not perform deferred logging.