Search in sources :

Example 36 with SelectSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder in project dal by ctripcorp.

the class ConfigTemplateDao method getAllConfigTemplates.

public List<ConfigTemplate> getAllConfigTemplates() throws SQLException {
    SelectSqlBuilder builder = new SelectSqlBuilder().selectAll();
    DalHints hints = DalHints.createIfAbsent(null);
    return client.query(builder, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) SelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder)

Example 37 with SelectSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder in project dal by ctripcorp.

the class DaoByFreeSql method getAllTasks.

public List<GenTaskByFreeSql> getAllTasks() throws SQLException {
    DalHints hints = DalHints.createIfAbsent(null);
    SelectSqlBuilder builder = new SelectSqlBuilder().selectAll();
    List<GenTaskByFreeSql> list = client.query(builder, hints);
    processList(list);
    return list;
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) GenTaskByFreeSql(com.ctrip.platform.dal.daogen.entity.GenTaskByFreeSql) FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) SelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder)

Example 38 with SelectSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder in project dal by ctripcorp.

the class DaoBySqlBuilder method getAllTasks.

public List<GenTaskBySqlBuilder> getAllTasks() throws SQLException {
    DalHints hints = DalHints.createIfAbsent(null);
    SelectSqlBuilder builder = new SelectSqlBuilder().selectAll();
    List<GenTaskBySqlBuilder> list = client.query(builder, hints);
    processList(list);
    return list;
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) SelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder) GenTaskBySqlBuilder(com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)

Example 39 with SelectSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder in project dal by ctripcorp.

the class DaoOfLoginUser method getAllUsers.

public List<LoginUser> getAllUsers() throws SQLException {
    SelectSqlBuilder builder = new SelectSqlBuilder().selectAll();
    DalHints hints = DalHints.createIfAbsent(null).allowPartial();
    return client.query(builder, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) SelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder)

Example 40 with SelectSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder in project dal by ctripcorp.

the class BaseQueryBuilderTest method testBuildSingle.

@Test
public void testBuildSingle() throws SQLException {
    SelectSqlBuilder qb;
    qb = createTest("Test", DatabaseCategory.MySql);
    qb.select("columns").where("conditions").orderBy("ob", true).requireSingle();
    assertEquals("SELECT `columns` FROM `Test` WHERE conditions ORDER BY `ob` ASC", qb.build());
    assertEquals("SELECT `columns` FROM `Test_0` WHERE conditions ORDER BY `ob` ASC", qb.build("_0"));
    qb = createTest("Test", DatabaseCategory.SqlServer);
    qb.select("columns").where("conditions").orderBy("ob", true).requireSingle();
    assertEquals("SELECT [columns] FROM [Test] WITH (NOLOCK) WHERE conditions ORDER BY [ob] ASC", qb.build());
    assertEquals("SELECT [columns] FROM [Test_0] WITH (NOLOCK) WHERE conditions ORDER BY [ob] ASC", qb.build("_0"));
}
Also used : SelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder) Test(org.junit.Test)

Aggregations

SelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder)48 Test (org.junit.Test)39 ArrayList (java.util.ArrayList)27 DalHints (com.ctrip.platform.dal.dao.DalHints)15 FreeSelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder)5 DalTableDao (com.ctrip.platform.dal.dao.DalTableDao)4 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)3 DalException (com.ctrip.platform.dal.exceptions.DalException)3 ClientTestModel (test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel)3 SQLException (java.sql.SQLException)2 GenTaskByFreeSql (com.ctrip.platform.dal.daogen.entity.GenTaskByFreeSql)1 GenTaskBySqlBuilder (com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)1