use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.
the class DaoOfUserProject method deleteUserProject.
public int deleteUserProject(int project_id) throws SQLException {
FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
builder.setTemplate("DELETE FROM user_project WHERE project_id = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "project_id", Types.INTEGER, project_id);
DalHints hints = DalHints.createIfAbsent(null);
return queryDao.update(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.
the class UserGroupDao method deleteUserFromGroup.
public int deleteUserFromGroup(Integer user_id, Integer group_id) throws SQLException {
FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
builder.setTemplate("DELETE FROM user_group WHERE user_id=? AND group_id=?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "user_id", Types.INTEGER, user_id);
parameters.set(i++, "group_id", Types.INTEGER, group_id);
DalHints hints = DalHints.createIfAbsent(null);
return queryDao.update(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.
the class FreeUpdateSqlBuilderTest method testDeleteFrom.
@Test
public void testDeleteFrom() throws SQLException {
FreeUpdateSqlBuilder test = createTest();
test.deleteFrom(noShardTableName);
assertEquals("DELETE FROM " + wrappedNoShardTableName, test.build());
test = createTest();
test.deleteFrom(table(noShardTableName));
assertEquals("DELETE FROM " + wrappedNoShardTableName, test.build());
test = createTest();
test.deleteFrom(table(noShardTableName));
test.where(template);
assertEquals("DELETE FROM " + wrappedNoShardTableName + " WHERE " + template, test.build());
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.
the class FreeUpdateSqlBuilderTest method testUpdate.
@Test
public void testUpdate() throws SQLException {
FreeUpdateSqlBuilder test = createTest();
test.update(noShardTableName);
assertEquals("UPDATE " + wrappedNoShardTableName, test.build());
test = createTest();
test.update(table(noShardTableName));
assertEquals("UPDATE " + wrappedNoShardTableName, test.build());
test = createTest();
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.
the class FreeUpdateSqlBuilderTest method testDeleteFromMeltdown.
@Test
public void testDeleteFromMeltdown() throws SQLException {
FreeUpdateSqlBuilder test = createTest();
test.deleteFrom(noShardTableName);
test.where().and(template, template, template);
assertEquals("DELETE FROM " + wrappedNoShardTableName + " WHERE template AND template AND template", test.build());
}
Aggregations