Home | Previous Page | Next Page   Setting Up and Managing Enterprise Replication > Preparing the Replication Environment > Preparing Data for Replication >

Blocking Replication

You might need to put data into a database that you do not want replicated, perhaps for a new server or because you had to drop and re-create a table.

To block replication while you prepare a table, use the BEGIN WORK WITHOUT REPLICATION statement. This starts a transaction that does not replicate to other database servers.

The following code fragment shows how you might use this statement:

BEGIN WORK WITHOUT REPLICATION
LOCK TABLE office
DELETE FROM office WHERE description = 'portlandR_D'
COMMIT WORK 

The following list indicates actions that occur when a transaction starts with BEGIN WORK WITHOUT REPLICATION:

The list of columns must match the order and the number of fields in the load file.

INSERT INTO table_name3 SELECT * FROM table_name4; 

to an explicit statement, where col1, col2,..., colN are the columns of the table:

INSERT INTO table_name3 VALUES
      (cdrserver, cdrtime, col1, ..., colN)
   cdrserver, cdrtime *
   FROM table_name4;

The shadow columns (cdrserver and cdrtime) are not included in an * list.

For more information about these statements, refer to the IBM Informix Guide to SQL: Syntax.

Using DB-Access to Begin Work Without Replication

The following example shows how to use DB–Access to begin work without replication as well as update the Enterprise Replication shadow columns cdrserver and cdrtime:

DATABASE adatabase;
BEGIN WORK WITHOUT REPLICATION
INSERT into mytable (cdrserver, cdrtime, col1, col2, ....) 
   VALUES (10, 845484154, value1, value2, ....);
UPDATE mytable
   SET cdrserver = 10, cdrtime = 945484154 
   WHERE col1 > col2;
COMMIT WORK

Using ESQL/C to Begin Work Without Replication

The following example shows how to use ESQL/C to begin work without replication as well as update the Enterprise Replication shadow columns cdrserver and cdrtime:

MAIN (argc, argv)
   INT      argc;
   CHAR      *argv[];
{
   EXEC SQL CHAR      stmt[256];
   EXEC SQL database mydatabase;
   
   sprintf(stmt, "BEGIN WORK WITHOUT REPLICATION");
   EXEC SQL execute immediate :stmt;
   
   EXEC SQL insert into mytable (cdrserver, cdrtime,
   col1, col2, ...)
   values (10, 845494154, value1, value2, ...);

   EXEC SQL update mytable
   set cdrserver = 10, cdrtime = 845494154
   where col1 > col2;
   EXEC SQL commit work;
}
Important:
You must use the following syntax when you issue the BEGIN WORK WITHOUT REPLICATION statement from ESQL/C programs. Do not use the '$' syntax.
sprintf(stmt, "BEGIN WORK WITHOUT REPLICATION");
EXEC SQL execute immediate :stmt; 
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]