use of org.seasar.doma.jdbc.dialect.Db2Dialect in project doma-spring-boot by domaframework.
the class DomaAutoConfiguration method dialect.
@Bean
@ConditionalOnMissingBean
public Dialect dialect(Environment environment) {
DialectType dialectType = domaProperties.getDialect();
if (dialectType != null) {
return dialectType.create();
}
String url = environment.getProperty("spring.datasource.url");
if (url != null) {
DatabaseDriver databaseDriver = DatabaseDriver.fromJdbcUrl(url);
switch(databaseDriver) {
case DB2:
return new Db2Dialect();
case H2:
return new H2Dialect();
case HSQLDB:
return new HsqldbDialect();
case SQLSERVER:
case JTDS:
return new MssqlDialect();
case MYSQL:
return new MysqlDialect();
case ORACLE:
return new OracleDialect();
case POSTGRESQL:
return new PostgresDialect();
case SQLITE:
return new SqliteDialect();
default:
break;
}
}
if (logger.isWarnEnabled()) {
logger.warn("StandardDialect was selected because no explicit configuration and it is not possible to guess from 'spring.datasource.url property'");
}
return new StandardDialect();
}
use of org.seasar.doma.jdbc.dialect.Db2Dialect in project doma by domaframework.
the class NativeSqlSelectTest method forUpdate_db2.
@Test
void forUpdate_db2() {
NativeSql nativeSql = new NativeSql(new MockConfig() {
@Override
public Dialect getDialect() {
return new Db2Dialect();
}
});
Emp_ e = new Emp_();
Buildable<?> stmt = nativeSql.from(e).where(c -> c.eq(e.id, 1)).forUpdate().select(e.id);
Sql<?> sql = stmt.asSql();
assertEquals("select t0_.ID from EMP t0_ where t0_.ID = 1 for update with rs", sql.getFormattedSql());
}
Aggregations