mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
Fixed to do index++ when fetching generated ids (with test coverage)
This commit is contained in:
@ -80,7 +80,7 @@ public class RDBMSInsertAction extends AbstractRDBMSAction implements InsertInte
|
||||
int index = 0;
|
||||
for(QRecord record : insertRequest.getRecords())
|
||||
{
|
||||
Integer id = idList.get(index);
|
||||
Integer id = idList.get(index++);
|
||||
QRecordWithStatus recordWithStatus = new QRecordWithStatus(record);
|
||||
recordWithStatus.setPrimaryKey(id);
|
||||
recordWithStatus.setValue(table.getPrimaryKeyField(), id);
|
||||
|
@ -81,8 +81,8 @@ public class RDBMSInsertActionTest extends RDBMSActionTest
|
||||
insertRequest.setRecords(List.of(record1, record2));
|
||||
InsertResult insertResult = new RDBMSInsertAction().execute(insertRequest);
|
||||
assertEquals(2, insertResult.getRecords().size(), "Should return 1 row");
|
||||
assertNotNull(insertResult.getRecords().get(0).getValue("id"), "Should have an id in the row");
|
||||
assertNotNull(insertResult.getRecords().get(1).getValue("id"), "Should have an id in the row");
|
||||
assertEquals(6, insertResult.getRecords().get(0).getValue("id"), "Should have next id in the row");
|
||||
assertEquals(7, insertResult.getRecords().get(1).getValue("id"), "Should have next id in the row");
|
||||
assertTrue(insertResult.getRecords().stream().noneMatch(qrs -> CollectionUtils.nullSafeHasContents(qrs.getErrors())), "There should be no errors");
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Picard'", (rs -> {
|
||||
int rowsFound = 0;
|
||||
|
Reference in New Issue
Block a user