File Geodatabase API
|
Provides methods to work with tables, such as querying and modifying both schema and data. More...
Public Member Functions | |
Schema | |
fgdbError | GetDefinition (std::string &tableDef) const |
Gets the table's definition as an XML document. More... | |
fgdbError | GetDocumentation (std::string &documentation) const |
Gets the table's metadata as XML. More... | |
fgdbError | SetDocumentation (const std::string &documentation) |
Assigns metadata to the table. More... | |
fgdbError | GetFieldInformation (FieldInfo &fieldInfo) const |
Return information about the fields in the table. More... | |
fgdbError | GetFields (std::vector< FieldDef > &fieldDefs) const |
Returns an array of FieldDef objects of the table's field collection. More... | |
fgdbError | AddField (const std::string &fieldDef) |
Adds a field to the table. More... | |
fgdbError | AddField (const FieldDef &fieldDef) |
Adds a field to the table. More... | |
fgdbError | AlterField (const std::string &fieldDef) |
Modifies a field in the table. More... | |
fgdbError | DeleteField (const std::wstring &fieldName) |
Deletes a field from the table. More... | |
fgdbError | GetIndexes (std::vector< std::string > &indexDefs) const |
Returns an XML definition of the table's index collection. More... | |
fgdbError | GetIndexes (std::vector< IndexDef > &indexDefs) const |
Returns an array of IndexDef objects of the table's index collection. More... | |
fgdbError | AddIndex (const std::string &indexDef) |
Adds an index to the table. More... | |
fgdbError | AddIndex (const IndexDef &indexDef) |
Adds an index to the table. More... | |
fgdbError | DeleteIndex (const std::wstring &indexName) |
Deletes an index from the table. More... | |
fgdbError | CreateSubtype (const std::string &subtypeDef) |
Creates a new subtype to the table. More... | |
fgdbError | AlterSubtype (const std::string &subtypeDef) |
Modifies an existing subtype of the table. More... | |
fgdbError | DeleteSubtype (const std::wstring &subtypeName) |
Deletes a subtype from the table. More... | |
fgdbError | EnableSubtypes (const std::wstring &subtypeFieldName, const std::string &subtypeDef) |
Enables subtypes on a table. More... | |
fgdbError | GetDefaultSubtypeCode (int &defaultCode) const |
Returns the default subtype code. More... | |
fgdbError | SetDefaultSubtypeCode (int defaultCode) |
Sets the default subtype code. More... | |
fgdbError | DisableSubtypes () |
Drops the table's subtypes. More... | |
Data | |
fgdbError | Search (const std::wstring &subfields, const std::wstring &whereClause, const Envelope &envelope, bool recycling, EnumRows &rows) |
Performs a spatial query (envelope intersects) on the table. More... | |
fgdbError | Search (const std::wstring &subfields, const std::wstring &whereClause, bool recycling, EnumRows &rows) |
Performs an attribute query on the table. More... | |
fgdbError | CreateRowObject (Row &row) |
Creates a new row in memory for the table. More... | |
fgdbError | Insert (Row &row) |
Inserts a newly-created and populated row into the table. More... | |
fgdbError | Update (Row &row) |
Updates an existing row in the table. More... | |
fgdbError | Delete (Row &row) |
Deletes a row from the table. More... | |
fgdbError | IsEditable (bool &isEditable) |
Indicates whether the table should be edited. More... | |
fgdbError | GetRowCount (int &rowCount) const |
Returns the number of rows in the table. More... | |
fgdbError | GetExtent (Envelope &extent) const |
Returns the extent of the feature class. More... | |
fgdbError | SetWriteLock (void) |
Sets a write lock on a table. More... | |
fgdbError | FreeWriteLock (void) |
Frees a write lock on a table. More... | |
fgdbError | LoadOnlyMode (bool loadOnlyMode) |
Begin or End load only mode. More... | |
Constructors and destructors | |
Table () | |
The class constructor. | |
~Table () | |
The class destructor. | |
Provides methods to work with tables, such as querying and modifying both schema and data.
fgdbError FileGDBAPI::Table::GetDefinition | ( | std::string & | tableDef | ) | const |
Gets the table's definition as an XML document.
[out] | tableDef | An XML document than defines the table's schema. |
fgdbError FileGDBAPI::Table::GetDocumentation | ( | std::string & | documentation | ) | const |
Gets the table's metadata as XML.
[out] | documentation | The table's metadata as XML. |
fgdbError FileGDBAPI::Table::SetDocumentation | ( | const std::string & | documentation | ) |
Assigns metadata to the table.
[in] | documentation | An XML document that will be the table's metadata. |
fgdbError FileGDBAPI::Table::GetFieldInformation | ( | FieldInfo & | fieldInfo | ) | const |
Return information about the fields in the table.
[out] | fieldInfo | The field information. |
fgdbError FileGDBAPI::Table::GetFields | ( | std::vector< FieldDef > & | fieldDefs | ) | const |
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
[in] | fieldDef | An XML document defining the field's properties. |
fgdbError FileGDBAPI::Table::AddField | ( | const FieldDef & | fieldDef | ) |
Adds a field to the table.
[in] | fieldDef | A FieldDef object defining the field's properties. |
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).
Alter allows a domain to be assigned to a field. No other field properties can be changed.
[in] | fieldDef | An XML document defining the field's properties. |
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.
[in] | fieldName | The name of the field to delete. |
fgdbError FileGDBAPI::Table::GetIndexes | ( | std::vector< std::string > & | indexDefs | ) | const |
Returns an XML definition of the table's index collection.
[out] | indexDefs | An XML document containing a collection of index definitions. |
fgdbError FileGDBAPI::Table::GetIndexes | ( | std::vector< IndexDef > & | indexDefs | ) | const |
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
[in] | indexDef | An XML document defining the index's properties. |
fgdbError FileGDBAPI::Table::AddIndex | ( | const IndexDef & | indexDef | ) |
Adds an index to the table.
[in] | indexDef | An IndexDef object defining the index's properties. |
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.
[in] | indexName | The name of the index to delete. |
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
[in] | subtypeDef | An XML document defining the subtype's properties. |
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).
[in] | subtypeDef | An XML document defining the subtype's properties. |
fgdbError FileGDBAPI::Table::DeleteSubtype | ( | const std::wstring & | subtypeName | ) |
Deletes a subtype from the table.
[in] | subtypeName | The name of the subtype to delete. |
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
[in] | subtypeFieldName | The field to use as the subtype field. |
[in] | subtypeDef | The field to use as the subtype Def. |
fgdbError FileGDBAPI::Table::GetDefaultSubtypeCode | ( | int & | defaultCode | ) | const |
Returns the default subtype code.
[out] | defaultCode | The table's default subtype code. |
fgdbError FileGDBAPI::Table::SetDefaultSubtypeCode | ( | int | defaultCode | ) |
Sets the default subtype code.
[out] | defaultCode | The code to assign as the default subtype code. |
fgdbError FileGDBAPI::Table::DisableSubtypes | ( | ) |
Drops the table's subtypes.
fgdbError FileGDBAPI::Table::Search | ( | const std::wstring & | subfields, |
const std::wstring & | whereClause, | ||
const Envelope & | envelope, | ||
bool | recycling, | ||
EnumRows & | rows | ||
) |
Performs a spatial query (envelope intersects) on the table.
[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] | envelope | The spatial extent of the query. |
[in] | recycling | Indicates whether row memory should be recycled. |
[out] | rows | The results of the query. |
fgdbError FileGDBAPI::Table::Search | ( | const std::wstring & | subfields, |
const std::wstring & | whereClause, | ||
bool | recycling, | ||
EnumRows & | rows | ||
) |
Performs an attribute query on the table.
[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] | recycling | Indicates whether row memory should be recycled. |
[out] | rows | The results of the query. |
fgdbError FileGDBAPI::Table::CreateRowObject | ( | Row & | row | ) |
Creates a new row in memory for the table.
[out] | row | The newly-created row. |
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.
[in] | row | The row to insert. |
fgdbError FileGDBAPI::Table::Update | ( | Row & | row | ) |
Updates an existing row in the table.
[in] | row | The row to update. |
fgdbError FileGDBAPI::Table::Delete | ( | Row & | row | ) |
Deletes a row from the table.
[in] | row | The row to delete. |
fgdbError FileGDBAPI::Table::IsEditable | ( | bool & | isEditable | ) |
Indicates whether the table should be edited.
[out] | isEditable | True if the table can safely be edited. |
fgdbError FileGDBAPI::Table::GetRowCount | ( | int & | rowCount | ) | const |
Returns the number of rows in the table.
[out] | rowCount | The number of rows in the table. |
fgdbError FileGDBAPI::Table::GetExtent | ( | Envelope & | extent | ) | const |
Returns the extent of the feature class.
If the table is not a feature class an error of 1 will be returned.
[out] | extent | The extent of the feature class. |
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.
[in] | loadOnlyMode | true to begin LoadOnlyMode, false to end. |