Skip to content

Commit

Permalink
Related to Bug Id # 3179. resolved issue of size too large during
Browse files Browse the repository at this point in the history
Forward engineering. Implemented to display Microsoft SQL Server
NVARCHAR(Max) correctly.
  • Loading branch information
KirtiMistry committed May 4, 2016
1 parent 959c22b commit 532fe7a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,21 +448,21 @@ public String columnType(SQLColumn c) {
int scale = columnType.getScale(getPlatformName());
PropertyType precisionType = columnType.getPrecisionType(getPlatformName());
PropertyType scaleType = columnType.getScaleType(getPlatformName());
// In Microsoft SQL Server varchar(Max) limit is '2147483647', so its write it as varchar (2147483647) instead of varchar(Max)
// When doing forward engineering varchar(2147483647) will give error and indicates a size is too large
// In Microsoft SQL Server varchar(Max) or nvarchar(Max) limit is '2147483647', so its write it as varchar (2147483647) instead of varchar(Max)
// When doing forward engineering varchar/nvarchar(2147483647) will give error and indicates a size is too large

if (precisionType != PropertyType.NOT_APPLICABLE &&
scaleType != PropertyType.NOT_APPLICABLE &&
precision > 0 && scale > 0) {
if (precision > 8000 && columnType.getName().equalsIgnoreCase("varchar")) {
if (precision > 8000 && (columnType.getName().equalsIgnoreCase("varchar") || columnType.getName().equalsIgnoreCase("nvarchar"))) {
logger.debug(" precision is > 8000 , replacing to Max");
def.append("(MAX");
} else {
def.append("("+columnType.getPrecision(getPlatformName()));
}
def.append(","+columnType.getScale(getPlatformName())+")");
} else if (precisionType != PropertyType.NOT_APPLICABLE && precision > 0) {
if (precision > 8000 && columnType.getName().equalsIgnoreCase("varchar")) {
if (precision > 8000 && (columnType.getName().equalsIgnoreCase("varchar") || columnType.getName().equalsIgnoreCase("nvarchar"))) {
def.append("(MAX)");
} else {
def.append("("+columnType.getPrecision(getPlatformName())+")");
Expand Down

0 comments on commit 532fe7a

Please sign in to comment.