Skip to content

Commit

Permalink
SYMMETRICDS-541. Generic method for allowing other datatypes includin…
Browse files Browse the repository at this point in the history
…g geometry types by casting to varchar.
  • Loading branch information
chenson42 committed Dec 3, 2011
1 parent 3246ded commit e50550d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Expand Up @@ -96,6 +96,8 @@ public class SqlTemplate {

private String newColumnPrefix = "";

private String otherColumnTemplate;

public String createInitalLoadSql(Node node, IDbDialect dialect, TriggerRouter triggerRouter,
Table table, TriggerHistory triggerHistory, Channel channel) {
String sql = sqlTemplates.get(INITIAL_LOAD_SQL_TEMPLATE);
Expand Down Expand Up @@ -606,6 +608,8 @@ private ColumnString buildColumnString(String origTableAlias, String tableAlias,
break;
case Types.NULL:
case Types.OTHER:
templateToUse = this.otherColumnTemplate;
break;
case Types.JAVA_OBJECT:
case Types.DISTINCT:
case Types.STRUCT:
Expand Down Expand Up @@ -659,7 +663,15 @@ private ColumnString buildColumnString(String origTableAlias, String tableAlias,
return new ColumnString(columnsText, isLob);
}

private boolean noTimeColumnTemplate() {
public String getOtherColumnTemplate() {
return otherColumnTemplate;
}

public void setOtherColumnTemplate(String otherColumnTemplate) {
this.otherColumnTemplate = otherColumnTemplate;
}

private boolean noTimeColumnTemplate() {
return timeColumnTemplate == null || timeColumnTemplate.equals("null")
|| timeColumnTemplate.trim().equals("");
}
Expand Down Expand Up @@ -728,6 +740,9 @@ private String buildKeyVariablesDeclare(Column[] columns, String prefix) {
case -10: // SQL-Server ntext binary type
text += "varbinary(max)\n";
break;
case Types.OTHER:
text +="varbinary(max)\n";
break;
default:
if (columns[i].getJdbcTypeName() != null
&& columns[i].getJdbcTypeName().equalsIgnoreCase("interval")) {
Expand Down Expand Up @@ -901,5 +916,4 @@ public String toString() {
}

}

}
Expand Up @@ -124,6 +124,11 @@
<![CDATA[ case when $(tableAlias)."$(columnName)" is null then '' else '"' || to_char($(tableAlias)."$(columnName)", 'YYYY-MM-DD HH24:MI:SS.MS') || '"' end ]]>
</value>
</property>
<property name="otherColumnTemplate" >
<value>
<![CDATA[ case when $(tableAlias)."$(columnName)" is null then '' else '"' || cast($(tableAlias)."$(columnName)" as varchar) || '"' end ]]>
</value>
</property>
<property name="triggerConcatCharacter" value="||"/>
<property name="newTriggerValue" value="new"/>
<property name="oldTriggerValue" value="old"/>
Expand Down

0 comments on commit e50550d

Please sign in to comment.