use of com.querydsl.sql.dml.SQLUpdateClause in project querydsl by querydsl.
the class UpdateBase method update_with_subQuery_notExists.
@Test
public void update_with_subQuery_notExists() {
QSurvey survey1 = new QSurvey("s1");
QEmployee employee = new QEmployee("e");
SQLUpdateClause update = update(survey1);
update.set(survey1.name, "AA");
update.where(query().from(employee).where(survey1.id.eq(employee.id)).notExists());
assertEquals(0, update.execute());
}
use of com.querydsl.sql.dml.SQLUpdateClause in project querydsl by querydsl.
the class AbstractBaseTest method update.
protected SQLUpdateClause update(RelationalPath<?> e) {
SQLUpdateClause sqlUpdateClause = new SQLUpdateClause(connection, configuration, e);
sqlUpdateClause.addListener(new TestLoggingListener());
return sqlUpdateClause;
}
use of com.querydsl.sql.dml.SQLUpdateClause in project querydsl by querydsl.
the class SerializationTest method update.
@Test
public void update() {
SQLUpdateClause updateClause = new SQLUpdateClause(connection, SQLTemplates.DEFAULT, survey);
updateClause.set(survey.id, 1);
updateClause.set(survey.name, (String) null);
assertEquals("update SURVEY\nset ID = ?, NAME = ?", updateClause.toString());
}
use of com.querydsl.sql.dml.SQLUpdateClause in project querydsl by querydsl.
the class SQLServer2012TemplatesTest method update_limit.
@Test
public void update_limit() {
SQLUpdateClause clause = new SQLUpdateClause(null, createTemplates(), survey1);
clause.set(survey1.name, "Bob");
clause.limit(5);
assertEquals("update top 5 SURVEY\n" + "set NAME = ?", clause.toString());
}
use of com.querydsl.sql.dml.SQLUpdateClause in project querydsl by querydsl.
the class UpdateBase method batch.
@Test
public void batch() throws SQLException {
assertEquals(1, insert(survey).values(2, "A", "B").execute());
assertEquals(1, insert(survey).values(3, "B", "C").execute());
SQLUpdateClause update = update(survey);
update.set(survey.name, "AA").where(survey.name.eq("A")).addBatch();
assertEquals(1, update.getBatchCount());
update.set(survey.name, "BB").where(survey.name.eq("B")).addBatch();
assertEquals(2, update.getBatchCount());
assertEquals(2, update.execute());
}
Aggregations