use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder in project dal by ctripcorp.
the class AbstractFreeSqlBuilderTest method testSetInWhen.
@Test
public void testSetInWhen() throws SQLException {
AbstractFreeSqlBuilder test = new AbstractFreeSqlBuilder();
test.setLogicDbName(logicDbName);
StatementParameters p = new StatementParameters();
test.with(p);
List<String> paras = new ArrayList<>();
paras.add("abc1");
paras.add("abc2");
paras.add("abc3");
test.select(template).setIn(false, template, paras, Types.VARCHAR);
assertEquals("SELECT [template]", test.build());
StatementParameters parameters = test.buildParameters();
assertEquals(0, parameters.size());
}
use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder in project dal by ctripcorp.
the class AbstractFreeSqlBuilderTest method testText.
@Test
public void testText() {
AbstractFreeSqlBuilder test = create();
test.append(text(template));
assertEquals(template, test.build());
}
use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder in project dal by ctripcorp.
the class AbstractFreeSqlBuilderTest method testOrderBy.
@Test
public void testOrderBy() {
AbstractFreeSqlBuilder test = create();
test.orderBy(template, true);
test.setLogicDbName(logicDbName);
test.setHints(new DalHints());
assertEquals("ORDER BY " + wrappedTemplate + " ASC", test.build());
}
use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder in project dal by ctripcorp.
the class AbstractFreeSqlBuilderTest method testAppendClauseConditionWithElse.
@Test
public void testAppendClauseConditionWithElse() {
AbstractFreeSqlBuilder test = create();
test.appendWhen(true, new Text(template), new Text(elseTemplate));
assertEquals(template, test.build());
test = create();
test.appendWhen(false, new Text(template), new Text(elseTemplate));
assertEquals(elseTemplate, test.build());
}
use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder in project dal by ctripcorp.
the class AbstractFreeSqlBuilderTest method testColumns.
@Test
public void testColumns() {
AbstractFreeSqlBuilder test = create();
test.append(columns(template, template, template));
assertEquals("[template] [template] [template]", test.build());
}
Aggregations