public bool MatchesReference(string catalog, string schema, string table)
{
var schemaName = GivenTableName.Parent;
var catalogName = schemaName == null ? null : schemaName.Parent;
// Does this table name represent the correct schema?
var givenSchema = schemaName != null ? schemaName.Name : null;
if (schema != null && !StringCompare(schema, givenSchema)) {
// If schema is present and we can't resolve to this schema then false
return false;
}
var givenCatalog = catalogName != null ? catalogName.Name : null;
if (catalog != null && !StringCompare(catalog, givenCatalog))
return false;
if (table != null && !StringCompare(table, GivenTableName.Name)) {
// If table name is present and we can't resolve to this table name
// then return false
return false;
}
// Match was successful,
return true;
}