Skip to content

Commit

Permalink
working on making dbexport consistent.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Jun 28, 2012
1 parent 2c79cf3 commit 1fcf766
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Expand Up @@ -585,15 +585,13 @@ protected ColumnString buildColumnString(String origTableAlias, String tableAlia
case Types.VARCHAR:
templateToUse = stringColumnTemplate;
break;
case Types.LONGVARCHAR:
templateToUse = stringColumnTemplate;
break;
case ColumnTypes.SQLXML:
templateToUse = xmlColumnTemplate;
break;
case Types.ARRAY:
templateToUse = arrayColumnTemplate;
break;
case Types.LONGVARCHAR:
case Types.CLOB:
if (isOld && symmetricDialect.needsToSelectLobData()) {
templateToUse = emptyColumnTemplate;
Expand Down
Expand Up @@ -527,9 +527,15 @@ protected java.util.Date parseDate(int type, String value, boolean useVariableDa
throw new RuntimeException(e);
}
}

public boolean isLob(int type) {
return isClob(type) || isBlob(type);
}

public boolean isClob(int type) {
return type == Types.CLOB || type == Types.LONGVARCHAR;
return type == Types.CLOB || type == Types.LONGVARCHAR || type == ColumnTypes.LONGNVARCHAR||
// SQL-Server ntext binary type
type == -10;
}

public boolean isBlob(int type) {
Expand Down Expand Up @@ -577,14 +583,6 @@ public boolean isStoresUpperCaseIdentifiers() {
return storesUpperCaseIdentifiers;
}

public boolean isLob(int type) {
return type == Types.CLOB || type == Types.BLOB || type == Types.BINARY
|| type == Types.VARBINARY || type == Types.LONGVARBINARY
|| type == ColumnTypes.LONGNVARCHAR ||
// SQL-Server ntext binary type
type == -10;
}

public Database readDatabaseFromXml(String filePath, boolean alterCaseToMatchDatabaseDefaultCase) {
InputStream is = null;
File file = new File(filePath);
Expand Down
Expand Up @@ -78,7 +78,7 @@ public MsSqlDdlBuilder() {
databaseInfo.addNativeTypeMapping(Types.INTEGER, "INT");
databaseInfo.addNativeTypeMapping(Types.JAVA_OBJECT, "IMAGE", Types.LONGVARBINARY);
databaseInfo.addNativeTypeMapping(Types.LONGVARBINARY, "IMAGE");
databaseInfo.addNativeTypeMapping(Types.LONGVARCHAR, "TEXT", Types.CLOB);
databaseInfo.addNativeTypeMapping(Types.LONGVARCHAR, "TEXT", Types.LONGVARCHAR);
databaseInfo.addNativeTypeMapping(Types.NULL, "IMAGE", Types.LONGVARBINARY);
databaseInfo.addNativeTypeMapping(Types.OTHER, "IMAGE", Types.LONGVARBINARY);
databaseInfo.addNativeTypeMapping(Types.REF, "IMAGE", Types.LONGVARBINARY);
Expand Down
Expand Up @@ -138,7 +138,7 @@ private boolean existsPKWithName(DatabaseMetaDataWrapper metaData, Table table,
protected Integer mapUnknownJdbcTypeForColumn(Map<String, Object> values) {
String typeName = (String) values.get("TYPE_NAME");
if (typeName != null && typeName.toLowerCase().startsWith("text")) {
return Types.CLOB;
return Types.LONGVARCHAR;
} else {
return super.mapUnknownJdbcTypeForColumn(values);
}
Expand Down

0 comments on commit 1fcf766

Please sign in to comment.