Skip to content

Commit

Permalink
Strip out special characters from trigger_ids when generating trigger…
Browse files Browse the repository at this point in the history
… names.
  • Loading branch information
chenson42 committed Sep 11, 2010
1 parent 769a983 commit 6b5f5f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Expand Up @@ -804,18 +804,16 @@ protected String getTriggerName(DataEventType dml, int maxTriggerNameLength, Tri
if (StringUtils.isBlank(triggerName)) {
String triggerPrefix1 = tablePrefix + "_";
String triggerSuffix1 = "on_" + dml.getCode().toLowerCase() + "_for_";
String triggerSuffix2 = replaceCharsForTriggerName(trigger.getTriggerId() + "_"
+ parameterService.getNodeGroupId());
triggerName = triggerPrefix1 + triggerSuffix1 + triggerSuffix2;
String triggerSuffix2 = replaceCharsForTriggerName(trigger.getTriggerId());
String triggerSuffix3 = replaceCharsForTriggerName("_" + parameterService.getNodeGroupId());
triggerName = triggerPrefix1 + triggerSuffix1 + triggerSuffix2 + triggerSuffix3;
// use the node group id as part of the trigger if we can because it
// helps uniquely identify
// the trigger in embedded databases. In hsqldb we choose the
// correct connection based on the presence of
// a table that is named for the trigger. If the trigger isn't
// unique across all databases, then we can
// helps uniquely identify the trigger in embedded databases. In hsqldb we choose the
// correct connection based on the presence of a table that is named for the trigger.
// If the trigger isn't unique across all databases, then we can
// choose the wrong connection.
if (triggerName.length() > maxTriggerNameLength && maxTriggerNameLength > 0) {
triggerName = triggerPrefix1 + triggerSuffix1;
triggerName = triggerPrefix1 + triggerSuffix1 + triggerSuffix2;
}
}

Expand Down
@@ -1,5 +1,5 @@
test.root=h2
test.client=h2
test.root=db2
test.client=db2

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

0 comments on commit 6b5f5f8

Please sign in to comment.