In this overload first parameter is name of a collection, and second parameter is the array of restrictions to be applied when querying information. These restrictions specify which subset of the collection will be returned. The restrictions can include, for example, the database name (in this case, only collection elements belonging to this database will be returned) or the mask for the name of collection elements (only the elements satisfying this mask will be returned). The quantity and description of restrictions allowed for each metadata collection are represented in the table
here. Their number can also be obtained from the return of the GetSchema() method. If the second parameter is null/Nothing, it is ignored.
Instead of specifying the metadata collection name as a string constant, you may use members of System.Data.DbMetaDataCollectionNames and
Devart.Data.SQLite.SQLiteMetadataCollectionNames as the first GetSchema argument values. The members of these classes are the string fields, each field stores the corresponding metadata collection name. It is recommended to use these fields rather than manually input the collection names manually as the string constants because in case of using these fields, you will find misspellings at compile-time, and intellisense will show you all the available metadata collection names.
GetSchema Method Reference
The following table provides detailed information on metadata collections that can be retrieved using the GetSchema method, and restrictions that can be applied for them. When calling the GetSchema method, you can pass all or few arguments. In the latter case, some default values are assumed, if they were not specified explicitly. The default value of catalog restriction is "main" - the currently opened database.
Collection Name
| Number of restrictions |
Remarks
|
Catalogs |
1
|
Lists all connected catalogs.
When restricted by name mask, returns all catalogs that match the mask.
|
Columns |
3
|
Returns list of columns, their type and some extra information.
- The first restriction is name of a catalog that GetSchema method should search in.
- The second restriction is name of a table that GetSchema method should search in.
- At last, you can set column name pattern as described in "Tables" collection.
|
DatasourceInformation |
0
|
Returns information about the data source.
|
DataTypes |
0
|
Returns information about data types supported by the data source.
|
ForeignKeyColumns |
3
|
Returns list of columns used by foreign keys in the catalog.
Restrict it with catalog name, table name, and the foreign key name pattern.
|
ForeignKeys |
3
|
Returns list of columns that participate in foreign keys.
- The first restriction for this collection is name of a catalog.
- The second restriction is table name mask.
- The third restriction is the key pattern.
|
IndexColumns |
4
|
Returns list of indexed columns in the catalog, their type and some extra information.
Restrict it with catalog name, table name, index name pattern, and column name pattern.
|
Indexes |
3
|
Returns list of indexes and their details.
- The first restriction is catalog name
- The second restriction is table name.
- The last restriction is the index name pattern.
|
MetaDataCollections |
0
|
Returns this list. Same as using GetSchema() method without parameters.
|
PrimaryKeys |
2
|
Returns list of columns that participate in primary keys.
- The first restriction for this collection is name of a catalog.
- The second restriction is table name.
|
ReservedWords |
0
|
Lists all reserved words used in the server.
|
Restrictions |
0
|
Returns list of possible restrictions and their default values for the metadata collections.
|
Tables |
2
|
GetSchema("Tables") returns list of tables in "main" catalog.
- The first restriction for this collection is name of a catalog. If specified, the method returns all tables within the catalog.
- The second restriction is table name mask. You can use wildcards ‘%‘ (any number of characters) and ‘_‘ (one character) to retrieve names of tables that match the mask.
|
UniqueKeys |
2
|
- Returns list of columns that participate in unique keys.
- The first restriction for this collection is name of a catalog.
- The second restriction is table name.
|
ViewColumns |
3
|
Returns list of columns used by views in the catalog.
Restrict it with catalog name, table name and column name.
|
Views |
2
|
GetSchema("Views") returns list of views in "main" catalog.
- The first restriction for this collection is name of a catalog.
- The second restriction is view name mask.
|