Writes features to an Oracle Spatial layer, using the object model. More...
#include <ilviews/maps/format/oracle/objectmodel/8iwrite.h>
Public Member Functions | |
IlvObjectSDOWriter (IldDbms *dbms, const char *tableName, const char *geometryColumnName="GEOMETRY", const char *xDimensionName="X", const char *yDimensionName="Y", IlBoolean createTables=IlFalse, const IlvFeatureAttributeInfo *info=0, IlvCoordinate *upperLeftCorner=0, IlvCoordinate *lowerRightCorner=0) | |
Constructs a writer to write data to an Oracle Spatial layer. More... | |
virtual IlvMapsError | close (IlDouble tolerance=0.0, const IlvCoordinate *upperLeft=0, const IlvCoordinate *lowerRight=0) |
Closes this writer. More... | |
IldDbms * | getDbms () const |
Returns the current database connection of the writer. More... | |
virtual IlvMapsError | getInitStatus () const |
Returns the error code that may have happened during the iterator initialization. More... | |
const char * | getLayerName () const |
Returns the current layer name of the writer. More... | |
IlBoolean | isCheckingStringAttributes () const |
Returns whether the writer is checking string attributes or not. More... | |
IlBoolean | isUsingOrderedRings () |
Indicates whether the order of the IlvMapRings used in IlvMapPolygons is known or not. More... | |
virtual IlvMapsError | populateIndexes (IlShort fixedTilingLevel, IlShort sdoNumtiles, const char *indexName, const char *sdoLayerName, const char *sdoGeometryColumnName="GEOMETRY", IlShort sdoMaxlevel=32, IlInt sdoCommitInterval=-1, const char *layerGtype=0, const char *sdoTableSpace=0, const char *sdoInitialExtent=0, const char *sdoNextExtent=0, IlInt sdoMinExtents=-1, IlInt sdoMaxExtents=-1, IlInt sdoPCTincrease=-1, const char *btreeInitialExtent=0, const char *btreeNextExtent=0, IlInt btreePCTincrease=-1) |
Creates the spatial index table. More... | |
void | setCheckingStringAttributes (IlBoolean check) |
Enables/disables the checking of String attributes. More... | |
void | setUsingOrderedRings (IlBoolean set) |
Sets whether the order of the IlvMapRings used in IlvMapPolygons is known or not. More... | |
virtual IlvMapsError | updateFeatureAttribute (const char *keyColumnName, const IlvFeatureAttribute *keyAttribute, const char *attributeColumnName, const IlvFeatureAttribute *attributeToUpdate) |
Updates a row in the SDO layer with one attribute. More... | |
virtual IlvMapsError | updateFeatureAttributes (const IlvFeatureAttributeProperty *attributes, IlUInt keyPos) |
Updates a row in the SDO layer with new attributes. More... | |
virtual IlvMapsError | writeFeature (const IlvMapFeature *feature, IlBoolean saveAtt=IlFalse) |
Puts the map feature passed as argument in the SDO layer without commiting the IldDbms . More... | |
virtual IlvMapsError | writeFeatureIterator (IlvMapFeatureIterator *reader, IlInt &count, IlBoolean saveAtt=IlFalse) |
Writes the iterator passed as its argument into the Oracle SDO database. More... | |
Writes features to an Oracle Spatial layer, using the object model.
Library: ilvdbmaps
IlvObjectSDOWriter::IlvObjectSDOWriter | ( | IldDbms * | dbms, |
const char * | tableName, | ||
const char * | geometryColumnName = "GEOMETRY" , |
||
const char * | xDimensionName = "X" , |
||
const char * | yDimensionName = "Y" , |
||
IlBoolean | createTables = IlFalse , |
||
const IlvFeatureAttributeInfo * | info = 0 , |
||
IlvCoordinate * | upperLeftCorner = 0 , |
||
IlvCoordinate * | lowerRightCorner = 0 |
||
) |
Constructs a writer to write data to an Oracle Spatial layer.
dbms | The IldDbms containing the connection to Oracle. The writer turns off the dbms' auto commit mode. |
tableName | The name of the SDO layer table. It can be made of the owner name and the table name ("OwnerName.TableName"). |
geometryColumnName | The name of the column containing the geometries objects. |
xDimensionName | The name of the X dimension. |
yDimensionName | The name of the Y dimension. |
createTables | If set to IlTrue , the writer will create the necessary table and entries (note that you can do this only under certain Oracle privileges). |
info | An IlvFeatureAttributeInfo that you can provide in order to create also the columns (in the SDO layer table) of attributes. IlvStringAttribute is transformed into SQL's VARCHAR2(512) type, IlvDoubleAttribute is transformed into NUMBER type, IlvIntegerAttribute and IlvBooleanAttribute are transformed into INTEGER type. |
upperLeftCorner | the upper left corner of the extent of the SDO layer. If set to 0, the corner is computed so that it fits the written data. |
lowerRightCorner | the lower right corner of the extent of the SDO layer. If set to 0, the corner is computed so that it fits the written data. |
|
virtual |
Closes this writer.
This method updates the SDO_GEOM_METADATA table and commits the current IldDbms
.
This method should be called after each set of calls to writeFeature()
.
tolerance | The tolerance of the layer that will be inserted in the (USER_)SDO_GEOM_METADATA table. |
upperLeft | The upper left corner (in the manager coordinate system) of the layer extent which will be inserted in the (USER_)SDO_GEOM_METADATA table. If set to 0 , the extent is defined by the global bounding box of the inserted geometries. |
lowerRight | The lower right corner (in the manager coordinate system) of the layer extent which will be inserted in the (USER_)SDO_GEOM_METADATA table. If set to 0 , the extent is defined by the global bounding box of the inserted geometries. |
IlvMaps::NoError()
otherwise. IldDbms* IlvObjectSDOWriter::getDbms | ( | ) | const |
Returns the current database connection of the writer.
|
virtual |
Returns the error code that may have happened during the iterator initialization.
const char* IlvObjectSDOWriter::getLayerName | ( | ) | const |
Returns the current layer name of the writer.
IlBoolean IlvObjectSDOWriter::isCheckingStringAttributes | ( | ) | const |
Returns whether the writer is checking string attributes or not.
setCheckingStringAttributes()
. IlBoolean IlvObjectSDOWriter::isUsingOrderedRings | ( | ) |
Indicates whether the order of the IlvMapRings
used in IlvMapPolygons
is known or not.
IlTrue
if the order of the IlvMapRings
used in IlvMapPolygons
is known, and IlFalse
if it is not. setUsingOrderedRings()
.
|
virtual |
Creates the spatial index table.
Creating a spatial index is mandatory for the use of an IlvObjectSDOLayer
.
This method just calls the Oracle SDO CREATE INDEX statement. The parameters are the same as this statement ones. In order to have your data correctly tuned, please refer to the Oracle SDO documentation.
IlvMaps::NoError()
otherwise. void IlvObjectSDOWriter::setCheckingStringAttributes | ( | IlBoolean | check | ) |
Enables/disables the checking of String attributes.
This method enables the string attribute checking, so that any string attribute handled by the writer will be checked looking for any "'" character. This is necessary if you want to insert string attributes into Oracle because the "'" characters have to be doubled ("''") in order to avoid an ORA-01756 error. String checking can be time consuming. By default, the writer does not check the string attributes.
check | Sets whether the writer should check the string attributes before inserting them into Oracle. |
void IlvObjectSDOWriter::setUsingOrderedRings | ( | IlBoolean | set | ) |
Sets whether the order of the IlvMapRings
used in IlvMapPolygons
is known or not.
Since Oracle 8.1.6, there is an optimized mode for ordered IlvMapRings
in SDO. If you are sure that the polygons you want to write into SDO have IlvMapRings
that have:
then call this method with the IlTrue
parameter. The default mode is IlFalse
(the orders of the rings are unknown).
set | If set to IlTrue , the orders of the rings are supposed to be known as the Oracle scheme described above. |
|
virtual |
Updates a row in the SDO layer with one attribute.
This method updates in the SDO layer, the attribute named attributeColumnName and valued attributeToUpdate in the row identified by the key named keyColumnName and valued keyAttribute (Oracle KEY). If the Key targets more than one row, then they will all be updated. No commit is done. This method handles the following attributes: IlvStringAttribute
, IlvIntegerAttribute
, IlvDoubleAttribute
and IlvBooleanAttribute
.
This method executes the following update statement: "UPDATE tableName SET attributeColumnName = 'attributeToUpdate' WHERE keyColumnName = 'keyAttribute';"
keyColumnName | The name of the column in the SDO layer representing the KEY. |
keyAttribute | The value of the key which is an IlvFeatureAttribute . |
attributeColumnName | The name of the column in the SDO layer to be updated. |
attributeToUpdate | The value of the attribute to be updated which is an IlvFeatureAttribute . |
IlvMaps::NoError()
otherwise.
|
virtual |
Updates a row in the SDO layer with new attributes.
In order to perform this operation, you should give as argument an IlvFeatureAttributeProperty
which has an attribute that identifies the row in the SDO layer to be modified. This attribute has to be a KEY in order to modify one unique row in the layer after each call to this method.
No commit is done. This method handles the following attributes: IlvStringAttribute
, IlvIntegerAttribute
, IlvDoubleAttribute
and IlvBooleanAttribute
. The update is done only if the attributes are columns of the SDO layer itself. If the Key targets more than one row, then they will all be updated. For instance, let FOO be an SDO layer with 3 columns: GEOMETRY (type SDO_GEOMETRY), keyID (type VARCHAR and created as not null key), intID (type NUMBER). Imagine you have the following: GEOMETRY = whatever ; keyID = "UniqueKey1" ; intID = 122 If you need to update this row with the new intID 1098, then use the following code:
attributes | The list of the attributes. |
keyPos | The position of the key attribute in the attributes list. |
IlvMaps::NoError()
otherwise.
|
virtual |
Puts the map feature passed as argument in the SDO layer without commiting the IldDbms
.
No commit is done.
feature | The map feature to be written in the Database. |
saveAtt | If set to IlFalse , only the IlvMapGeometry of the feature is saved into the SDO layer. If set to IlTrue , the writer will also insert the IlvFeatureAttributes contained in the IlvFeatureAttributeProperty of the feature. Note that in this last case, the name of the attributes must be the same that the column names of the Oracle SDO layer table in the DB. |
IlvMaps::NoError()
otherwise.
|
virtual |
Writes the iterator passed as its argument into the Oracle SDO database.
It also closes the writer and commits the data.
reader | The IlvMapFeatureIterator instance. |
count | The number of saved features. |
saveAtt | If set to IlFalse , only the IlvMapGeometry of each feature is saved into the SDO layer. If set to IlTrue , the writer will also insert the IlvFeatureAttributes contained in the IlvFeatureAttributeProperty of each feature. Note that in this last case, the name of the attributes must be the same that the column names of the Oracle SDO layer table in the DB. |
IlvMaps::NoError()
otherwise.writeFeature()
.