GetSchema(String, String[]) method

Returns schema information for the data source of this ULConnection and, if specified, uses the specified string for the schema name and the specified string array for the restriction values.

Syntax
Visual Basic

Public Overrides Function GetSchema( _
   ByVal collection As String, _
   ByVal restrictions As String() _
) As DataTable
C#

public override DataTable GetSchema(
   string  collection,
   string [] restrictions
);
Parameters
  • collection   Name of the metadata collection. If none provided, MetaDataCollections is used.

  • restrictions   A set of restriction values for the requested schema.

Return value

A DataTable that contains schema information.

Remarks

This method is used to query the database 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 .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 about all columns in the database.
DataSourceInformation Returns information about the database provider.
DataTypes Returns a list of supported data types.
ForeignKeys Returns information about all foreign keys in the database.
IndexColumns Returns information about all index columns in the database.
Indexes Returns information about all indexes in the database.
MetaDataCollections Returns a list of all collection names.
Publications Returns information about all publications in the database.
ReservedWords Returns a list of reserved words used by UltraLite.
Restrictions Returns information about restrictions used in GetSchema.
Tables Returns information about all tables in the database.

These collection names are also available as read-only properties in the ULMetaDataCollectionNames 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: Table, TableType, SyncType.

To filter the Table collection:

GetSchema( "Tables", new string[ ] { "my_table", NULL, NULL } ) Returns information about all tables named my_table.

GetSchema( "Tables", new string[ ] { NULL, "User", NULL } ) Returns information about all user tables.

See also