protected virtual DataTable GetSchemaInternal(string collection, string[] restrictions)
{
switch (collection)
{
// common collections
case "METADATACOLLECTIONS":
return GetCollections();
case "DATASOURCEINFORMATION":
return GetDataSourceInformation();
case "DATATYPES":
return GetDataTypes();
case "RESTRICTIONS":
return GetRestrictions();
case "RESERVEDWORDS":
return GetReservedWords();
// collections specific to our provider
case "USERS":
return GetUsers(restrictions);
case "DATABASES":
return GetDatabases(restrictions);
case "UDF":
return GetUDF(restrictions);
}
// if we have a current database and our users have
// not specified a database, then default to the currently
// selected one.
if (restrictions == null)
restrictions = new string[2];
if (connection != null &&
connection.Database != null &&
connection.Database.Length > 0 &&
restrictions.Length > 1 &&
restrictions[1] == null)
restrictions[1] = connection.Database;
switch (collection)
{
case "TABLES":
return GetTables(restrictions);
case "COLUMNS":
return GetColumns(restrictions);
case "INDEXES":
return GetIndexes(restrictions);
case "INDEXCOLUMNS":
return GetIndexColumns(restrictions);
case "FOREIGN KEYS":
return GetForeignKeys(restrictions);
case "FOREIGN KEY COLUMNS":
return GetForeignKeyColumns(restrictions);
}
return null;
}