Interface IRow
- Namespace
- ESRI.ArcGIS.Geodatabase
- Assembly
- ESRI.Server.Geodatabase.dll
Provides access to members that return information about the row, the table the row belongs to and storing and deleting the row.
[Guid("FCB01CB4-9F0B-11D0-BEC7-00805F7C4268")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IRow : IRowBuffer
Remarks
The IRow interface inherits from the IRowBuffer interface and includes properties and methods to get and set the row's values, detect whether the row has an Object ID (and retrieve it, if it does has one), get the row's table, delete the row, and persist any changes made to the row.
The OID property returns the unique object identifier for the Row that distinguishes it from other rows in the table. If the HasOID property returns false, then this row was returned from a table lacking a geodatabase-managed Object ID field. This generally occurs when the table is not registered with the geodatabase; see the IClassSchemaEdit::RegisterAsObjectClass method for more information.
The Store method is called by an application once it has modified the values of a Row. Calling the Store method triggers the following actions.
- The IRowEvents::OnChanged method is called for the Row being stored (the OnNew method is called if this is a newly created row being stored for the first time). A custom row object can implement the RowEvents::OnChanged method and take some special action when it is called—for example, update a special column in the row.
- The IRelatedObjectEvents::RelatedObjectChanged method is called for related objects in related object class if the table for this row is an object class that participates in relationship classes with notification.
Once Store is called on a Row object, all subsequent queries against the table within the same edit session using the geodatabase API will reflect the modified state of the row object.
The Delete method is called by an application to delete a row object from the database. Calling the Delete method triggers the following actions.
- The IRowEvents::OnDelete method is called for the Row being deleted. A custom row object can implement the IRowEvents::OnDelete method and take some special action when it is called.
- All relationships in which the row object participates are automatically deleted.
Once Delete is called on a Row object, all subsequent queries against the Table within the same edit session using the geodatabase API will reflect the deleted state of the row object.
The changes made to a row object using the Store and Delete methods will be committed to persistent store if the containing edit session is saved and no conflicts are detected. If the changes were made outside of an edit session, then the application program is responsible for directly managing underlying database transactions using the ITransactions interface on the Workspace.
This example shows the creation of a row, then an update, followed by it being deleted.
//e.g., nameOfField = "FruitName";
public void IRow__(ITable table, string
nameOfField)
{
int fieldIndex =
table.FindField(nameOfField);
//insert row
IRow row =
table.CreateRow();
//initalize all of the
default field values for the new row.
IRowSubtypes rowSubTypes
= (IRowSubtypes)row;
rowSubTypes.InitDefaultValues();
row.set_Value(fieldIndex, "Banana");
row.Store();
//update row
row.set_Value(fieldIndex, "Ripe Banana");
row.Store();
//delete row
row.Delete();
}
Properties
Fields
IFields Fields { get; }
Property Value
HasOID
Indicates if the row has an OID.
bool HasOID { get; }
Property Value
Remarks
If the table has been registered with the geodatabase it will have unique Object ID, automatically created by the register tool, and the HasOID property will be set to True. Tables not registered with the geodatabase will not have an OID column and the HasOID property will be set to False. See the IClassSchemaEdit::RegisterAsObjectClass method for more information.
OID
The OID for the row.
long OID { get; }
Property Value
Table
The Table for the row.
ITable Table { get; }
Property Value
Remarks
<P>A <STRONG>Table </STRONG>object has one or more columns, referred to as fields, and contains an unordered collection of rows. Each row has for each field exactly one value in the data type of the field.</P> <P>A <STRONG>Table </STRONG>is a <STRONG>Dataset </STRONG>and properties such as the name of the table, the persistable name object for the table, and the workspace containing the table, may be obtained via the <STRONG>IDataset </STRONG>interface. In relational terms, a <STRONG>Table </STRONG>object represents an RDBMS table or view. In objected-oriented terms, a Table object represents an ObjectClass or a RelationshipClass in a geodatabase. A <STRONG>Table </STRONG>object hands out <STRONG>Row </STRONG>objects which themselves support application callable methods depending on the type of data stored in the table.</P> <P>The <STRONG>Name </STRONG>property of a <STRONG>Table</STRONG>, accessible via the <STRONG>IDataset </STRONG>interface, returns its fully qualified name. The level of qualification may vary depending on the host DBMS. For example, a table named ‘pipes’, owned by a user named ‘gas’ may be called ‘pipes’ in and Access or File Geodatabase, ‘gas.pipes’ on Oracle and ‘mydb.gas.pipes’ on SQLServer. The <STRONG>ParseTableNamemethod </STRONG>on the <STRONG>ISqlSyntax </STRONG>interface supported by the table’s workspace can be used to split the fully qualified name into its components.</P>
Value[int]
object Value[int Index] { get; set; }
Parameters
Indexint
Property Value
Methods
Delete()
Deletes the row.
void Delete()
Remarks
All edits to features that participate in a Topology or Geometric Network must be performed within an edit session and bracketed within an edit operation.
Store()
Stores the row.
void Store()
Remarks
The Store method is called by an application once it has modified the values of a Row. Once Store is called on a Row object, all subsequent queries within the same edit session, using the Geodatabase API, will reflect the modified state of the Row object.
All edits to features that participate in a Topology or Geometric Network must be performed within an edit session and bracketed within an edit operation.
Calling the Store method triggers the following actions:
- The IRowEvents::OnChanged is called for the row being stored. The OnNew is called if this is a newly created row being stored for the first time. A custom row object can implement the OnChanged method and take some special action when it is called - for example; update a special column in the row
- The IRelatedObjectEvents::RelatedObjectChanged method is called for related objects in a related object class if the table for this row is an object class that participates in relationship classes with notification
Store should not be used for batch operations, such as updates or inserts. For performing a number of inserts or updates using cursors, refer to the ITable::Insert, ITable::Update, ITable::UpdateSearchedRows , IFeatureClass::Update andIFeatureClass::Insert. If an insert or update cursor is used on non-simple features (such as network features), the cursor will revert to using Store.
It is not necessary to explicitly call Connect on network features, this is handled polymorphically when Store is called on the feature. This is also the case with features in a Topology, Dirty Area creation is handled internally when Store is called.
Store should not be called inside of edit events, such as OnCreateFeature, OnChangeFeature or OnDeleteFeature. Even if you are modifying the geometry or other field values, Store will be called once the event is complete.