buildInnerJoins method
Implementation
String buildInnerJoins(Table parentTable) {
final buffer = StringBuffer();
final columns = parentTable.columns;
for (final column in columns.whereType<ReferenceColumn>()) {
final table = column.references;
buffer.writeln(switch (table.primaryKey) {
SingleColumnKey primaryKey => 'INNER JOIN ${table.name} ON ${table.name}.${primaryKey.column.name} = ${parentTable.name}.${column.name}',
RowIdKey _ => 'INNER JOIN ${table.name} ON ${table.name}.Rowid = ${parentTable.name}.${column.name}',
});
if (table.hasReferences) buffer.writeln(buildInnerJoins(table));
}
return buffer.toString();
}