use of com.ctrip.platform.dal.dao.sqlbuilder.InsertSqlBuilder in project dal by ctripcorp.
the class InsertSqlBuilderTest method testBuildSqlsvr.
@Test
public void testBuildSqlsvr() throws SQLException {
InsertSqlBuilder isb = new InsertSqlBuilder().from("table").setDatabaseCategory(DatabaseCategory.SqlServer);
isb.set("f1", 1, Types.INTEGER);
isb.setSensitive("f2", "abc", Types.VARBINARY);
assertEquals("INSERT INTO [table] ([f1], [f2]) VALUES(?, ?)", isb.build());
assertEquals("INSERT INTO [table_0] ([f1], [f2]) VALUES(?, ?)", isb.build("_0"));
StatementParameters p = isb.buildParameters();
assertEquals(2, p.size());
}
use of com.ctrip.platform.dal.dao.sqlbuilder.InsertSqlBuilder in project dal by ctripcorp.
the class InsertSqlBuilderTest method testBuildMySql.
@Test
public void testBuildMySql() throws SQLException {
InsertSqlBuilder isb = new InsertSqlBuilder().from("table").setDatabaseCategory(DatabaseCategory.MySql);
isb.set("f1", 1, Types.INTEGER);
isb.setSensitive("f2", "abc", Types.VARBINARY);
assertEquals("INSERT INTO `table` (`f1`, `f2`) VALUES(?, ?)", isb.build());
assertEquals("INSERT INTO `table_0` (`f1`, `f2`) VALUES(?, ?)", isb.build("_0"));
StatementParameters p = isb.buildParameters();
assertEquals(2, p.size());
}
Aggregations