protected void addGeoTypes(int srid) { dbTypeMap.put(DbType.POINT, geoType("point", srid)); dbTypeMap.put(DbType.POLYGON, geoType("polygon", srid)); dbTypeMap.put(DbType.LINESTRING, geoType("linestring", srid)); dbTypeMap.put(DbType.MULTIPOINT, geoType("multipoint", srid)); dbTypeMap.put(DbType.MULTILINESTRING, geoType("multilinestring", srid)); dbTypeMap.put(DbType.MULTIPOLYGON, geoType("multipolygon", srid)); }
put(DbType.BOOLEAN); put(DbType.BIT); put(DbType.INTEGER); put(DbType.BIGINT); put(DbType.DOUBLE); put(DbType.SMALLINT); put(DbType.TINYINT); put(DbType.BLOB); put(DbType.CLOB); put(DbType.ARRAY); put(DbType.DATE); put(DbType.TIME); put(DbType.TIMESTAMP); put(DbType.LONGVARBINARY); put(DbType.LONGVARCHAR); put(DbType.REAL, new DbPlatformType("float")); put(DbType.POINT, POINT); put(DbType.POLYGON, POLYGON); put(DbType.LINESTRING, LINESTRING); put(DbType.MULTIPOINT, MULTIPOINT); put(DbType.MULTILINESTRING, MULTILINESTRING); put(DbType.MULTIPOLYGON, MULTIPOLYGON); put(DbType.VARCHAR, new DbPlatformType("varchar")); put(DbType.DECIMAL, new DbPlatformType("decimal")); put(DbType.VARBINARY, new DbPlatformType("varbinary")); put(DbType.BINARY, new DbPlatformType("binary"));
/** * Map the UUID appropriately based on native DB support and ServerConfig.DbUuid. */ public void config(boolean nativeUuidType, ServerConfig.DbUuid dbUuid) { if (nativeUuidType && dbUuid.useNativeType()) { put(DbType.UUID, UUID_NATIVE); } else if (dbUuid.useBinary()) { put(DbType.UUID, get(DbType.BINARY).withLength(16)); } else { put(DbType.UUID, get(DbType.VARCHAR).withLength(40)); } } }
public SqlAnywherePlatform() { super(); this.platform = Platform.SQLANYWHERE; this.dbIdentity.setIdType(IdType.IDENTITY); this.sqlLimiter = new SqlAnywhereLimiter(); this.dbIdentity.setSupportsGetGeneratedKeys(false); this.dbIdentity.setSelectLastInsertedIdTemplate("select @@IDENTITY as X"); this.dbIdentity.setSupportsIdentity(true); dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("bit default 0")); dbTypeMap.put(DbType.BIGINT, new DbPlatformType("numeric", 19)); dbTypeMap.put(DbType.REAL, new DbPlatformType("float(16)")); dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float(32)")); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint")); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("numeric", 28)); dbTypeMap.put(DbType.BLOB, new DbPlatformType("binary(4500)")); dbTypeMap.put(DbType.CLOB, new DbPlatformType("long varchar")); dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("long binary")); dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("long varchar")); }
DbPlatformType dbBytea = new DbPlatformType("bytea", false); dbTypeMap.put(DbType.UUID, new DbPlatformType("uuid", false)); dbTypeMap.put(DbType.HSTORE, new DbPlatformType("hstore", false)); dbTypeMap.put(DbType.JSON, new DbPlatformType("json", false)); dbTypeMap.put(DbType.JSONB, new DbPlatformType("jsonb", false)); dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false)); dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float")); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint")); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("decimal", 38)); dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("timestamptz")); dbTypeMap.put(DbType.BINARY, dbBytea); dbTypeMap.put(DbType.VARBINARY, dbBytea); dbTypeMap.put(DbType.BLOB, dbBytea); dbTypeMap.put(DbType.CLOB, dbTypeText); dbTypeMap.put(DbType.LONGVARBINARY, dbBytea); dbTypeMap.put(DbType.LONGVARCHAR, dbTypeText);
public DB2Platform() { super(); this.platform = Platform.DB2; this.maxTableNameLength = 18; this.maxConstraintNameLength = 18; this.sqlLimiter = new Db2SqlLimiter(); this.platformDdl = new DB2Ddl(this); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsSequence(true); booleanDbType = Types.BOOLEAN; dbTypeMap.put(DbType.REAL, new DbPlatformType("real")); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint")); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("decimal", 15)); }
public SQLitePlatform() { super(); this.platform = Platform.SQLITE; this.platformDdl = new SQLiteDdl(this); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(false); this.dbIdentity.setSupportsSequence(false); this.dbIdentity.setSelectLastInsertedIdTemplate("select last_insert_rowid()"); this.booleanDbType = Types.INTEGER; dbTypeMap.put(DbType.BIT, new DbPlatformType("int default 0")); dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("int default 0")); dbTypeMap.put(DbType.BIGINT, new DbPlatformType("integer")); dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("integer")); }
this.closeQuote = "]"; dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("bit default 0")); dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false)); dbTypeMap.put(DbType.BIGINT, new DbPlatformType("numeric", 19)); dbTypeMap.put(DbType.REAL, new DbPlatformType("float(16)")); dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float(32)")); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint")); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("numeric", 28)); dbTypeMap.put(DbType.BLOB, new DbPlatformType("image")); dbTypeMap.put(DbType.CLOB, new DbPlatformType("text")); dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image")); dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("text")); dbTypeMap.put(DbType.DATE, new DbPlatformType("date")); dbTypeMap.put(DbType.TIME, new DbPlatformType("time")); dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime2"));
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("number(1) default 0")); dbTypeMap.put(DbType.INTEGER, new DbPlatformType("number", 10)); dbTypeMap.put(DbType.BIGINT, new DbPlatformType("number", 19)); dbTypeMap.put(DbType.REAL, new DbPlatformType("number", 19, 4)); dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("number", 19, 4)); dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("number", 5)); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("number", 3)); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("number", 38)); dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar2", 255)); dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("blob")); dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("clob")); dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("raw", 255)); dbTypeMap.put(DbType.BINARY, new DbPlatformType("raw", 255)); dbTypeMap.put(DbType.TIME, new DbPlatformType("timestamp"));
public MySqlPlatform() { super(); this.platform = Platform.MYSQL; this.useExtraTransactionOnIterateSecondaryQueries = true; this.likeClause = "like ? escape''"; this.selectCountWithAlias = true; this.dbEncrypt = new MySqlDbEncrypt(); this.platformDdl = new MySqlDdl(this); this.historySupport = new MySqlHistorySupport(); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsIdentity(true); this.dbIdentity.setSupportsSequence(false); this.openQuote = "`"; this.closeQuote = "`"; this.forwardOnlyHintOnFindIterate = true; this.booleanDbType = Types.BIT; dbTypeMap.put(DbType.BIT, new DbPlatformType("tinyint(1) default 0")); dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("tinyint(1) default 0")); dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime(6)")); dbTypeMap.put(DbType.CLOB, new MySqlClob()); dbTypeMap.put(DbType.BLOB, new MySqlBlob()); dbTypeMap.put(DbType.BINARY, new DbPlatformType("binary", 255)); dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255)); }
public HsqldbPlatform() { super(); this.platform = Platform.HSQLDB; this.dbEncrypt = new H2DbEncrypt(); this.platformDdl = new HsqldbDdl(this); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsSequence(true); this.dbIdentity.setSupportsIdentity(true); dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false)); }
public H2Platform() { super(); this.platform = Platform.H2; this.dbEncrypt = new H2DbEncrypt(); this.platformDdl = new H2Ddl(this); this.historySupport = new H2HistorySupport(); this.nativeUuidType = true; this.dbDefaultValue.setNow("now()"); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsSequence(true); this.dbIdentity.setSupportsIdentity(true); // like ? escape'' not working in the latest version H2 so just using no // escape clause for now noting that backslash is an escape char for like in H2 this.likeClause = "like ?"; dbTypeMap.put(DbType.UUID, new DbPlatformType("uuid", false)); }
/** * Configure UUID Storage etc based on ServerConfig settings. */ public void configure(DbTypeConfig config) { addGeoTypes(config.getGeometrySRID()); configureIdType(config.getIdType()); dbTypeMap.config(nativeUuidType, config.getDbUuid()); for (CustomDbTypeMapping mapping : config.getCustomTypeMappings()) { if (platformMatch(mapping.getPlatform())) { dbTypeMap.put(mapping.getType(), parse(mapping.getColumnDefinition())); } } }