Navigation Menu

Skip to content

Commit

Permalink
0002359: Handle nvarchar default values on sql server that start with N'
Browse files Browse the repository at this point in the history
during schema creation
  • Loading branch information
chenson42 committed Aug 3, 2015
1 parent a6dde30 commit 1513608
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -2035,7 +2035,8 @@ protected void printDefaultValue(String defaultValue, int typeCode, StringBuilde
|| defaultValueStr.toUpperCase().startsWith("TIME '")
|| defaultValueStr.toUpperCase().startsWith("TIMESTAMP '")
|| defaultValueStr.toUpperCase().startsWith("INTERVAL '")
));
)) &&
!(defaultValueStr.toUpperCase().startsWith("N'") && defaultValueStr.endsWith("'"));

if (shouldUseQuotes) {
// characters are only escaped when within a string literal
Expand Down
Expand Up @@ -202,6 +202,9 @@ protected Column readColumn(DatabaseMetaDataWrapper metaData, Map<String, Object
defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
}
} else if (TypeMap.isTextType(column.getMappedTypeCode())) {
if (defaultValue.startsWith("N'") && defaultValue.endsWith("'")) {
defaultValue = defaultValue.substring(2, defaultValue.length()-1);
}
defaultValue = unescape(defaultValue, "'", "''");
}

Expand Down

0 comments on commit 1513608

Please sign in to comment.