Rogue Wave Views
Maps Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvObjectSDOWriter Class Reference

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...
 

Detailed Description

Writes features to an Oracle Spatial layer, using the object model.

Library: ilvdbmaps

Note
As Oracle 8i Spatial object model does not allow MultiPolygon geometries that contain Polygons with holes, if such geometries are encountered by this writer, they will be written out using a collection of Polygon.

Constructor & Destructor Documentation

§ IlvObjectSDOWriter()

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.

Parameters
dbmsThe IldDbms containing the connection to Oracle. The writer turns off the dbms' auto commit mode.
tableNameThe name of the SDO layer table. It can be made of the owner name and the table name ("OwnerName.TableName").
geometryColumnNameThe name of the column containing the geometries objects.
xDimensionNameThe name of the X dimension.
yDimensionNameThe name of the Y dimension.
createTablesIf set to IlTrue, the writer will create the necessary table and entries (note that you can do this only under certain Oracle privileges).
infoAn 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.
upperLeftCornerthe 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.
lowerRightCornerthe 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.

Member Function Documentation

§ close()

virtual IlvMapsError IlvObjectSDOWriter::close ( IlDouble  tolerance = 0.0,
const IlvCoordinate upperLeft = 0,
const IlvCoordinate lowerRight = 0 
)
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().

Parameters
toleranceThe tolerance of the layer that will be inserted in the (USER_)SDO_GEOM_METADATA table.
upperLeftThe 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.
lowerRightThe 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.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

§ getDbms()

IldDbms* IlvObjectSDOWriter::getDbms ( ) const

Returns the current database connection of the writer.

Returns
The current database connection of the writer.

§ getInitStatus()

virtual IlvMapsError IlvObjectSDOWriter::getInitStatus ( ) const
virtual

Returns the error code that may have happened during the iterator initialization.

Returns
The init status of the writer.

§ getLayerName()

const char* IlvObjectSDOWriter::getLayerName ( ) const

Returns the current layer name of the writer.

Returns
The current layer name of the writer.

§ isCheckingStringAttributes()

IlBoolean IlvObjectSDOWriter::isCheckingStringAttributes ( ) const

Returns whether the writer is checking string attributes or not.

Returns
Whether the writer is checking string attributes or not.
See also
setCheckingStringAttributes().

§ isUsingOrderedRings()

IlBoolean IlvObjectSDOWriter::isUsingOrderedRings ( )

Indicates whether the order of the IlvMapRings used in IlvMapPolygons is known or not.

Returns
IlTrue if the order of the IlvMapRings used in IlvMapPolygons is known, and IlFalse if it is not.
See also
setUsingOrderedRings().

§ populateIndexes()

virtual IlvMapsError IlvObjectSDOWriter::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 
)
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.

Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

§ setCheckingStringAttributes()

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.

Parameters
checkSets whether the writer should check the string attributes before inserting them into Oracle.
See also
isCheckingStringAttributes(), writeFeature(), writeFeatureIterator(), updateFeatureAttribute(), updateFeatureAttributes().

§ setUsingOrderedRings()

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:

  • The counter-clockwise order for exterior rings.
  • The clockwise order for interior rings.

then call this method with the IlTrue parameter. The default mode is IlFalse (the orders of the rings are unknown).

Parameters
setIf set to IlTrue, the orders of the rings are supposed to be known as the Oracle scheme described above.

§ updateFeatureAttribute()

virtual IlvMapsError IlvObjectSDOWriter::updateFeatureAttribute ( const char *  keyColumnName,
const IlvFeatureAttribute keyAttribute,
const char *  attributeColumnName,
const IlvFeatureAttribute attributeToUpdate 
)
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';"

Parameters
keyColumnNameThe name of the column in the SDO layer representing the KEY.
keyAttributeThe value of the key which is an IlvFeatureAttribute.
attributeColumnNameThe name of the column in the SDO layer to be updated.
attributeToUpdateThe value of the attribute to be updated which is an IlvFeatureAttribute.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

§ updateFeatureAttributes()

virtual IlvMapsError IlvObjectSDOWriter::updateFeatureAttributes ( const IlvFeatureAttributeProperty attributes,
IlUInt  keyPos 
)
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:

// Construction of the IlvFeatureAttributeInfo: can be done just once.
IlvMapClassInfo** attributeClasses = new IlvMapClassInfo*[2];
IlBoolean* nullable = new IlBoolean[2];
nullable[0] = nullable[1] = IlTrue;
attributeClasses[0] = IlvStringAttribute::ClassInfo();
attributeClasses[1] = IlvIntegerAttribute::ClassInfo();
char** names = new char*[2];
names[0] = new char[10];
names[1] = new char[10];
strcpy(names[0], "keyID"); // the first one must be the KEY
strcpy(names[1], "intID");
attributeClasses,
nullable);
// The update itself
attributes[0] = new IlvStringAttribute("UniqueKey1");
attributes[1] = new IlvIntegerAttribute(1098); // The new value for update
IlvMapsError error;
IlvFeatureAttributeProperty* prop = new IlvFeatureAttributeProperty(info, attributes, error);
if (error == IlvMaps::NoError()) {
error = myWriter->updateFeatureAttributes(prop, 0);
}
Parameters
attributesThe list of the attributes.
keyPosThe position of the key attribute in the attributes list.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

§ writeFeature()

virtual IlvMapsError IlvObjectSDOWriter::writeFeature ( const IlvMapFeature feature,
IlBoolean  saveAtt = IlFalse 
)
virtual

Puts the map feature passed as argument in the SDO layer without commiting the IldDbms.

No commit is done.

Parameters
featureThe map feature to be written in the Database.
saveAttIf 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.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

§ writeFeatureIterator()

virtual IlvMapsError IlvObjectSDOWriter::writeFeatureIterator ( IlvMapFeatureIterator reader,
IlInt count,
IlBoolean  saveAtt = IlFalse 
)
virtual

Writes the iterator passed as its argument into the Oracle SDO database.

It also closes the writer and commits the data.

Parameters
readerThe IlvMapFeatureIterator instance.
countThe number of saved features.
saveAttIf 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.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.
See also
writeFeature().

© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.