use of com.querydsl.sql.dml.SQLDeleteClause in project querydsl by querydsl.
the class SQLSerializerTest method noSchemaInWhere.
@Test
public void noSchemaInWhere() {
Configuration defaultWithPrintSchema = new Configuration(new SQLTemplates(Keywords.DEFAULT, "\"", '\\', false, false));
defaultWithPrintSchema.getTemplates().setPrintSchema(true);
QEmployee e = QEmployee.employee;
SQLDeleteClause delete = new SQLDeleteClause(EasyMock.createNiceMock(Connection.class), defaultWithPrintSchema, e);
delete.where(e.id.gt(100));
assertEquals("delete from PUBLIC.EMPLOYEE\n" + "where EMPLOYEE.ID > ?", delete.toString());
}
use of com.querydsl.sql.dml.SQLDeleteClause in project querydsl by querydsl.
the class SQLSerializerTest method schemaInWhere.
@Test
public void schemaInWhere() {
Configuration derbyWithPrintSchema = new Configuration(DerbyTemplates.builder().printSchema().build());
QEmployee e = QEmployee.employee;
SQLDeleteClause delete = new SQLDeleteClause(EasyMock.createNiceMock(Connection.class), derbyWithPrintSchema, e);
delete.where(e.id.gt(100));
assertEquals("delete from \"PUBLIC\".EMPLOYEE\n" + "where \"PUBLIC\".EMPLOYEE.ID > ?", delete.toString());
}
use of com.querydsl.sql.dml.SQLDeleteClause in project querydsl by querydsl.
the class SQLServer2012TemplatesTest method delete_limit.
@Test
public void delete_limit() {
SQLDeleteClause clause = new SQLDeleteClause(null, createTemplates(), survey1);
clause.where(survey1.name.eq("Bob"));
clause.limit(5);
assertEquals("delete top 5 from SURVEY\n" + "where SURVEY.NAME = ?", clause.toString());
}
use of com.querydsl.sql.dml.SQLDeleteClause in project querydsl by querydsl.
the class AbstractBaseTest method delete.
protected SQLDeleteClause delete(RelationalPath<?> e) {
SQLDeleteClause sqlDeleteClause = new SQLDeleteClause(connection, configuration, e);
sqlDeleteClause.addListener(new TestLoggingListener());
return sqlDeleteClause;
}
use of com.querydsl.sql.dml.SQLDeleteClause in project querydsl by querydsl.
the class DeleteBase method batch_templates.
@Test
@ExcludeIn({ CUBRID, SQLITE })
public void batch_templates() throws SQLException {
insert(survey).values(2, "A", "B").execute();
insert(survey).values(3, "B", "C").execute();
SQLDeleteClause delete = delete(survey);
delete.where(survey.name.eq(Expressions.stringTemplate("'A'"))).addBatch();
delete.where(survey.name.eq(Expressions.stringTemplate("'B'"))).addBatch();
assertEquals(2, delete.execute());
}
Aggregations