mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
SQLSERVER: max nvarchar length = 4000, varbinary = 8000 (no longer using deprecated image type by default)
This commit is contained in:
+12
-5
@@ -17,12 +17,19 @@ public class SqlServer16Platform extends SqlServerBasePlatform {
|
||||
this.dbIdentity.setIdType(IdType.IDENTITY);
|
||||
|
||||
// non-utf8 column types
|
||||
DbPlatformType text = new DbPlatformType("text", false);
|
||||
DbPlatformType varchar = new DbPlatformType("varchar", 255, 8000, text);
|
||||
dbTypeMap.put(DbType.CHAR, new DbPlatformType("char", 1));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.VARCHAR, varchar);
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, text);
|
||||
dbTypeMap.put(DbType.CLOB, text);
|
||||
dbTypeMap.put(DbType.JSON, text);
|
||||
dbTypeMap.put(DbType.JSONB, text);
|
||||
|
||||
// old binary type
|
||||
dbTypeMap.put(DbType.BLOB, new DbPlatformType("image", false));
|
||||
dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("image", false));
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image", false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-7
@@ -65,13 +65,21 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime2"));
|
||||
// UTF8 aware types - overwritten in SqlServer16 platform
|
||||
dbTypeMap.put(DbType.CHAR, new DbPlatformType("nchar", 1));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.BLOB, new DbPlatformType("image"));
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image"));
|
||||
|
||||
DbPlatformType longVarchar = new DbPlatformType("nvarchar(max)", false);
|
||||
DbPlatformType varchar = new DbPlatformType("nvarchar", 255, 4000, longVarchar);
|
||||
DbPlatformType json = new DbPlatformType("nvarchar(max)", 0, varchar);
|
||||
dbTypeMap.put(DbType.VARCHAR, varchar);
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, longVarchar);
|
||||
dbTypeMap.put(DbType.CLOB, longVarchar);
|
||||
dbTypeMap.put(DbType.JSON, json);
|
||||
dbTypeMap.put(DbType.JSONB, json);
|
||||
|
||||
DbPlatformType blob = new DbPlatformType("varbinary(max)", false);
|
||||
dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 8000, blob));
|
||||
|
||||
dbTypeMap.put(DbType.BLOB, blob);
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, blob);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user