r2.setId(2);
r2.setTitle(BOOK_TITLES.get(1));
// Unnesting arrays
assertEquals(emptyList(),
create().select().from(table(new UBookArrayRecord(ora(), (UBookTypeRecord[]) null))).fetch(0));
assertEquals(emptyList(),
create().select().from(table(new UBookArrayRecord(ora()))).fetch(0));
assertEquals(asList(1),
create().select().from(table(new UBookArrayRecord(ora(), r1))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 1),
create().select().from(table(new UBookArrayRecord(ora(), r1))).fetch(1));
assertEquals(asList(1, 2),
create().select().from(table(new UBookArrayRecord(ora(), r1, r2))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 2),
create().select().from(table(new UBookArrayRecord(ora(), r1, r2))).fetch(1));
// Unnesting tables
assertEquals(emptyList(),
create().select().from(table(new UBookTableRecord(ora(), (UBookTypeRecord[]) null))).fetch(0));
assertEquals(emptyList(),
create().select().from(table(new UBookTableRecord(ora()))).fetch(0));
assertEquals(asList(1),
create().select().from(table(new UBookTableRecord(ora(), r1))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 1),
create().select().from(table(new UBookTableRecord(ora(), r1))).fetch(1));
assertEquals(asList(1, 2),
create().select().from(table(new UBookTableRecord(ora(), r1, r2))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 2),
create().select().from(table(new UBookTableRecord(ora(), r1, r2))).fetch(1));
// Unnesting arrays from functions
assertEquals(emptyList(),
create().select().from(table(fArrays4((UBookArrayRecord) null))).fetch(0));
assertEquals(emptyList(),
create().select().from(table(fArrays4(new UBookArrayRecord(ora(), (UBookTypeRecord[]) null)))).fetch(0));
assertEquals(emptyList(),
create().select().from(table(fArrays4(new UBookArrayRecord(ora())))).fetch(0));
assertEquals(asList(1),
create().select().from(table(fArrays4(new UBookArrayRecord(ora(), r1)))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 1),
create().select().from(table(fArrays4(new UBookArrayRecord(ora(), r1)))).fetch(1));
assertEquals(asList(1, 2),
create().select().from(table(fArrays4(fArrays4(new UBookArrayRecord(ora(), r1, r2))))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 2),
create().select().from(table(fArrays4(fArrays4(new UBookArrayRecord(ora(), r1, r2))))).fetch(1));
// Unnesting tables from functions
assertEquals(emptyList(),
create().select().from(table(fTables4((UBookTableRecord) null))).fetch(0));
assertEquals(emptyList(),
create().select().from(table(fTables4(new UBookTableRecord(ora(), (UBookTypeRecord[]) null)))).fetch(0));
assertEquals(emptyList(),
create().select().from(table(fTables4(new UBookTableRecord(ora())))).fetch(0));
assertEquals(asList(1),
create().select().from(table(fTables4(new UBookTableRecord(ora(), r1)))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 1),
create().select().from(table(fTables4(new UBookTableRecord(ora(), r1)))).fetch(1));
assertEquals(asList(1, 2),
create().select().from(table(fTables4(fTables4(new UBookTableRecord(ora(), r1, r2))))).fetch(0));
assertEquals(BOOK_TITLES.subList(0, 2),
create().select().from(table(fTables4(fTables4(new UBookTableRecord(ora(), r1, r2))))).fetch(1));
// Retrieving arrays from functions
assertNull(fArrays4(ora(), null));
assertEquals(emptyList(),
fArrays4(ora(), new UBookArrayRecord(ora(), (UBookTypeRecord[]) null)).getList());
assertEquals(emptyList(),
fArrays4(ora(), new UBookArrayRecord(ora())).getList());
assertEquals(asList(r1),
fArrays4(ora(), fArrays4(ora(), new UBookArrayRecord(ora(), r1))).getList());
assertEquals(asList(r1, r2),
fArrays4(ora(), fArrays4(ora(), new UBookArrayRecord(ora(), r1, r2))).getList());
// Retrieving tables from functions
assertNull(fTables4(ora(), null));
assertEquals(emptyList(),
fTables4(ora(), new UBookTableRecord(ora(), (UBookTypeRecord[]) null)).getList());