File Geodatabase API
FileGDBAPI::Table Class Reference

Provides methods to work with tables, such as querying and modifying both schema and data. More...

List of all members.

Public Member Functions

Schema
fgdbError GetDefinition (std::string &tableDef)
 Gets the table's definition as an XML document.
fgdbError GetDocumentation (std::string &documentation)
 Gets the table's metadata as XML.
fgdbError SetDocumentation (const std::string &documentation)
 Assigns metadata to the table.
fgdbError GetFieldInformation (FieldInfo &fieldInfo)
 Return information about the fields in the row.
fgdbError AddField (const std::string &fieldDef)
 Adds a field to the table.
fgdbError AlterField (const std::string &fieldDef)
 Modifies a field in the table.
fgdbError DeleteField (const std::wstring &fieldName)
 Deletes a field from the table.
fgdbError GetIndexes (std::vector< std::string > &indexDefs)
 Returns an XML definition of the table's index collection.
fgdbError AddIndex (const std::string &indexDef)
 Adds an index to the table.
fgdbError DeleteIndex (const std::wstring &indexName)
 Deletes an index from the table.
fgdbError CreateSubtype (const std::string &subtypeDef)
 Creates a new subtype to the table.
fgdbError AlterSubtype (const std::string &subtypeDef)
 Modifies an existing subtype of the table.
fgdbError DeleteSubtype (const std::wstring &subtypeName)
 Deletes a subtype from the table.
fgdbError EnableSubtypes (const std::wstring &subtypeFieldName, const std::string &subtypeDef)
 Enables subtypes on a table.
fgdbError GetDefaultSubtypeCode (int &defaultCode)
 Returns the default subtype code.
fgdbError SetDefaultSubtypeCode (int defaultCode)
 Sets the default subtype code.
fgdbError DisableSubtypes ()
 Drops the table's subtypes.
Data
fgdbError Search (const std::wstring &subfields, const std::wstring &whereClause, Envelope envelope, bool recycling, EnumRows &rows)
 Performs a spatial query (envelope intersects) on the table.
fgdbError Search (const std::wstring &subfields, const std::wstring &whereClause, bool recycling, EnumRows &rows)
 Performs an attribute query on the table.
fgdbError CreateRowObject (Row &row)
 Creates a new row in memory for the table.
fgdbError Insert (Row &row)
 Inserts a newly-created and populated row into the table.
fgdbError Update (Row &row)
 Updates an existing row in the table.
fgdbError Delete (Row &row)
 Deletes a row from the table.
fgdbError IsEditable (bool &isEditable)
 Indicates whether the table should be edited.
fgdbError GetRowCount (int &rowCount)
 Returns the number of rows in the table.
fgdbError GetExtent (Envelope &extent)
 Returns the extent of the feature class.
fgdbError SetWriteLock (void)
 Sets a write lock on a table.
fgdbError FreeWriteLock (void)
 Frees a write lock on a table.
fgdbError LoadOnlyMode (bool loadOnlyMode)
 Begin or End load only mode.
Constructors and destructors
 Table ()
 The class constructor.
 ~Table ()
 The class destructor.

Detailed Description

Provides methods to work with tables, such as querying and modifying both schema and data.


Member Function Documentation

fgdbError FileGDBAPI::Table::GetDefinition ( std::string &  tableDef)

Gets the table's definition as an XML document.

Parameters:
[out]tableDefAn XML document than defines the table's schema.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::GetDocumentation ( std::string &  documentation)

Gets the table's metadata as XML.

Parameters:
[out]documentationThe table's metadata as XML.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::SetDocumentation ( const std::string &  documentation)

Assigns metadata to the table.

Parameters:
[in]documentationAn XML document that will be the table's metadata.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::GetFieldInformation ( FieldInfo fieldInfo)

Return information about the fields in the row.

Parameters:
[out]fieldInfoThe field information.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::AddField ( const std::string &  fieldDef)

Adds a field to the table.

If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).
If you are adding an OBJECTID field and one already exists, a -2147219707 (The Fields collection contained multiple OID fields) error will be returned . Only one OBJECTID field is allowed.
If you are adding an GLOBALID field and one already exists, a -2147219703 (The Fields collection contained multiple Global ID fields) error will be returned . Only one GLOBALID field is allowed.
If you attempt to add a NOT NULLABLE field to a table already contains rows, a -2147219879 (The field is not nullable) will be returned.
If the field already exists, a -2147219884 (The Field already exists) will be returned.
FieldTypes XML

Parameters:
[in]fieldDefAn XML document defining the field's properties.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::AlterField ( const std::string &  fieldDef)

Modifies a field in the table.

If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).

Parameters:
[in]fieldDefAn XML document defining the field's properties.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::DeleteField ( const std::wstring &  fieldName)

Deletes a field from the table.

If the field does not exist, an -2147219885 (An expected Field was not found or could not be retrieved properly) error will be returned.

