Search in sources :

Example 1 with Mssql2008Dialect

use of org.seasar.doma.jdbc.dialect.Mssql2008Dialect in project doma by domaframework.

the class NativeSqlSelectTest method expression_concat_mssql2008.

@Test
void expression_concat_mssql2008() {
    NativeSql nativeSql = new NativeSql(new MockConfig() {

        @Override
        public Dialect getDialect() {
            return new Mssql2008Dialect();
        }
    });
    Emp_ e = new Emp_();
    Buildable<?> stmt = nativeSql.from(e).select(concat(e.name, "a"));
    Sql<?> sql = stmt.asSql();
    assertEquals("select (t0_.NAME + 'a') from EMP t0_", sql.getFormattedSql());
}
Also used : Mssql2008Dialect(org.seasar.doma.jdbc.dialect.Mssql2008Dialect) Emp_(org.seasar.doma.jdbc.criteria.entity.Emp_) NoIdEmp_(org.seasar.doma.jdbc.criteria.entity.NoIdEmp_) Dialect(org.seasar.doma.jdbc.dialect.Dialect) Db2Dialect(org.seasar.doma.jdbc.dialect.Db2Dialect) OracleDialect(org.seasar.doma.jdbc.dialect.OracleDialect) MssqlDialect(org.seasar.doma.jdbc.dialect.MssqlDialect) Mssql2008Dialect(org.seasar.doma.jdbc.dialect.Mssql2008Dialect) PostgresDialect(org.seasar.doma.jdbc.dialect.PostgresDialect) MockConfig(org.seasar.doma.internal.jdbc.mock.MockConfig) Test(org.junit.jupiter.api.Test)

Example 2 with Mssql2008Dialect

use of org.seasar.doma.jdbc.dialect.Mssql2008Dialect in project doma by domaframework.

the class ScriptReaderTest method setUp.

@BeforeEach
public void setUp() {
    MockConfig config = new MockConfig();
    config.dialect = new Mssql2008Dialect();
    query = new SqlFileScriptQuery() {

        @Override
        public void prepare() {
        }
    };
    query.setConfig(config);
    query.setCallerClassName("aaa");
    query.setCallerMethodName("bbb");
    query.setBlockDelimiter(config.dialect.getScriptBlockDelimiter());
    query.prepare();
}
Also used : Mssql2008Dialect(org.seasar.doma.jdbc.dialect.Mssql2008Dialect) MockConfig(org.seasar.doma.internal.jdbc.mock.MockConfig) SqlFileScriptQuery(org.seasar.doma.jdbc.query.SqlFileScriptQuery) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with Mssql2008Dialect

use of org.seasar.doma.jdbc.dialect.Mssql2008Dialect in project doma by domaframework.

the class SqlFileScriptQueryTest method testPrepare_dbmsSpecific.

@Test
public void testPrepare_dbmsSpecific() {
    config.dialect = new Mssql2008Dialect();
    SqlFileScriptQuery query = new SqlFileScriptQuery();
    query.setConfig(config);
    query.setMethod(method);
    query.setCallerClassName("aaa");
    query.setCallerMethodName("bbb");
    query.setScriptFilePath("META-INF/org/seasar/doma/jdbc/query/SqlFileScriptQueryTest/testPrepare_dbmsSpecific.script");
    query.setBlockDelimiter("");
    query.prepare();
    assertEquals(config, query.getConfig());
    assertEquals("aaa", query.getClassName());
    assertEquals("bbb", query.getMethodName());
    assertEquals("META-INF/org/seasar/doma/jdbc/query/SqlFileScriptQueryTest/testPrepare_dbmsSpecific-mssql.script", query.getScriptFilePath());
    assertNotNull(query.getScriptFileUrl());
    assertEquals("GO", query.getBlockDelimiter());
}
Also used : Mssql2008Dialect(org.seasar.doma.jdbc.dialect.Mssql2008Dialect) Test(org.junit.jupiter.api.Test)

Aggregations

Mssql2008Dialect (org.seasar.doma.jdbc.dialect.Mssql2008Dialect)3 Test (org.junit.jupiter.api.Test)2 MockConfig (org.seasar.doma.internal.jdbc.mock.MockConfig)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Emp_ (org.seasar.doma.jdbc.criteria.entity.Emp_)1 NoIdEmp_ (org.seasar.doma.jdbc.criteria.entity.NoIdEmp_)1 Db2Dialect (org.seasar.doma.jdbc.dialect.Db2Dialect)1 Dialect (org.seasar.doma.jdbc.dialect.Dialect)1 MssqlDialect (org.seasar.doma.jdbc.dialect.MssqlDialect)1 OracleDialect (org.seasar.doma.jdbc.dialect.OracleDialect)1 PostgresDialect (org.seasar.doma.jdbc.dialect.PostgresDialect)1 SqlFileScriptQuery (org.seasar.doma.jdbc.query.SqlFileScriptQuery)1