Cloudsync Commands Reference
Page 2 of 8

ALTER PUBLICATION

Changes an existing publication.

This statement can only be executed on a source database. The effects of ALTER PUBLICATION are replayed at a subscribing target at its next refresh.

Syntax

ALTER PUBLICATION PublicationName
 [ ADD PARAMETER ParameterSpec ]*
 [ ADD TABLE TableName
     [ ( SimpleColumnName [, SimpleColumnName ]* ) ]
   [ WHERE restriction ] ]*
 [ ADD INDEX IndexName ]*
 [ ADD VIEW ViewName ]*
 [ ADD STATEMENT StatementName ]*
 [ ADD METHOD ALIAS MethodAliasName ]*
 [ ADD WORK ALIAS WorkAliasName ]*
 [ ADD CLASS ALIAS ClassAliasName ]*
 [ ADD FOREIGN KEY ForeignKeyName ]*
 [ ADD AGGREGATE AggregateName ]*
 [ ADD TRIGGER TriggerName ]*
 [ ADD TARGET DATABASE PROPERTY PropertyName='propertyValue' ]*
 [ ADD JAR FILE JarFileName ]*
 [ DROP TABLE TableName ]*
 [ DROP INDEX IndexName ]*
 [ DROP VIEW ViewName ]*
 [ DROP STATEMENT StatementName ]*
 [ DROP METHOD ALIAS MethodAliasname ]*
 [ DROP WORK ALIAS WorkAliasname ]*
 [ DROP CLASS ALIAS ClassAliasName ]*
 [ DROP FOREIGN KEY ForeignKeyName ]*
 [ DROP AGGREGATE AggregateName ]*
 [ DROP TRIGGER TriggerName ]*
 [ DROP TARGET DATABASE PROPERTY PropertyName ]*
 [ DROP JAR FILE JarFileName ]*

ParameterSpec

ParameterName DataType [ DEFAULT NULL ]

The ADD and DROP statements can appear in any order. DROPs apply before ADDs, so you can DROP and ADD the same dictionary object in either order.

The limitations on the WHERE restriction are the same as for the CREATE PUBLICATION statement. See CREATE PUBLICATION for more information.

During the time a transaction containing ALTER PUBLICATION is uncommitted, no other transaction may:

  • alter, copy, or drop the publication
  • alter a table in the publication

ALTER PUBLICATION cannot make a publication inconsistent or incomplete. To ensure this:

  • If ALTER PUBLICATION adds a view, index, or stored prepared statement, then the same ALTER PUBLICATION statement must also add all tables that the view, index, or stored prepared statement mentions, unless they are already in the publication.
  • If ALTER PUBLICATION drops a table, it must also drop all views, indexes, and stored prepared statements that mention the table.
  • You cannot add an object that is already in the publication, though you can drop an object and then add it again in the same ALTER PUBLICATION statement.

Like with any published object, before you can drop a published jar file, you must first drop all publications in which it appears. You cannot drop the file using COM.cloudscape.tools.dbclasses.removeJar. Instead, use COM.cloudscape.tools.dbclasses.replaceJar to replace the source jar file, and subsequent refreshes will update the target jar file.

A refresh that changes a target's cloudscape.database.classpath produces a JDBC warning.

See CREATE PUBLICATION for information on target properties you can include in a publication.

Example

-- issued at source
ALTER PUBLICATION toySales
DROP TABLE salesReps
ADD TABLE salesReps
    WHERE salesRepID=?salesRepID
ADD JAR FILE APP.TargetWORK
ADD TARGET DATABASE PROPERTY
    cloudscape.database.classpath='APP.TargetWork'

When you alter a publication to add a table or index, its properties are automatically set to match those of the tables at the source upon creation.