use of com.querydsl.sql.dml.SQLInsertClause in project querydsl by querydsl.
the class MySQLQueryFactory method insertOnDuplicateKeyUpdate.
/**
* Create a INSERT ... ON DUPLICATE KEY UPDATE clause
*
* @param entity table to insert to
* @param clause clause
* @return insert clause
*/
public SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, String clause) {
SQLInsertClause insert = insert(entity);
insert.addFlag(Position.END, " on duplicate key update " + clause);
return insert;
}
use of com.querydsl.sql.dml.SQLInsertClause in project querydsl by querydsl.
the class MySQLQueryFactory method insertIgnore.
/**
* Create a INSERT IGNORE INTO clause
*
* @param entity table to insert to
* @return insert clause
*/
public SQLInsertClause insertIgnore(RelationalPath<?> entity) {
SQLInsertClause insert = insert(entity);
insert.addFlag(Position.START_OVERRIDE, "insert ignore into ");
return insert;
}
use of com.querydsl.sql.dml.SQLInsertClause in project querydsl by querydsl.
the class LikeEscapeBase method setUp.
@Before
public void setUp() throws SQLException {
delete(survey).execute();
SQLInsertClause insert = insert(survey);
insert.set(survey.id, 5).set(survey.name, "aaa").addBatch();
insert.set(survey.id, 6).set(survey.name, "a_").addBatch();
insert.set(survey.id, 7).set(survey.name, "a%").addBatch();
insert.execute();
}
use of com.querydsl.sql.dml.SQLInsertClause in project querydsl by querydsl.
the class InsertBase method insert_with_special_options.
@Test
@IncludeIn(MYSQL)
@SkipForQuoted
public void insert_with_special_options() {
SQLInsertClause clause = insert(survey).columns(survey.id, survey.name).values(3, "Hello");
clause.addFlag(Position.START_OVERRIDE, "insert ignore into ");
assertEquals("insert ignore into SURVEY (ID, NAME) values (?, ?)", clause.toString());
assertEquals(1, clause.execute());
}
use of com.querydsl.sql.dml.SQLInsertClause in project querydsl by querydsl.
the class InsertBase method insert_batch2.
@Test
public void insert_batch2() {
SQLInsertClause insert = insert(survey).set(survey.id, 5).set(survey.name, "55").addBatch();
insert.set(survey.id, 6).setNull(survey.name).addBatch();
assertEquals(2, insert.execute());
}
Aggregations