GetSchema(string, string[]) Method
Syntax:
public DataTable GetSchema(string collectionName, string[] restrictionValues)
Description:
Returns metadata schema information for this connection using the specified string for the schema (collection) name. The method operates identically to calling GetSchema(collectionName, null)
.
Here are the available collection names.
Collection Name | Description |
DataTypes | Returns information about the types supported by the RDM Data Provider. |
Columns | Returns column information in a table/database. |
ForeignKeys | Returns foreign key information in a table/database. |
ForeignKeyColumns | Returns column information for foreign keys in a table/database. |
Indexes | Returns index information for a table/database. |
IndexColumns | Returns column information for indexes in a table/database. |
MetaDataCollections | Returns information about which collections are available. |
Tables | Returns table information for a database. |
Each of these collections returns a table with the following columns. Each table can support restriction values, which control which rows show up in the table. For instance, the Table collection has three restrictions - one for the database name, one for the table name, and one for the column name. Each is optional. You can query for all the columns in a table by specifying the database name as restriction one, the table name as restriction two and null as restriction three. If you want to query for one column, specify all three restriction values. To specify the second or subsequent restriction, each of the previous restrictions must be specified or be null.
The columns returned and restriction values for each of the collections is described below.
DataTypes: (one restriction value)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
TypeName | String | The RDM type. | 0 |
ProviderDbType | Int32 | The ADO .NET data type (from the RdmTypes class). | |
ColumnSize | Int64 | The maximum length for the type. | |
CreateFormat | String | A string representing how to create this type in a CREATE TABLE statement, containing parameter markers (i.e. {0} or {1}) for each different parameter type. | |
CreateParameters | String | A comma separated list of parameters required to specify the type in a CREATE TABLE statement. | |
DataType | String | The .NET Framework data type that corresponds to the RDM type. | |
IsAutoIncrementable | Boolean | Indicates if the type can be used for a column that auto-increments. This does not mean that all columns of this type are auto-incrementable. | |
IsBestMatch | Boolean | Indicates that the particular RDM type is the best match for the associated .NET Framework type. Multiple RDM types can match to a single .NET Framework type and when they do, only one of them should have the IsBestMatch column set to true. | |
IsCaseSensitive | Boolean | True if the data type holds character data and it is case sensitive. | |
IsFixedLength | Boolean | True if the data type is fixed length once it has been created and false if the field has a variable length. | |
IsFixedPrecisionScale | Boolean | True if the data type has a fixed precision and scale or false if it does not. | |
IsLong | Boolean | True if the data type is considered a long type (i.e. LONG VARCHAR or CLOB) | |
IsNullable | Boolean | True if the data type can be assigned a null value | |
IsSearchable | Boolean | True if the data type can be used in a WHERE clause with any operator, except LIKE. | |
IsSearchableWithLike | Boolean | True if the data type can be used in a WHERE clause with the LIKE operator. | |
IsUnsigned | Boolean | True if the data type is unsigned. | |
MaximumScale | Int16 | If the type is numeric this holds the maximum number of digits allowed to the right of the decimal point. Otherwise it is DbNull.Value. | |
MinimumScale | Int16 | If the type is numeric this holds the minimum number of digits allowed to the right of the decimal point. Otherwise it is DbNull.Value. | |
IsConcurrencyType | Boolean | True if the data type is updated by the database every time a row is modified, false if it is not, and DbNull.Value if the database does not support this kind of type. | |
IsLiteralsSupport | Boolean | True if the data type can be expressed as a literal. | |
LiteralPrefix | String | The prefix applied to specify a literal of this data type. DbNull.Value if no prefix is required. | |
LiteralSuffix | String | The suffix applied to specify a literal of this data type. DbNull.Value if no suffix is required. |
Columns: (3 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the column is from. | 0 |
TableName | String | The table the column is from | 1 |
ColumnName | String | The column name | 2 |
OrdinalPosition | Int32 | The position in the table for the specified column | |
DataType | Int32 | The ADO .NET data type of the column (from the System.Data.DbType enumeration) | |
Nullable | Boolean | Indicates whether the column is nullable or not. |
ForeignKeys: (3 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the foreign key is from. | 0 |
ForeignKeyTableName | String | The table the foreign key is from | 1 |
ForeignKeyName | String | The foreign key name | 2 |
PrimaryKeyTableName | String | The name of the table that contains the associated primary key | |
PrimaryKeyName | String | The name of the associated primary key | |
UpdateRule | Int16 | 0 - indicates that the change will be cascaded 1 - indicates that the value will be changed to null 2 - indicates that the update will cause a failure |
|
DeleteRule | Int16 | Indicates the behavior when a delete would break referential integrity. 0 - indicates that the change will be cascaded. 1 - indicates that the value will be changed to null. 2 - indicates that the delete will cause a failure |
ForeignKeyColumns: (4 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the foreign key is from. | 0 |
TableName | String | The table the foreign key is from | 1 |
Name | String | The foreign key name | 2 |
ColumnName | String | The name of the column name in the foreign key | 3 |
OrdinalPosition | Int16 | The position of the column within the foreign key |
Indexes: (4 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the foreign key is from. | 0 |
TableName | String | The table the foreign key is from | 1 |
Name | String | The foreign key name | 2 |
ColumnName | String | The name of the column name in the foreign key | 3 |
OrdinalPosition | Int16 | The position of the column within the foreign key |
IndexColumns: (4 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the foreign key is from. | 0 |
TableName | String | The table the foreign key is from | 1 |
Name | String | The foreign key name | 2 |
ColumnName | String | The name of the column name in the foreign key | 3 |
OrdinalPosition | Int16 | The position of the column within the foreign key |
MetaDataCollections: (0 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the foreign key is from. | 0 |
TableName | String | The table the foreign key is from | 1 |
Name | String | The foreign key name | 2 |
ColumnName | String | The name of the column name in the foreign key | 3 |
OrdinalPosition | Int16 | The position of the column within the foreign key |
Tables: (3 restriction values)
Column Name | Type | Description | Restriction Index |
---|---|---|---|
DatabaseName | String | The schema (database) the table is from. | 0 |
TableName | String | The table name | 1 |
TableType | String | The table time (currently only ‘TABLE' is supported) | 2 |
Parameters:
collectionName
Type: System.String
Specifies the name of the collection to return.
restrictionValues
Type: System.String []
Specifies a set of restriction values for the requested schema.
Return Value:
Exceptions:
Exception | Condition |
---|---|
RdmException | The SQL engine could not access the meta data. This may occur if a transaction is active for the connection. |
Reference:
For more information, reference MSDN documentation for: System.Data.Common.DbConnection.GetSchema