ISqlWorkspace Interface

Query layer workspace interface

Description

This interface is used to create query classes and query cursors, and to retrieve information about SQL workspaces.

Members

Name Description
Method CheckDatasetName Returns unique name in the workspace.
Method GetColumns Returns column information for a table.
Method GetQueryDescription Get query properties including spatial based on the first record of the query.
Method GetTables Returns names of all the table.
Method OpenQueryClass Returns a table or a feature class based on a query.
Method OpenQueryCursor Returns a cursor based on a query.

ISqlWorkspace.CheckDatasetName Method

Returns unique name in the workspace.

Public Sub CheckDatasetName ( _
    ByVal Name As String, _
    ByVal QueryDescription As IQueryDescription, _
    ByRef newName As String _
)
public void CheckDatasetName (
    string Name,
    IQueryDescription QueryDescription,
    ref string newName
);

ISqlWorkspace.GetColumns Method

Returns column information for a table.

Public Sub GetColumns ( _
    ByVal TableName As String, _
    ByRef columnName As IStringArray, _
    ByRef columnType As IStringArray, _
    ByRef IsNullable As IVariantArray, _
    ByRef Size As ILongArray, _
    ByRef Precision As ILongArray, _
    ByRef Scale As ILongArray _
)
public void GetColumns (
    string TableName,
    ref IStringArray columnName,
    ref IStringArray columnType,
    ref IVariantArray IsNullable,
    ref ILongArray Size,
    ref ILongArray Precision,
    ref ILongArray Scale
);

ISqlWorkspace.GetQueryDescription Method

Get query properties including spatial based on the first record of the query.

Public Function GetQueryDescription ( _
    ByVal Query As String _
) As IQueryDescription
public IQueryDescription GetQueryDescription (
    string Query
);

Errors Returned

FDO_E_SE_TOO_MANY_LAYERS - The field set of the SQL query include multiple geometry columns.

ISqlWorkspace.GetTables Method

Returns names of all the table.

Public Function GetTables ( _
) As IStringArray
public IStringArray GetTables (
);

ISqlWorkspace.OpenQueryClass Method

Returns a table or a feature class based on a query.

Public Function OpenQueryClass ( _
    ByVal Name As String, _
    ByVal QueryDescription As IQueryDescription _
) As ITable
public ITable OpenQueryClass (
    string Name,
    IQueryDescription QueryDescription
);

Errors Returned

Neither of the following errors will occur immediately on the OpenQueryClass call, but can be raised when trying to use a query class incorrectly.

FDO_E_QUERYCLASS_OIDUNKNOWN - If a query class with mapped IDs is opened and a method attempts to fetch a row by its ID prior to IDs have been mapped, this error will be raised.

FDO_E_QUERYTABLE_OIDMAPPEDCOLUMNHASNULL - If a nullable column is used to map IDs and the query returns a null value, this error will occur when trying to retrieve the row.

Remarks

If ID mapping was defined in the query description passed into this method, the returned query class will include a virtual column containing unique IDs. Aside from cases where conflicts will occur, this column is named "ESRI_OID".

ISqlWorkspace.OpenQueryCursor Method

Returns a cursor based on a query.

Public Function OpenQueryCursor ( _
    ByVal Query As String _
) As ICursor
public ICursor OpenQueryCursor (
    string Query
);

Errors Returned

Neither of the following errors will occur immediately on the OpenQueryCursor call, but can be raised while retrieving rows if the query results in data ineligible for a query cursor.

FDO_E_SE_TOO_MANY_LAYERS - The cursor attemped to retrieve a row with multiple geometry columns.

FDO_E_SE_INCOMPATIBLE_COORDREFS - The cursor attempted to retrieve a row with a different spatial reference as previous rows.

Remarks

A query cursor generally behaves like a non-recycling search cursor that returns read-only rows.

Classes that implement ISqlWorkspace

Classes Description

Remarks

A SQL workspace is a relational database that may or may not be a geodatabase. After creating a workspace with the SqlWorkspaceFactory class (and the IWorkspaceFactory interface), this interface is used to retrieve data in a read-only manner as query classes and query cursors. Query classes can be used much like tables or feature classes from other data sources; through ArcMap, they are exposed as "Query Layers".

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.