返回此 SAConnection 对象的数据源模式信息,并且如果已指定,则使用指定的模式名称字符串和指定的限制值字符串数组。
Public Overrides Function GetSchema(
ByVal collection As String,
ByVal restrictions As String()
) As DataTable
public override DataTable GetSchema(
string collection,
string[] restrictions
)
包含模式信息的 DataTable。
这些方法用于查询数据库服务器以获取各种元数据。每种类型的元数据均被赋予了一个集合名称,必须传递该名称方可接收该数据。缺省集合名称为 MetaDataCollections。
通过不使用任何参数或使用模式集合名称 MetaDataCollections 调用 GetSchema 方法,可以查询 SQL Anywhere .NET 数据提供程序以确定所支持的模式集合列表。这会返回一个 DataTable,其中含有所支持模式集合的列表 (CollectionName)、每个集合所支持的限制数 (NumberOfRestrictions),以及它们所使用的标识符部分的个数 (NumberOfIdentifierParts)。
集合 | 元数据 |
---|---|
Columns | 返回有关数据库中所有列的信息。 |
DataSourceInformation | 返回有关数据库服务器的信息。 |
DataTypes | 返回所支持数据类型的列表。 |
ForeignKeys | 返回有关数据库中所有外键的信息。 |
IndexColumns | 返回有关数据库中所有索引列的信息。 |
Indexes | 返回有关数据库中所有索引的信息。 |
MetaDataCollections | 返回所有集合名称的列表。 |
ProcedureParameters | 返回有关数据库中所有过程参数的信息。 |
Procedures | 返回有关数据库中所有过程的信息。 |
ReservedWords | 返回 SQL Anywhere 所用保留字的列表。 |
Restrictions | 返回有关 GetSchema 中所用限制的信息。 |
Tables | 返回有关数据库中所有表的信息。 |
UserDefinedTypes | 返回有关数据库中所有用户定义数据类型的信息。 |
Users | 返回有关数据库中所有用户的信息。 |
ViewColumns | 返回有关数据库中视图内部所有列的信息。 |
Views | 返回有关数据库中所有视图的信息。 |
这些集合名称也可作为只读属性在 SAMetaDataCollectionNames 类中使用。
可通过在调用 GetSchema 时指定限制数组来过滤返回的结果。
通过以下调用可以查询每个集合可用的限制:
GetSchema( "Restrictions" ) |
如果集合需要四个限制,则限制参数必须为 NULL 或具有四个值的字符串。
要根据特定限制进行过滤,请将用以过滤的字符串置于其在数组中的适当位置,并将任何未使用的位置均保留为 NULL。例如,Tables 集合具有三个限制:Owner、Table 和 TableType。
按 table_name 过滤 Table 集合:
GetSchema( "Tables", new string[ ] { NULL, "my_table", NULL } ) |
这将返回有关名为 my_table 的所有表的信息。
GetSchema( "Tables", new string[ ] { "DBA", "my_table", NULL } ) |
这将返回有关用户 DBA 所拥有的名为 my_table 的所有表的信息。
下面是各个集合所返回的列的汇总。如果可通过指定对某个列的限制来减少集合中所返回的行数,则该列的限制名称会显示在括号中。限制的指定顺序便是它们在下表中的显示顺序。
Columns 集合
table_schema (Owner)
table_name (Table)
column_name (Column)
ordinal_position
column_default
is_nullable
data_type
precision
scale
column_size
DataSourceInformation 集合
CompositeIdentifierSeparatorPattern
DataSourceProductName
DataSourceProductVersion
DataSourceProductVersionNormalized
GroupByBehavior
IdentifierPattern
IdentifierCase
OrderByColumnsInSelect
ParameterMarkerFormat
ParameterMarkerPattern
ParameterNameMaxLength
ParameterNamePattern
QuotedIdentifierPattern
QuotedIdentifierCase
StatementSeparatorPattern
StringLiteralPattern
SupportedJoinOperators
DataTypes 集合
TypeName
ProviderDbType
ColumnSize
CreateFormat
CreateParameters
DataType
IsAutoIncrementable
IsBestMatch
IsCaseSensitive
IsFixedLength
IsFixedPrecisionScale
IsLong
IsNullable
IsSearchable
IsSearchableWithLike
IsUnsigned
MaximumScale
MinimumScale
IsConcurrencyType
IsLiteralSupported
LiteralPrefix
LiteralSuffix
ForeignKeys 集合
table_schema (Owner)
table_name (Table)
column_name (Column)
IndexColumns 集合
table_schema (Owner)
table_name (Table)
index_name (Name)
column_name (Column)
order
Indexes 集合
table_schema (Owner)
table_name (Table)
index_name (Name)
primary_key
is_unique
MetaDataCollections 集合
CollectionName
NumberOfRestrictions
NumberOfIdentifierParts
ProcedureParameters 集合
procedure_schema (Owner)
procedure_name (Name)
parameter_name (Parameter)
data_type
parameter_type
is_input
is_output
Procedures 集合
procedure_schema (Owner)
procedure_name (Name)
ReservedWords 集合
reserved_word
Restrictions 集合
CollectionName
RestrictionName
RestrictionDefault
RestrictionNumber
Tables 集合
table_schema (Owner)
table_name (Table)
table_type (TableType) "BASE"、"VIEW"、"MAT VIEW"、"LCL TEMP"、"GBL TEMP"、TEXT" 或 "TEXT GBL TEMP"
UserDefinedTypes 集合
data_type
default
precision
scale
Users 集合
user_name (UserName)
resource_auth
database_auth
schedule_auth
user_group
ViewColumns 集合
view_schema (Owner)
view_name (Name)
column_name (Column)
Views 集合
view_schema (Owner)
view_name (Name)
![]() |
使用DocCommentXchange讨论此页。
|
版权 © 2013, SAP 股份公司或其关联公司. - SAP Sybase SQL Anywhere 16.0 |