Parameters:
[in]fieldNameThe name of the field to delete.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::GetIndexes ( std::vector< std::string > &  indexDefs)

Returns an XML definition of the table's index collection.

Parameters:
[out]indexDefsAn XML document containing a collection of index definitions.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::AddIndex ( const std::string &  indexDef)

Adds an index to the table.

If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).
XML

Parameters:
[in]indexDefAn XML document defining the index's properties.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::DeleteIndex ( const std::wstring &  indexName)

Deletes an index from the table.

If the index is not found, an -2147219629 (The index was not found) error will be returned.

Parameters:
[in]indexNameThe name of the index to delete.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::CreateSubtype ( const std::string &  subtypeDef)

Creates a new subtype to the table.

If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).
XML

Parameters:
[in]subtypeDefAn XML document defining the subtype's properties.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::AlterSubtype ( const std::string &  subtypeDef)

Modifies an existing subtype of the table.

If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).

Parameters:
[in]subtypeDefAn XML document defining the subtype's properties.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::DeleteSubtype ( const std::wstring &  subtypeName)

Deletes a subtype from the table.

Parameters:
[in]subtypeNameThe name of the subtype to delete.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::EnableSubtypes ( const std::wstring &  subtypeFieldName,
const std::string &  subtypeDef 
)

Enables subtypes on a table.

If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).
FieldTypes XML

Parameters:
[in]subtypeFieldNameThe field to use as the subtype field.
[in]subtypeDefThe field to use as the subtype Def.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::GetDefaultSubtypeCode ( int &  defaultCode)

Returns the default subtype code.

Parameters:
[out]defaultCodeThe table's default subtype code.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::SetDefaultSubtypeCode ( int  defaultCode)

Sets the default subtype code.

Parameters:
[out]defaultCodeThe code to assign as the default subtype code.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::DisableSubtypes ( )

Drops the table's subtypes.

Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::Search ( const std::wstring &  subfields,
const std::wstring &  whereClause,
Envelope  envelope,
bool  recycling,
EnumRows rows 
)

Performs a spatial query (envelope intersects) on the table.

Parameters:
[in]subfields(Optional) The fields that should be fetched by the query's returned rows. Must include a comma delimited list of fields or a "*". Passing in blank will return a -2147220985 (An invalid SQL statement was used) error.
[in]whereClause(Optional) Attribute constraints to apply to the query.
[in]envelopeThe spatial extent of the query.
[in]recyclingIndicates whether row memory should be recycled.
[out]rowsThe results of the query.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::Search ( const std::wstring &  subfields,
const std::wstring &  whereClause,
bool  recycling,
EnumRows rows 
)

Performs an attribute query on the table.

Parameters:
[in]subfields(Optional) The fields that should be fetched by the query's returned rows. Must include a comma delimited list of fields or a "*". A blank will return a -2147220985 (An invalid SQL statement was used) error.
[in]whereClause(Optional) Attribute constraints to apply to the query.
[in]recyclingIndicates whether row memory should be recycled.
[out]rowsThe results of the query.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::CreateRowObject ( Row row)

Creates a new row in memory for the table.

Parameters:
[out]rowThe newly-created row.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::Insert ( Row row)

Inserts a newly-created and populated row into the table. When bulk inserting rows use LoadOnlyMode and SetWriteLock\FreeWriteLock to improve performance.

Parameters:
[in]rowThe row to insert.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::Update ( Row row)

Updates an existing row in the table.

Parameters:
[in]rowThe row to update.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::Delete ( Row row)

Deletes a row from the table.

Parameters:
[in]rowThe row to delete.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::IsEditable ( bool &  isEditable)

Indicates whether the table should be edited.

Parameters:
[out]isEditableTrue if the table can safely be edited.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::GetRowCount ( int &  rowCount)

Returns the number of rows in the table.

Parameters:
[out]rowCountThe number of rows in the table.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::GetExtent ( Envelope extent)

Returns the extent of the feature class.

If the table is not a feature class an error of 1 will be returned.

Parameters:
[out]extentThe extent of the feature class.
Returns:
Error code indicating whether the method finished successfully.
fgdbError FileGDBAPI::Table::SetWriteLock ( void  )

Sets a write lock on a table.

This should be used when performing bulk updates and inserts. Otherwise a lock will be created for each update or insert. Should be followed by a call to FreeWriteLock.

fgdbError FileGDBAPI::Table::FreeWriteLock ( void  )

Frees a write lock on a table.

This should be used when performing bulk updates and inserts. Otherwise a lock will be created for each update or insert. Should be preceded by a call to SetWriteLock.

fgdbError FileGDBAPI::Table::LoadOnlyMode ( bool  loadOnlyMode)

Begin or End load only mode.

Parameters:
[in]loadOnlyModetrue to begin LoadOnlyMode, false to end.