Skip to content

Commit

Permalink
SYMMETRICDS-306 - Add support for truncating tables during initial lo…
Browse files Browse the repository at this point in the history
…ad in the cases where the database support truncates
  • Loading branch information
chenson42 committed Sep 11, 2010
1 parent 649a73b commit e4d0425
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Expand Up @@ -56,7 +56,8 @@ private ParameterConstants() {
public final static String AUTO_UPGRADE = "auto.upgrade";
public final static String AUTO_UPDATE_NODE_VALUES = "auto.update.node.values.from.properties";

public final static String INITIAL_LOAD_DELETE_BEFORE_RELOAD = "initial.load.delete.first";
public final static String INITIAL_LOAD_DELETE_BEFORE_RELOAD = "initial.load.delete.first";
public final static String INITIAL_LOAD_DELETE_FIRST_SQL = "initial.load.delete.first.sql";
public final static String INITIAL_LOAD_CREATE_SCHEMA_BEFORE_RELOAD = "initial.load.create.first";
public final static String INITIAL_LOAD_USE_RELOAD_CHANNEL = "initial.load.use.reload.channel";

Expand Down
Expand Up @@ -278,7 +278,7 @@ public String createInitialLoadSqlFor(Node node, TriggerRouter trigger, Table ta
}

public String createPurgeSqlFor(Node node, TriggerRouter triggerRouter) {
return sqlTemplate.createPurgeSql(node, this, triggerRouter);
return String.format(parameterService.getString(ParameterConstants.INITIAL_LOAD_DELETE_FIRST_SQL), triggerRouter.qualifiedTargetTableName());
}

public String createCsvDataSql(Trigger trigger, String whereClause) {
Expand Down
Expand Up @@ -123,10 +123,6 @@ public String createInitalLoadSql(Node node, IDbDialect dialect, TriggerRouter t
return sql;
}

public String createPurgeSql(Node node, IDbDialect dialect, TriggerRouter triggerRouter) {
return String.format("delete from %s", triggerRouter.qualifiedTargetTableName());
}

public String createCsvDataSql(IDbDialect dialect, Trigger trig, Table metaData, String whereClause) {
String sql = sqlTemplates.get(INITIAL_LOAD_SQL_TEMPLATE);

Expand Down
Expand Up @@ -51,7 +51,6 @@ public class PostgreSqlDbDialect extends AbstractDbDialect implements IDbDialect

private String transactionIdExpression = "null";


@Override
public void init(Platform pf, int queryTimeout, JdbcTemplate jdbcTemplate) {
super.init(pf, 0, jdbcTemplate);
Expand Down
Expand Up @@ -173,11 +173,17 @@ stream.to.file.threshold.bytes=32767
# This property can be overridden in the database
initial.load.create.first=false

# Set this if tables should be purged prior to an initial load
# Set this if tables should be purged prior to an initial load.
#
# This property can be overridden in the database
initial.load.delete.first=false

# This is the SQL statement that will be used for purging a table
# during an initial load.
#
# This property can be overridden in the database
initial.load.delete.first.sql=delete from %s

# Indicate that the initial load events should be put on the reload channel.
# If this is set to false each table will be put on it's assigned channel during
# the reload.
Expand Down

0 comments on commit e4d0425

Please sign in to comment.