Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of DbConnection.GetSchema collection names?

Tags:

ado.net

When you call DbConnection.GetSchema you give it the string name of a collection you are interested in. I can't find a list of collections anywhere. Is the list of collections immutable or does it vary by database type (orcle, sql server, etc.)?

I'm interested in getting a list of all collection names in a few database types such as sql server, and sqlite.

like image 920
P a u l Avatar asked Jan 17 '09 17:01

P a u l


2 Answers

I use an OleDbConnection even if I'm connecting with Oracle, Sql Server... Then I can use:

myOleDbConnection.GetOleDbSchemaTable(OleDbSchemGuid.Tables);

Possible values for OleDbSchemaGuid:
(note that depending of the database some of these can throw a NotSupported Exception:

OleDbSchemaGuid.Assertions;
OleDbSchemaGuid.Catalogs;
OleDbSchemaGuid.Character_Sets;
OleDbSchemaGuid.Check_Constraints;
OleDbSchemaGuid.Check_Constraints_By_Table;
OleDbSchemaGuid.Collations;
OleDbSchemaGuid.Column_Domain_Usage;
OleDbSchemaGuid.Column_Privileges;
OleDbSchemaGuid.Columns;
OleDbSchemaGuid.Constraint_Column_Usage;
OleDbSchemaGuid.Constraint_Table_Usage;
OleDbSchemaGuid.DbInfoKeywords;
OleDbSchemaGuid.DbInfoLiterals;
OleDbSchemaGuid.Foreign_Keys;
OleDbSchemaGuid.Indexes;
OleDbSchemaGuid.Key_Column_Usage;
OleDbSchemaGuid.Primary_Keys;
OleDbSchemaGuid.Procedure_Columns;
OleDbSchemaGuid.Procedure_Parameters;
OleDbSchemaGuid.Procedures;
OleDbSchemaGuid.Provider_Types;
OleDbSchemaGuid.Referential_Constraints;
OleDbSchemaGuid.SchemaGuids;
OleDbSchemaGuid.Schemata;
OleDbSchemaGuid.Sql_Languages;
OleDbSchemaGuid.Statistics;
OleDbSchemaGuid.Table_Constraints;
OleDbSchemaGuid.Table_Privileges;
OleDbSchemaGuid.Table_Statistics;
OleDbSchemaGuid.Tables;
OleDbSchemaGuid.Tables_Info;
OleDbSchemaGuid.Translations;
OleDbSchemaGuid.Trustee;
OleDbSchemaGuid.Usage_Privileges;
OleDbSchemaGuid.View_Column_Usage;
OleDbSchemaGuid.View_Table_Usage;
OleDbSchemaGuid.Views;
like image 183
JAG Avatar answered Sep 17 '22 22:09

JAG


The list varies by provider. For this reason, some Common Schema Collections have been defined, that are always available regardless of the provider. One of them is the MetaDataCollections collection, which will return a DataTable with a list of the supported schema collections for the current provider, the number of restrictions that they each support, and the number of identifier parts that they use.

like image 45
D'Arcy Rittich Avatar answered Sep 19 '22 22:09

D'Arcy Rittich