table method
The table called qualifiedName — dbo.Orders — or null.
Names are compared case-insensitively, which is right for a default SQL Server collation and wrong for a case-sensitive one. Where two tables differ only in case, this refuses rather than picking: see ambiguousNames.
Implementation
MssqlTableSchema? table(String qualifiedName) {
final wanted = qualifiedName.toLowerCase();
MssqlTableSchema? found;
for (final table in tables) {
if (table.qualifiedName.toLowerCase() != wanted) continue;
if (table.qualifiedName == qualifiedName) return table;
if (found != null) {
throw StateError(
'The snapshot holds ${found.qualifiedName} and '
'${table.qualifiedName}, which differ only in case. This database '
'has a case-sensitive collation; name the table exactly.',
);
}
found = table;
}
return found;
}