www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Phrases
RDF data
Remote SQL Data Source
Replication
repl_add_cr
repl_add_dav_cr
repl_add_snapshot_cr
repl_create_snapshot...
repl_create_snapshot...
repl_drop_snapshot_p...
repl_drop_snapshot_s...
repl_grant
repl_init_copy
repl_init_snapshot
repl_publish
repl_pub_add
repl_pub_init_image
repl_pub_remove
repl_revoke
repl_sched_init
repl_server
repl_server_name
repl_snp_server
repl_stat
repl_subscribe
repl_unpublish
repl_unsubscribe
repl_update_snapshot
repl_disconnect
repl_new_log
repl_purge
repl_server_rename
repl_status
repl_sync
repl_sync_all
repl_text
repl_this_server
sub_schedule
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

REPL_ADD_CR

Creates conflict resolver for bi-directional transactional replication
None REPL_ADD_CR (in tbl varchar, in name_suffix varchar, in type char, in order integer, in class varchar, in col varchar);
Description

Simple conflict resolvers can be generated by calling this function.

Parameters
tbl – Name of table for which conflict resolved is required.
name_suffix – Conflict resolver name suffix.
type – The resolved type, one of: ('I', 'U' OR 'D').
order – Resolver order number.
class – The kind of resolver. Class can be one of the following:
  • 'max' row with maximum value of specified column wins
  • 'min' row with minimum value of specified column wins
  • 'ave' new value of specified column is calculated as: current_val = (current_val + new_val) / 2
  • 'add' new value of specified column is calculated as: current_val = current_val + (new_val - old_val)
  • 'pub_wins'
  • 'custom' publisher always wins
  • 'sub_wins' subscriber always wins
col – This should specify the column name if class is not one of 'pub_wins', 'sub_wins' or 'custom'.
Return Types

None.

Examples
Conflict Resolver

Suppose we have the following table:

create table items(
  item_id integer primary key,

  name varchar,
  count decimal
);

A 'U' conflict resolver that increments items.count in publisher table can be defined with the following statement:

REPL_ADD_CR('DB.DBA.items', 'count', 'U', 10, 'add', 'count');