/** * Load the standard types. * These can be overridden by DB specific platform. */ private void loadDefaults() { put(Types.BOOLEAN, new DbType("boolean")); put(Types.BIT, new DbType("bit")); put(Types.INTEGER, new DbType("integer")); put(Types.BIGINT, new DbType("bigint")); put(Types.REAL, new DbType("float")); put(Types.DOUBLE, new DbType("double")); put(Types.SMALLINT, new DbType("smallint")); put(Types.TINYINT, new DbType("tinyint")); put(Types.DECIMAL, new DbType("decimal",38)); put(Types.VARCHAR, new DbType("varchar", 255)); put(Types.CHAR, new DbType("char", 1)); put(Types.BLOB, new DbType("blob")); put(Types.CLOB, new DbType("clob")); put(Types.LONGVARBINARY, new DbType("longvarbinary")); put(Types.LONGVARCHAR, new DbType("lonvarchar")); put(Types.VARBINARY, new DbType("varbinary",255)); put(Types.BINARY, new DbType("binary",255)); put(Types.DATE, new DbType("date")); put(Types.TIME, new DbType("time")); put(Types.TIMESTAMP, new DbType("timestamp")); }
/** * Load the standard types. These can be overridden by DB specific platform. */ private void loadDefaults() { put(Types.BOOLEAN, new DbType("boolean")); put(Types.BIT, new DbType("bit")); put(Types.INTEGER, new DbType("integer")); put(Types.BIGINT, new DbType("bigint")); put(Types.REAL, new DbType("float")); put(Types.DOUBLE, new DbType("double")); put(Types.SMALLINT, new DbType("smallint")); put(Types.TINYINT, new DbType("tinyint")); put(Types.DECIMAL, new DbType("decimal", 38)); put(Types.VARCHAR, new DbType("varchar", 255)); put(Types.CHAR, new DbType("char", 1)); put(Types.BLOB, new DbType("blob")); put(Types.CLOB, new DbType("clob")); put(Types.LONGVARBINARY, new DbType("longvarbinary")); put(Types.LONGVARCHAR, new DbType("lonvarchar")); put(Types.VARBINARY, new DbType("varbinary", 255)); put(Types.BINARY, new DbType("binary", 255)); put(Types.DATE, new DbType("date")); put(Types.TIME, new DbType("time")); put(Types.TIMESTAMP, new DbType("timestamp")); }
public SqlAnywherePlatform() { super(); this.name = "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(Types.BOOLEAN, new DbType("bit default 0")); dbTypeMap.put(Types.BIGINT, new DbType("numeric", 19)); dbTypeMap.put(Types.REAL, new DbType("float(16)")); dbTypeMap.put(Types.DOUBLE, new DbType("float(32)")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("numeric", 28)); dbTypeMap.put(Types.BLOB, new DbType("binary(4500)")); dbTypeMap.put(Types.CLOB, new DbType("long varchar")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("long binary")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("long varchar")); }
public SqlAnywherePlatform() { super(); this.name = "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(Types.BOOLEAN, new DbType("bit default 0")); dbTypeMap.put(Types.BIGINT, new DbType("numeric", 19)); dbTypeMap.put(Types.REAL, new DbType("float(16)")); dbTypeMap.put(Types.DOUBLE, new DbType("float(32)")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("numeric", 28)); dbTypeMap.put(Types.BLOB, new DbType("binary(4500)")); dbTypeMap.put(Types.CLOB, new DbType("long varchar")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("long binary")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("long varchar")); }
public MsSqlServer2000Platform() { super(); this.name = "mssqlserver2000"; this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(false); this.dbIdentity.setSelectLastInsertedIdTemplate("select @@IDENTITY as X"); this.dbIdentity.setSupportsIdentity(true); this.openQuote = "["; this.closeQuote = "]"; dbTypeMap.put(Types.BOOLEAN, new DbType("bit default 0")); dbTypeMap.put(Types.BIGINT, new DbType("numeric", 19)); dbTypeMap.put(Types.REAL, new DbType("float(16)")); dbTypeMap.put(Types.DOUBLE, new DbType("float(32)")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("numeric", 28)); dbTypeMap.put(Types.BLOB, new DbType("image")); dbTypeMap.put(Types.CLOB, new DbType("text")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("image")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("text")); dbTypeMap.put(Types.DATE, new DbType("datetime")); dbTypeMap.put(Types.TIME, new DbType("datetime")); dbTypeMap.put(Types.TIMESTAMP, new DbType("datetime")); }
public MsSqlServer2000Platform(){ super(); this.name = "mssqlserver2000"; this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(false); this.dbIdentity.setSelectLastInsertedIdTemplate("select @@IDENTITY as X"); this.dbIdentity.setSupportsIdentity(true); this.openQuote = "["; this.closeQuote = "]"; dbTypeMap.put(Types.BOOLEAN, new DbType("bit default 0")); dbTypeMap.put(Types.BIGINT, new DbType("numeric", 19)); dbTypeMap.put(Types.REAL, new DbType("float(16)")); dbTypeMap.put(Types.DOUBLE, new DbType("float(32)")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("numeric", 28)); dbTypeMap.put(Types.BLOB, new DbType("image")); dbTypeMap.put(Types.CLOB, new DbType("text")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("image")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("text")); dbTypeMap.put(Types.DATE, new DbType("datetime")); dbTypeMap.put(Types.TIME, new DbType("datetime")); dbTypeMap.put(Types.TIMESTAMP, new DbType("datetime")); }
public MsSqlServer2005Platform() { super(); this.name = "mssqlserver2005"; this.sqlLimiter = new MsSqlServer2005SqlLimiter(); this.dbDdlSyntax.setIdentity("identity(1,1)"); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsIdentity(true); this.openQuote = "["; this.closeQuote = "]"; dbTypeMap.put(Types.BOOLEAN, new DbType("bit default 0")); dbTypeMap.put(Types.BIGINT, new DbType("numeric", 19)); dbTypeMap.put(Types.REAL, new DbType("float(16)")); dbTypeMap.put(Types.DOUBLE, new DbType("float(32)")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("numeric", 28)); dbTypeMap.put(Types.BLOB, new DbType("image")); dbTypeMap.put(Types.CLOB, new DbType("text")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("image")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("text")); dbTypeMap.put(Types.DATE, new DbType("datetime")); dbTypeMap.put(Types.TIME, new DbType("datetime")); dbTypeMap.put(Types.TIMESTAMP, new DbType("datetime")); }
public MsSqlServer2005Platform(){ super(); this.name = "mssqlserver2005"; this.sqlLimiter = new MsSqlServer2005SqlLimiter(); this.dbDdlSyntax.setIdentity("identity(1,1)"); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsIdentity(true); this.openQuote = "["; this.closeQuote = "]"; dbTypeMap.put(Types.BOOLEAN, new DbType("bit default 0")); dbTypeMap.put(Types.BIGINT, new DbType("numeric", 19)); dbTypeMap.put(Types.REAL, new DbType("float(16)")); dbTypeMap.put(Types.DOUBLE, new DbType("float(32)")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("numeric", 28)); dbTypeMap.put(Types.BLOB, new DbType("image")); dbTypeMap.put(Types.CLOB, new DbType("text")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("image")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("text")); dbTypeMap.put(Types.DATE, new DbType("datetime")); dbTypeMap.put(Types.TIME, new DbType("datetime")); dbTypeMap.put(Types.TIMESTAMP, new DbType("datetime")); }
public DB2Platform() { super(); this.name = "db2"; // only support getGeneratedKeys with non-batch JDBC // so generally use SEQUENCE instead for H2 this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsSequence(true); this.openQuote = "\""; this.closeQuote = "\""; booleanDbType = Types.INTEGER; dbTypeMap.put(Types.BOOLEAN, new DbType("smallint default 0")); dbTypeMap.put(Types.INTEGER, new DbType("integer")); dbTypeMap.put(Types.BIGINT, new DbType("bigint")); dbTypeMap.put(Types.REAL, new DbType("float")); dbTypeMap.put(Types.DOUBLE, new DbType("float")); dbTypeMap.put(Types.SMALLINT, new DbType("smallint")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("decimal", 15)); this.dbDdlSyntax.setIdentity("generated by default as identity"); // this.dbDdlSyntax.setDropIfExists("if exists"); // this.dbDdlSyntax.setDisableReferentialIntegrity("SET REFERENTIAL_INTEGRITY FALSE"); // this.dbDdlSyntax.setEnableReferentialIntegrity("SET REFERENTIAL_INTEGRITY TRUE"); // this.dbDdlSyntax.setForeignKeySuffix("on delete restrict on update restrict"); }
public DB2Platform(){ super(); this.name = "db2"; // only support getGeneratedKeys with non-batch JDBC // so generally use SEQUENCE instead for H2 this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsSequence(true); this.openQuote = "\""; this.closeQuote = "\""; booleanDbType = Types.INTEGER; dbTypeMap.put(Types.BOOLEAN, new DbType("smallint default 0")); dbTypeMap.put(Types.INTEGER, new DbType("integer")); dbTypeMap.put(Types.BIGINT, new DbType("bigint")); dbTypeMap.put(Types.REAL, new DbType("float")); dbTypeMap.put(Types.DOUBLE, new DbType("float")); dbTypeMap.put(Types.SMALLINT, new DbType("smallint")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("decimal", 15)); this.dbDdlSyntax.setIdentity("generated by default as identity"); //this.dbDdlSyntax.setDropIfExists("if exists"); //this.dbDdlSyntax.setDisableReferentialIntegrity("SET REFERENTIAL_INTEGRITY FALSE"); //this.dbDdlSyntax.setEnableReferentialIntegrity("SET REFERENTIAL_INTEGRITY TRUE"); //this.dbDdlSyntax.setForeignKeySuffix("on delete restrict on update restrict"); }
dbTypeMap.put(Types.BOOLEAN, new DbType("number(1) default 0")); dbTypeMap.put(Types.INTEGER, new DbType("number", 10)); dbTypeMap.put(Types.BIGINT, new DbType("number", 19)); dbTypeMap.put(Types.REAL, new DbType("number", 19, 4)); dbTypeMap.put(Types.DOUBLE, new DbType("number", 19, 4)); dbTypeMap.put(Types.SMALLINT, new DbType("number", 5)); dbTypeMap.put(Types.TINYINT, new DbType("number", 3)); dbTypeMap.put(Types.DECIMAL, new DbType("number", 38)); dbTypeMap.put(Types.VARCHAR, new DbType("varchar2", 255)); dbTypeMap.put(Types.LONGVARBINARY, new DbType("blob")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("clob")); dbTypeMap.put(Types.VARBINARY, new DbType("raw", 255)); dbTypeMap.put(Types.BINARY, new DbType("raw", 255)); dbTypeMap.put(Types.TIME, new DbType("timestamp"));
dbTypeMap.put(Types.INTEGER, new DbType("integer", false)); dbTypeMap.put(Types.DOUBLE, new DbType("float")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("decimal", 38)); dbTypeMap.put(Types.BINARY, new DbType("bytea", false)); dbTypeMap.put(Types.VARBINARY, new DbType("bytea", false)); dbTypeMap.put(Types.BLOB, new DbType("bytea", false)); dbTypeMap.put(Types.CLOB, new DbType("text")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("bytea", false)); dbTypeMap.put(Types.LONGVARCHAR, new DbType("text"));
dbTypeMap.put(Types.BOOLEAN, new DbType("number(1) default 0")); dbTypeMap.put(Types.INTEGER, new DbType("number", 10)); dbTypeMap.put(Types.BIGINT, new DbType("number", 19)); dbTypeMap.put(Types.REAL, new DbType("number", 19, 4)); dbTypeMap.put(Types.DOUBLE, new DbType("number", 19, 4)); dbTypeMap.put(Types.SMALLINT, new DbType("number", 5)); dbTypeMap.put(Types.TINYINT, new DbType("number", 3)); dbTypeMap.put(Types.DECIMAL, new DbType("number", 38)); dbTypeMap.put(Types.VARCHAR, new DbType("varchar2", 255)); dbTypeMap.put(Types.LONGVARBINARY, new DbType("blob")); dbTypeMap.put(Types.LONGVARCHAR, new DbType("clob")); dbTypeMap.put(Types.VARBINARY, new DbType("raw", 255)); dbTypeMap.put(Types.BINARY, new DbType("raw", 255)); dbTypeMap.put(Types.TIME, new DbType("timestamp"));
dbTypeMap.put(Types.INTEGER, new DbType("integer", false)); dbTypeMap.put(Types.DOUBLE, new DbType("float")); dbTypeMap.put(Types.TINYINT, new DbType("smallint")); dbTypeMap.put(Types.DECIMAL, new DbType("decimal", 38)); dbTypeMap.put(Types.BINARY, new DbType("bytea", false)); dbTypeMap.put(Types.VARBINARY, new DbType("bytea", false)); dbTypeMap.put(Types.BLOB, new DbType("bytea", false)); dbTypeMap.put(Types.CLOB, new DbType("text")); dbTypeMap.put(Types.LONGVARBINARY, new DbType("bytea", false)); dbTypeMap.put(Types.LONGVARCHAR, new DbType("text"));
public MySqlPlatform(){ super(); this.name = "mysql"; this.selectCountWithAlias = true; this.dbEncrypt = new MySqlDbEncrypt(); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsIdentity(true); this.dbIdentity.setSupportsSequence(false); this.openQuote = "`"; this.closeQuote = "`"; this.booleanDbType = Types.BIT; dbTypeMap.put(Types.BIT, new DbType("tinyint(1) default 0")); dbTypeMap.put(Types.BOOLEAN, new DbType("tinyint(1) default 0")); dbTypeMap.put(Types.TIMESTAMP, new DbType("datetime")); dbTypeMap.put(Types.CLOB, new MySqlClob()); dbTypeMap.put(Types.BLOB, new MySqlBlob()); dbTypeMap.put(Types.BINARY, new DbType("binary",255)); dbTypeMap.put(Types.VARBINARY, new DbType("varbinary",255)); dbDdlSyntax.setMaxConstraintNameLength(64); dbDdlSyntax.setDisableReferentialIntegrity("SET FOREIGN_KEY_CHECKS=0"); dbDdlSyntax.setEnableReferentialIntegrity("SET FOREIGN_KEY_CHECKS=1"); dbDdlSyntax.setForeignKeySuffix("on delete restrict on update restrict"); }
public MySqlPlatform() { super(); this.name = "mysql"; this.selectCountWithAlias = true; this.dbEncrypt = new MySqlDbEncrypt(); this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsIdentity(true); this.dbIdentity.setSupportsSequence(false); this.openQuote = "`"; this.closeQuote = "`"; this.booleanDbType = Types.BIT; dbTypeMap.put(Types.BIT, new DbType("tinyint(1) default 0")); dbTypeMap.put(Types.BOOLEAN, new DbType("tinyint(1) default 0")); dbTypeMap.put(Types.TIMESTAMP, new DbType("datetime")); dbTypeMap.put(Types.CLOB, new MySqlClob()); dbTypeMap.put(Types.BLOB, new MySqlBlob()); dbTypeMap.put(Types.BINARY, new DbType("binary", 255)); dbTypeMap.put(Types.VARBINARY, new DbType("varbinary", 255)); dbDdlSyntax.setMaxConstraintNameLength(64); dbDdlSyntax.setDisableReferentialIntegrity("SET FOREIGN_KEY_CHECKS=0"); dbDdlSyntax.setEnableReferentialIntegrity("SET FOREIGN_KEY_CHECKS=1"); dbDdlSyntax.setForeignKeySuffix("on delete restrict on update restrict"); }
public SQLitePlatform() { super(); this.name = "sqlite"; this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(false); this.dbIdentity.setSelectLastInsertedIdTemplate("select last_insert_rowid()"); this.openQuote = "\""; this.closeQuote = "\""; this.booleanDbType = Types.INTEGER; dbTypeMap.put(Types.BIT, new DbType("int default 0")); dbTypeMap.put(Types.BOOLEAN, new DbType("int default 0")); dbDdlSyntax.setInlinePrimaryKeyConstraint(true); dbDdlSyntax.setIdentity("AUTOINCREMENT"); dbDdlSyntax.setDisableReferentialIntegrity("PRAGMA foreign_keys = OFF"); dbDdlSyntax.setEnableReferentialIntegrity("PRAGMA foreign_keys = ON"); }
public SQLitePlatform(){ super(); this.name = "sqlite"; this.dbIdentity.setIdType(IdType.IDENTITY); this.dbIdentity.setSupportsGetGeneratedKeys(false); this.dbIdentity.setSelectLastInsertedIdTemplate("select last_insert_rowid()"); this.openQuote = "\""; this.closeQuote = "\""; this.booleanDbType = Types.INTEGER; dbTypeMap.put(Types.BIT, new DbType("int default 0")); dbTypeMap.put(Types.BOOLEAN, new DbType("int default 0")); dbDdlSyntax.setInlinePrimaryKeyConstraint(true); dbDdlSyntax.setIdentity("AUTOINCREMENT"); dbDdlSyntax.setDisableReferentialIntegrity("PRAGMA foreign_keys = OFF"); dbDdlSyntax.setEnableReferentialIntegrity("PRAGMA foreign_keys = ON"); }
public HsqldbPlatform(){ super(); this.name = "hsqldb"; this.dbEncrypt = new H2DbEncrypt(); // only support getGeneratedKeys with non-batch JDBC // so generally use SEQUENCE instead of IDENTITY for H2 boolean useIdentity = GlobalProperties.getBoolean("ebean.hsqldb.useIdentity", true); IdType idType = useIdentity ? IdType.IDENTITY : IdType.SEQUENCE; this.dbIdentity.setIdType(idType); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsSequence(true); this.dbIdentity.setSupportsIdentity(true); this.openQuote = "\""; this.closeQuote = "\""; // H2 data types match default JDBC types // so no changes to dbTypeMap required dbTypeMap.put(Types.INTEGER, new DbType("integer",false)); this.dbDdlSyntax.setDropIfExists("if exists"); this.dbDdlSyntax.setDisableReferentialIntegrity("SET DATABASE REFERENTIAL INTEGRITY FALSE"); this.dbDdlSyntax.setEnableReferentialIntegrity("SET DATABASE REFERENTIAL INTEGRITY TRUE"); this.dbDdlSyntax.setForeignKeySuffix("on delete restrict on update restrict"); this.dbDdlSyntax.setIdentity("GENERATED BY DEFAULT AS IDENTITY (START WITH 1) "); }
public HsqldbPlatform() { super(); this.name = "hsqldb"; this.dbEncrypt = new H2DbEncrypt(); // only support getGeneratedKeys with non-batch JDBC // so generally use SEQUENCE instead of IDENTITY for H2 boolean useIdentity = GlobalProperties.getBoolean("ebean.hsqldb.useIdentity", true); IdType idType = useIdentity ? IdType.IDENTITY : IdType.SEQUENCE; this.dbIdentity.setIdType(idType); this.dbIdentity.setSupportsGetGeneratedKeys(true); this.dbIdentity.setSupportsSequence(true); this.dbIdentity.setSupportsIdentity(true); this.openQuote = "\""; this.closeQuote = "\""; // H2 data types match default JDBC types // so no changes to dbTypeMap required dbTypeMap.put(Types.INTEGER, new DbType("integer", false)); this.dbDdlSyntax.setDropIfExists("if exists"); this.dbDdlSyntax.setDisableReferentialIntegrity("SET DATABASE REFERENTIAL INTEGRITY FALSE"); this.dbDdlSyntax.setEnableReferentialIntegrity("SET DATABASE REFERENTIAL INTEGRITY TRUE"); this.dbDdlSyntax.setForeignKeySuffix("on delete restrict on update restrict"); this.dbDdlSyntax.setIdentity("GENERATED BY DEFAULT AS IDENTITY (START WITH 1) "); }