Provides access to members that return information about and manage tables.
Members
Name | Description | |
---|---|---|
AddField | Adds a field to this object class. | |
AddIndex | Adds an index to this object class. | |
CLSID | The GUID for the COM Class (CoClass) corresponding to instances of this object class. | |
CreateRow | Creates a row in the database with a system assigned object ID and null property values. | |
CreateRowBuffer | Creates a row buffer that can be used with an insert cursor. | |
DeleteField | Deletes a field from this object class. | |
DeleteIndex | Deletes an index from this object class. | |
DeleteSearchedRows | Delete the Rows in the database selected by the specified query. | |
EXTCLSID | The GUID for the COM Class (CoClass) corresponding to the class extension for this object class. | |
Extension | The extension for this object class. | |
ExtensionProperties | The extension properties for this object class. | |
Fields | The fields collection for this object class. | |
FindField | The index of the field with the specified name. | |
GetRow | The row from the database with the specified object ID. | |
GetRows | The cursor of rows based on a set of object ids. | |
HasOID | Indicates if the class has an object identity (OID) field. | |
Indexes | The indexes collection for this object class. | |
Insert | Returns a cursor that can be used to insert new Rows. | |
OIDFieldName | The name of the field corresponding to the OID. | |
RowCount | The number of Rows selected by the specified query. | |
Search | An object cursor that can be used to fetch row objects selected by the specified query. | |
Select | A selection that contains the object ids selected by the specified query. | |
Update | Returns a cursor that can be used to update Rows selected by the specified query. | |
UpdateSearchedRows | Update the Rows in the database selected by the specified query. |
ITable.CreateRow Method
Creates a row in the database with a system assigned object ID and null property values.
Public Function CreateRow ( _
) As IRow
public IRow CreateRow (
);
Remarks
The CreateRowmethod creates a new row in the underlying database with a system assigned object id value. A row object representing the created row is returned to the caller. The row object returned has the system assigned object ID as the value of the OIDField. All other fields are initialized to null values if they can be made null and to built-in default values appropriate to the type of the field if they cannot be made null.
The caller is responsible for setting the desired field values into the row and calling the Storemethod on the row. If the table represents an object class with subtypes, then it is the caller�s responsibility to set the default subtype code into the row and call the InitDefaultValuesmethod on the row before storing, if that is the desired result. For tables without object behavior, insert cursors offer a more efficient way for inserting new rows.
ITable.CreateRowBuffer Method
Creates a row buffer that can be used with an insert cursor.
Public Function CreateRowBuffer ( _
) As IRowBuffer
public IRowBuffer CreateRowBuffer (
);
Remarks
The CreateRowBuffermethod creates a new row buffer object in memory and returns it to the caller. No row is created in the database. The returned row buffer does not have an object ID value. The caller can set values into the row buffer and use it as an argument to the InsertRowmethod on an insert cursor; the latter is obtained by calling the Insertmethod on the Table.
ITable.DeleteSearchedRows Method
Delete the Rows in the database selected by the specified query.
Public Sub DeleteSearchedRows ( _
ByVal QueryFilter As IQueryFilter _
)
public void DeleteSearchedRows (
IQueryFilter QueryFilter
);
ITable.GetRow Method
The row from the database with the specified object ID.
Public Function GetRow ( _
ByVal OID As Long _
) As IRow
public IRow GetRow (
long OID
);
Remarks
The GetRowmethod returns an existing row object, given its object ID value. The caller can query the returned row object for additional object specific interfaces. The retrieved row may be modified; calling Store on the row object after changing it will trigger messages to related objects and will mark the row for committing to the database.
ITable.GetRows Method
The cursor of rows based on a set of object ids.
Public Function GetRows ( _
ByVal oids As Object, _
ByVal Recycling As Boolean _
) As ICursor
public ICursor GetRows (
object oids,
bool Recycling
);
Remarks
The GetRows method returns a cursor that may be used to retrieve a set of rows specified by the input array of object id values. See the description of the Search method to understand the meaning of the recycling parameter. It is far more efficient to retrieve a set of rows using the GetRows method than it is to retrieve each individual row using the GetRow method. The retrieved rows may be modified; Store should be called on the row objects after changing them.
The oids parameter should be passed an integer array. For example:
// Get a recycling cursor for the OID array.
int[] oidArray = new int[] { 10844, 10853, 10871 };
ICursor cursor = table.GetRows(oidArray, true);
ITable.Insert Method
Returns a cursor that can be used to insert new Rows.
Public Function Insert ( _
ByVal useBuffering As Boolean _
) As ICursor
public ICursor Insert (
bool useBuffering
);
Remarks
The Insertmethod returns an insert cursor that can be used to bulk insert rows. It offers significantly faster performance than multiple calls to CreateRowand Storefor tables storing simple rows and simple features (that is, for tables whose CLSID is esriGeoDatabase.Row, esriGeoDatabase.Object, or esriGeoDatabase.Feature).
Insert cursors on tables containing complex objects use the CreateRowand Storemethods to achieve polymorphism, and there is no difference in performance in these cases.
When using cursors within an edit session, they should always be scoped to edit operations. In other words, a cursor should be created after an edit operation has begun and should not be used once that edit operation has been stopped or aborted.
ITable.RowCount Method
The number of Rows selected by the specified query.
Public Function RowCount ( _
ByVal QueryFilter As IQueryFilter _
) As Long
public long RowCount (
IQueryFilter QueryFilter
);
ITable.Search Method
An object cursor that can be used to fetch row objects selected by the specified query.
Public Function Search ( _
ByVal QueryFilter As IQueryFilter, _
ByVal Recycling As Boolean _
) As ICursor
public ICursor Search (
IQueryFilter QueryFilter,
bool Recycling
);
Remarks
The Searchmethod returns a search cursor that can be used to retrieve rows specified by a query filter. The recycling parameter controls row object allocation behavior. Recycling cursors rehydrate a single row object on each fetch and can be used to optimize read-only access, for example, when drawing. It is illegal to maintain a reference on a row object returned by a recycling cursor across multiple calls to NextRowon the cursor.
Row objects returned by a recycling cursor should not be modified. Non-recycling cursors return a separate row object on each fetch. The objects returned by a non-recycling cursor may be modified and stored with polymorphic behavior. The geodatabase guarantees �unique instance semantics� on non-recycling row objects fetched during an edit session. If the row object to be retrieved by a call to search has already been instantiated and is being referenced by the calling application, then a reference to the existing row object is returned.
Non-recycling feature cursors returned from the Search method *MUST* be used when copying features from the cursor into an insert cursor of another class. This is because a recycling cursor reuses the same geometry and under some circumstances all of the features inserted into the insert cursor may have the same geometry. Using a non-recycling cursor ensures that each geometry is unique.
When using cursors within an edit session, they should always be scoped to edit operations. In other words, a cursor should be created after an edit operation has begun and should not be used once that edit operation has been stopped or aborted.
ITable.Select Method
A selection that contains the object ids selected by the specified query.
Public Function Select ( _
ByVal QueryFilter As IQueryFilter, _
ByVal selType As esriSelectionType, _
ByVal selOption As esriSelectionOption, _
ByVal selectionContainer As IWorkspace _
) As ISelectionSet
public ISelectionSet Select (
IQueryFilter QueryFilter,
esriSelectionType selType,
esriSelectionOption selOption,
IWorkspace selectionContainer
);
Remarks
The Selectmethod returns a selection set that holds either row IDs or row objects from the Table depending on the selection option. Multiple selection sets can be created on the same table. It is up to a client application or object to keep a reference on created selections and use them as appropriate. For example, a FeatureLayercreates and uses selections on a FeatureClass(a type of Table).
The _selType_parameter determines the type of selection set that will be created: an ID set, a snapshot, or a hybrid. See the ISelectionSetinterface for a comparison of the three types.
When calling Select the selectionContainer parameter is no longer required. A null value should be passed as this parameter.
ITable.Update Method
Returns a cursor that can be used to update Rows selected by the specified query.
Public Function Update ( _
ByVal QueryFilter As IQueryFilter, _
ByVal Recycling As Boolean _
) As ICursor
public ICursor Update (
IQueryFilter QueryFilter,
bool Recycling
);
Remarks
The Updatemethod returns an update cursor that can be used to update or delete rows. It offers somewhat faster performance than multiple calls to Storeor Deleteon row objects fetched using a non-recycling search cursor for tables storing simple rows and simple features. There is no difference in performance for complex objects and features.
When using cursors within an edit session, they should always be scoped to edit operations. In other words, a cursor should be created after an edit operation has begun and should not be used once that edit operation has been stopped or aborted.
ITable.UpdateSearchedRows Method
Update the Rows in the database selected by the specified query.
Public Sub UpdateSearchedRows ( _
ByVal QueryFilter As IQueryFilter, _
ByVal buffer As IRowBuffer _
)
public void UpdateSearchedRows (
IQueryFilter QueryFilter,
IRowBuffer buffer
);
Description
This method will edit the rows matching the query filter's constraints. The values in each row will be replaced with the corresponding field's value in the provided row buffer. The fields being edited should be specified in the query filter's SubFields property. If the row buffer contains null values, and the SubFields property is not properly set, the row's values will be overwritten with the row buffer's null values.
// Updates the value of a table's TERM field to city, if its 1996 population is
// greater than or equal to 10,000.
public void UpdateTerm(ITable table)
{
// Build the query filter.
IQueryFilter queryFilter = new QueryFilterClass();
queryFilter.WhereClause = "Pop1996 >= 10000";
queryFilter.SubFields = "TERM";
// Find the position of the TERM field in the table.
int termPosition = table.FindField("TERM");
// Build the row buffer to store the new value(s).
IRowBuffer rowBuffer = table.CreateRowBuffer();
rowBuffer.set_Value(termPosition, "City");
// Update the matching rows.
table.UpdateSearchedRows(queryFilter, rowBuffer);
}
Inherited Interfaces
Interfaces | Description |
---|---|
IClass | Provides access to members that return information about and manage the class. |
Classes that implement ITable
Classes | Description |
---|---|
AttributedRelationshipClass | Esri Attributed Relationship Class object. |
FeatureClass | Esri Feature Class object. |
ObjectClass | Esri Object Class object. |
RasterBand (esriDataSourcesRaster) | A representation of a single band of a raster dataset on disk. |
RasterCatalog | A collection of raster datasets in a Geodatabase table. |
RelQueryTable | An object that joins two datasets based on common data values. |
Table | Esri Table object. |
XYEventSource | XY event source object. |
Remarks
The ITableinterface is the principal interface for working with tables. It inherits from IClassand provides additional methods that allow you to query, select, insert, update and delete rows from the table.
All modifications to rows in the table through this interface will preserve object behavior associated with the table. For example, using DeleteSearchedRows on a table that is the origin of a composite relationship will delete rows from the related object class.