#1996 - MySQLSyntaxErrorException when update in bulk.

This commit is contained in:
rob bygrave
2020-04-28 21:24:25 +12:00
parent 4a4ec42cdc
commit 6dea4f0890
@@ -98,6 +98,27 @@ public class UpdateQueryTest extends BaseTestCase {
assertSql(sql.get(0)).contains("update o_customer set status = status where id > ?");
}
@Test
public void query_asUpdate_idIn() {
ResetBasicData.reset();
LoggedSqlCollector.start();
int rows = server().find(Customer.class)
.where()
.in("id", 1000, 1001, 1002)
.asUpdate()
.setRaw("status = ?", "A")
.setLabel("asUpdateByIds")
.update();
List<String> sql = LoggedSqlCollector.stop();
assertThat(sql).hasSize(1);
assertThat(rows).isEqualTo(0);
assertSql(sql.get(0)).contains("update o_customer set status = ? where id in (?,?,?)");
}
@Test
public void update_withTransactionBatch() {