|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dbunit.dataset.datatype.DataType
org.dbunit.dataset.datatype.AbstractDataType
org.dbunit.ext.oracle.OracleSdoGeometryDataType
public class OracleSdoGeometryDataType
This class implements DataType for Oracle SDO_GEOMETRY type used in Oracle Spatial. See the Oracle Spatial Developer's Guide for details on SDO_GEOMETRY. This class handles values similar to:
For more information on oracle spatial support go to http://tahiti.oracle.com and search for "spatial". The developers guide is available at http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28400/toc.htm
example table:
CREATE TABLE cola_markets (
mkt_id NUMBER PRIMARY KEY,
name VARCHAR2(32),
shape SDO_GEOMETRY);
example insert:
INSERT INTO cola_markets VALUES(
2,
'cola_b',
SDO_GEOMETRY(
2003, -- two-dimensional polygon
NULL,
NULL,
SDO_ELEM_INFO_ARRAY(1,1003,1), -- one polygon (exterior polygon ring)
SDO_ORDINATE_ARRAY(5,1, 8,1, 8,6, 5,7, 5,1)
)
);
This class uses the following objects which were rendered using oracle jpub and then slightly customized to work with dbunit:
./jpub -user=YOUR_USER_ID/YOUR_PASSWORD -url=YOUR_JDBC_URL
-sql mdsys.sdo_geometry:OracleSdoGeometry,
mdsys.sdo_point_type:OracleSdoPointType,
mdsys.sdo_elem_info_array:OracleSdoElemInfoArray,
mdsys.sdo_ordinate_array:OracleSdoOrdinateArray
-dir=output_dir -methods=none -package=org.dbunit.ext.oracle -tostring=true
The equals and hashCode methods were then added so that the objects could be compared
in test cases. Note that I did have to bash the jpub startup script (change classpath)
because it assumes oracle 10g database but I ran it with 11g. Theoretically, this
process can be repeated for other custom oracle object data types.
| Field Summary |
|---|
| Fields inherited from class org.dbunit.dataset.datatype.DataType |
|---|
BIGINT, BIGINT_AUX_LONG, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGNVARCHAR, LONGVARBINARY, LONGVARCHAR, NCHAR, NUMERIC, NVARCHAR, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR |
| Method Summary | |
|---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
This method is copied from AbstractDataType and customized to call equals after the typeCast because OracleSdoGeometry objects are not Comparables but can test for equality (via equals method.) |
java.lang.Object |
getSqlValue(int column,
java.sql.ResultSet resultSet)
Returns the specified column value from the specified resultset object. |
void |
setSqlValue(java.lang.Object value,
int column,
java.sql.PreparedStatement statement)
Set the specified value to the specified prepared statement object. |
java.lang.Object |
typeCast(java.lang.Object value)
Returns the specified value typecasted to this DataType |
| Methods inherited from class org.dbunit.dataset.datatype.AbstractDataType |
|---|
areObjectsEqual, compareNonNulls, getSqlType, getTypeClass, isDateTime, isNumber, loadClass, loadClass, toString |
| Methods inherited from class org.dbunit.dataset.datatype.DataType |
|---|
asString, forObject, forSqlType, forSqlTypeName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public java.lang.Object typeCast(java.lang.Object value)
throws TypeCastException
DataTypeDataType
typeCast in class DataTypeTypeCastException
public java.lang.Object getSqlValue(int column,
java.sql.ResultSet resultSet)
throws java.sql.SQLException,
TypeCastException
DataType
getSqlValue in class AbstractDataTypejava.sql.SQLException
TypeCastException
public void setSqlValue(java.lang.Object value,
int column,
java.sql.PreparedStatement statement)
throws java.sql.SQLException,
TypeCastException
DataType
setSqlValue in class AbstractDataTypejava.sql.SQLException
TypeCastException
public int compare(java.lang.Object o1,
java.lang.Object o2)
throws TypeCastException
compare in class AbstractDataTypeTypeCastException - if the arguments' types prevent them from
being compared by this Comparator.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||