use of org.seasar.doma.jdbc.dialect.OracleDialect 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.OracleDialect in project doma by domaframework.
the class NativeSqlSelectTest method forUpdate_oracle_nowait.
@Test
void forUpdate_oracle_nowait() {
NativeSql nativeSql = new NativeSql(new MockConfig() {
@Override
public Dialect getDialect() {
return new OracleDialect();
}
});
Emp_ e = new Emp_();
Buildable<?> stmt = nativeSql.from(e).forUpdate(ForUpdateOption.noWait()).select(e.id);
Sql<?> sql = stmt.asSql();
assertEquals("select t0_.ID from EMP t0_ for update nowait", sql.getFormattedSql());
}
use of org.seasar.doma.jdbc.dialect.OracleDialect in project doma by domaframework.
the class NativeSqlSelectTest method forUpdate_oracle_wait_withColumn.
@Test
void forUpdate_oracle_wait_withColumn() {
NativeSql nativeSql = new NativeSql(new MockConfig() {
@Override
public Dialect getDialect() {
return new OracleDialect();
}
});
Emp_ e = new Emp_();
Dept_ d = new Dept_();
Buildable<?> stmt = nativeSql.from(e).innerJoin(d, on -> on.eq(e.id, d.id)).forUpdate(ForUpdateOption.wait(5, e.id, d.id)).select(e.id);
Sql<?> sql = stmt.asSql();
assertEquals("select t0_.ID from EMP t0_ inner join CATA.DEPT t1_ on (t0_.ID = t1_.ID) for update of t0_.ID, t1_.ID wait 5", sql.getFormattedSql());
}
use of org.seasar.doma.jdbc.dialect.OracleDialect in project doma by domaframework.
the class NativeSqlSelectTest method forUpdate_oracle_nowait_withColumn.
@Test
void forUpdate_oracle_nowait_withColumn() {
NativeSql nativeSql = new NativeSql(new MockConfig() {
@Override
public Dialect getDialect() {
return new OracleDialect();
}
});
Emp_ e = new Emp_();
Dept_ d = new Dept_();
Buildable<?> stmt = nativeSql.from(e).innerJoin(d, on -> on.eq(e.id, d.id)).forUpdate(ForUpdateOption.noWait(e.id, d.id)).select(e.id);
Sql<?> sql = stmt.asSql();
assertEquals("select t0_.ID from EMP t0_ inner join CATA.DEPT t1_ on (t0_.ID = t1_.ID) for update of t0_.ID, t1_.ID nowait", sql.getFormattedSql());
}
use of org.seasar.doma.jdbc.dialect.OracleDialect in project doma by domaframework.
the class GreedyCacheSqlFileRepositoryTest method testGetSqlFile_oracle.
@Test
public void testGetSqlFile_oracle() {
OracleDialect dialect = new OracleDialect();
String path = "META-INF/" + getClass().getName().replace(".", "/") + ".sql";
GreedyCacheSqlFileRepository repository = new GreedyCacheSqlFileRepository();
SqlFile sqlFile = repository.getSqlFile(method, path, dialect);
assertEquals("META-INF/" + getClass().getName().replace(".", "/") + "-oracle.sql", sqlFile.getPath());
}
Aggregations