この 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 データプロバイダに問い合わせをして、サポートされているスキーマコレクションのリストを判断できます。これによって、サポートされているスキーマコレクション (CollectionName)、それぞれがサポートする制限の数 (NumberOfRestrictions)、使用する識別子部分の数のリストから成る DataTable が返されます。
コレクション | メタデータ |
---|---|
Columns | データベース内のすべてのカラムに関する情報を返します。 |
DataSourceInformation | データベースサーバに関する情報を返します。 |
DataType | サポートされているデータ型のリストを返します。 |
ForeignKeys | データベース内のすべての外部キーに関する情報を返します。 |
IndexColumns | データベース内のすべてのインデックスカラムに関する情報を返します。 |
Indexes | データベース内のすべてのインデックスに関する情報を返します。 |
MetaDataCollections | すべてのコレクション名のリストを返します。 |
ProcedureParameters | データベース内のすべてのプロシージャパラメータに関する情報を返します。 |
Procedures | データベース内のすべてのプロシージャに関する情報を返します。 |
ReservedWords | SQL Anywhere が使用する予約語のリストを返します。 |
Restrictions | GetSchema で使用される制限に関する情報を返します。 |
Tables | データベース内のすべてのテーブルに関する情報を返します。 |
UserDefinedTypes | データベース内のすべてのユーザ定義データ型に関する情報を返します。 |
Users | データベース内のすべてのユーザに関する情報を返します。 |
ViewColumns | データベース内のすべてのビュー内のカラムに関する情報を返します。 |
Views | データベース内のすべてのビューに関する情報を返します。 |
これらのコレクション名は、SAMetaDataCollectionNames クラスの読み込み専用プロパティとしても使用できます。
返される結果は、GetSchema への呼び出しの中で制限の配列を指定することによってフィルタできます。
各コレクションで有効な制限は、次の文を呼び出すことで問い合わせることができます。
GetSchema( "Restrictions" ) |
コレクションが 4 つの制限を必要とする場合、制限パラメータは、NULL、または 4 つの値から成る文字列です。
特定の制限をフィルタするには、フィルタする文字列を配列内の所定の位置に指定し、使用しない位置には NULL を指定します。たとえば、Tables コレクションには 3 つの制限があります。Owner、Table、TableType です。
Table コレクションを table_name でフィルタするには、次の手順に従います。
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 で意見交換できます
|
Copyright © 2013, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |