Skip to content

Commit

Permalink
fix a bug in trigger template that should help informix out
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Mar 9, 2012
1 parent e88780e commit fc4771f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Expand Up @@ -19,8 +19,11 @@
* under the License. */
package org.jumpmind.symmetric.db.firebird;

import java.util.List;

import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.db.sql.ISqlTransaction;
import org.jumpmind.db.sql.mapper.StringMapper;
import org.jumpmind.db.util.BinaryEncoding;
import org.jumpmind.symmetric.db.AbstractSymmetricDialect;
import org.jumpmind.symmetric.db.ISymmetricDialect;
Expand Down Expand Up @@ -118,5 +121,14 @@ public boolean supportsTransactionId() {
public void truncateTable(String tableName) {
platform.getSqlTemplate().update("delete from " + tableName);
}


@Override
public void cleanupTriggers() {
List<String> names = platform.getSqlTemplate().query("select rdb$trigger_name from rdb$triggers where rdb$trigger_name like '"+parameterService.getTablePrefix().toUpperCase()+"_%'", new StringMapper());
int count = 0;
for (String name : names) {
count += platform.getSqlTemplate().update("drop trigger " + name);
}
log.info("Remove {} triggers", count);
}
}
Expand Down
Expand Up @@ -338,7 +338,9 @@ public String replaceTemplateVariables(DataEventType dml, Trigger trigger,

// some column templates need tableName and schemaName
ddl = FormatUtils.replace("tableName", quote(table.getName()), ddl);
ddl = FormatUtils.replace("schemaName", table.getQualifiedTablePrefix(symmetricDialect.getPlatform().getPlatformInfo().getIdentifierQuoteString()), ddl);
ddl = FormatUtils.replace("schemaName",
history == null ? getSourceTablePrefix(trigger)
: getSourceTablePrefix(history), ddl);

columns = table.getPrimaryKeyColumns();
ddl = FormatUtils.replace(
Expand Down
@@ -1,5 +1,5 @@
test.root=firebird
test.client=firebird
test.root=h2
test.client=h2

mysql.db.driver=com.mysql.jdbc.Driver
mysql.db.user=root
Expand Down

0 comments on commit fc4771f

Please sign in to comment.