Returns schema information for the data source of this SAConnection object and, if specified, uses the specified string for the schema name and the specified string array for the restriction values.
Public Overrides Function GetSchema(
ByVal collection As String,
ByVal restrictions As String()
) As DataTable
public override DataTable GetSchema(
string collection,
string[] restrictions
)
A DataTable that contains schema information.
These methods are used to query the database server for various metadata. Each type of metadata is given a collection name, which must be passed to receive that data. The default collection name is MetaDataCollections.
You can query the SQL Anywhere SQL Anywhere .NET Data Provider to determine the list of supported schema collections by calling the GetSchema method with no arguments, or with the schema collection name MetaDataCollections. This will return a DataTable with a list of the supported schema collections (CollectionName), the number of restrictions that they each support (NumberOfRestrictions), and the number of identifier parts that they use (NumberOfIdentifierParts).
Collection | Metadata |
---|---|
Columns | Returns information on all columns in the database. |
DataSourceInformation | Returns information about the database server. |
DataTypes | Returns a list of supported data types. |
ForeignKeys | Returns information on all foreign keys in the database. |
IndexColumns | Returns information on all index columns in the database. |
Indexes | Returns information on all indexes in the database. |
MetaDataCollections | Returns a list of all collection names. |
ProcedureParameters | Returns information on all procedure parameters in the database. |
Procedures | Returns information on all procedures in the database. |
ReservedWords | Returns a list of reserved words used by SQL Anywhere. |
Restrictions | Returns information on restrictions used in GetSchema. |
Tables | Returns information on all tables in the database. |
UserDefinedTypes | Returns information on all user-defined data types in the database. |
Users | Returns information on all users in the database. |
ViewColumns | Returns information on all columns in views in the database. |
Views | Returns information on all views in the database. |
These collection names are also available as read-only properties in the SAMetaDataCollectionNames class.
The results returned can be filtered by specifying an array of restrictions in the call to GetSchema.
The restrictions available with each collection can be queried by calling:
GetSchema( "Restrictions" ) |
If the collection requires four restrictions, then the restrictions parameter must be either NULL, or a string with four values.
To filter on a particular restriction, place the string to filter by in its place in the array and leave any unused places NULL. For example, the Tables collection has three restrictions: Owner, Table, and TableType.
To filter the Table collection by table_name:
GetSchema( "Tables", new string[ ] { NULL, "my_table", NULL } ) |
This returns information on all tables named my_table.
GetSchema( "Tables", new string[ ] { "DBA", "my_table", NULL } ) |
This returns information on all tables named my_table owned by the user DBA.
The following is a summary of the columns returned by each collection. If the number of rows returned in a collection can be reduced by specifying a restriction on a column, the restriction name for that column is shown in parenthesis. The order in which restrictions are specified is the order in which they are presented in the lists below.
Columns collection
table_schema (Owner)
table_name (Table)
column_name (Column)
ordinal_position
column_default
is_nullable
data_type
precision
scale
column_size
DataSourceInformation collection
CompositeIdentifierSeparatorPattern
DataSourceProductName
DataSourceProductVersion
DataSourceProductVersionNormalized
GroupByBehavior
IdentifierPattern
IdentifierCase
OrderByColumnsInSelect
ParameterMarkerFormat
ParameterMarkerPattern
ParameterNameMaxLength
ParameterNamePattern
QuotedIdentifierPattern
QuotedIdentifierCase
StatementSeparatorPattern
StringLiteralPattern
SupportedJoinOperators
DataTypes collection
TypeName
ProviderDbType
ColumnSize
CreateFormat
CreateParameters
DataType
IsAutoIncrementable
IsBestMatch
IsCaseSensitive
IsFixedLength
IsFixedPrecisionScale
IsLong
IsNullable
IsSearchable
IsSearchableWithLike
IsUnsigned
MaximumScale
MinimumScale
IsConcurrencyType
IsLiteralSupported
LiteralPrefix
LiteralSuffix
ForeignKeys collection
table_schema (Owner)
table_name (Table)
column_name (Column)
IndexColumns collection
table_schema (Owner)
table_name (Table)
index_name (Name)
column_name (Column)
order
Indexes collection
table_schema (Owner)
table_name (Table)
index_name (Name)
primary_key
is_unique
MetaDataCollections collection
CollectionName
NumberOfRestrictions
NumberOfIdentifierParts
ProcedureParameters collection
procedure_schema (Owner)
procedure_name (Name)
parameter_name (Parameter)
data_type
parameter_type
is_input
is_output
Procedures collection
procedure_schema (Owner)
procedure_name (Name)
ReservedWords collection
reserved_word
Restrictions collection
CollectionName
RestrictionName
RestrictionDefault
RestrictionNumber
Tables collection
table_schema (Owner)
table_name (Table)
table_type (TableType)
UserDefinedTypes collection
data_type
default
precision
scale
Users collection
user_name (UserName)
resource_auth
database_auth
schedule_auth
user_group
ViewColumns collection
view_schema (Owner)
view_name (Name)
column_name (Column)
Views collection
view_schema (Owner)
view_name (Name)
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |