|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.jdbc.JDBCFeatureWriter
org.geotools.data.jdbc.JDBCPSFeatureWriter
public abstract class JDBCPSFeatureWriter
An abstract class that uses prepared statements to insert, update and delete features from the database. Useful when the resultset got from the database is not updatable, and to get peak performance thru the use of prepared statements and batch updates.
Assumptions made by the code:
Field Summary | |
---|---|
protected FIDMapper |
mapper
Deprecated. |
Fields inherited from class org.geotools.data.jdbc.JDBCFeatureWriter |
---|
closed, current, fidAttributes, live, queryData, reader |
Constructor Summary | |
---|---|
JDBCPSFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader,
QueryData queryData)
Deprecated. Creates a new instance of JDBCFeatureWriter |
Method Summary | |
---|---|
void |
close()
Deprecated. Release the underlying resources. |
protected java.sql.PreparedStatement |
createDeleteStatement(java.sql.Connection conn,
org.opengis.feature.simple.SimpleFeatureType featureType)
Deprecated. Creates the prepared statement for feature deletes |
protected java.sql.PreparedStatement |
createInsertStatement(java.sql.Connection conn,
org.opengis.feature.simple.SimpleFeatureType featureType)
Deprecated. Creates the prepared statement for feature inserts |
protected java.sql.PreparedStatement |
createUpdateStatement(java.sql.Connection conn,
org.opengis.feature.simple.SimpleFeatureType featureType)
Deprecated. Creates the prepared statement for feature updates |
protected void |
doInsert(MutableFIDFeature current)
Deprecated. Override that uses prepared statements to perform the operation. |
protected void |
doUpdate(org.opengis.feature.simple.SimpleFeature live,
org.opengis.feature.simple.SimpleFeature current)
Deprecated. Override that uses sql statements to perform the operation. |
protected void |
executeInsert(java.sql.PreparedStatement insertStatement)
Deprecated. Hook for subclasses to use a specific execution mechanism other than the default insertStatement.executeUpdate() . |
protected abstract java.lang.String |
getGeometryPlaceHolder(org.opengis.feature.type.AttributeDescriptor type)
Deprecated. Returns the placeholder for the geometry in the insert/update statement. |
protected java.sql.PreparedStatement |
prepareInsertStatement(java.sql.Connection conn,
java.lang.StringBuffer statementSQL,
org.opengis.feature.simple.SimpleFeatureType featureType)
Deprecated. Provides a hook for subclasses to fine tune the creation of the prepared statement. |
protected void |
remove(MutableFIDFeature current)
Deprecated. Override that uses prepared statements to perform the operation. |
protected boolean |
useQueryDataForInsert()
Deprecated. This version does not use QueryData udpate/insert/remove methods, but uses separate prepared statements instead |
Methods inherited from class org.geotools.data.jdbc.JDBCFeatureWriter |
---|
encodeColumnName, encodeName, getFeatureType, hasNext, next, remove, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final FIDMapper mapper
Constructor Detail |
---|
public JDBCPSFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader, QueryData queryData) throws java.io.IOException
fReader
- queryData
-
java.io.IOException
Method Detail |
---|
protected void doInsert(MutableFIDFeature current) throws java.io.IOException, java.sql.SQLException
doInsert
in class JDBCFeatureWriter
java.io.IOException
java.sql.SQLException
JDBCFeatureWriter.doInsert(org.geotools.data.jdbc.MutableFIDFeature)
protected void executeInsert(java.sql.PreparedStatement insertStatement) throws java.io.IOException
insertStatement.executeUpdate()
.
Override may be needed in some cases, for example, where the execution expects a ResultSet containing the autogenerated primary key.
insertStatement
- the insert statement prepared in doInsert(MutableFIDFeature)
java.io.IOException
protected java.sql.PreparedStatement createInsertStatement(java.sql.Connection conn, org.opengis.feature.simple.SimpleFeatureType featureType) throws java.sql.SQLException
conn
- featureType
-
java.sql.SQLException
protected java.sql.PreparedStatement prepareInsertStatement(java.sql.Connection conn, java.lang.StringBuffer statementSQL, org.opengis.feature.simple.SimpleFeatureType featureType) throws java.sql.SQLException
This default implementation just creates the statement with the given connetion and
the insert request built at createInsertStatement(java.sql.Connection, org.opengis.feature.simple.SimpleFeatureType)
conn
- statementSQL
- featureType
-
java.sql.SQLException
protected abstract java.lang.String getGeometryPlaceHolder(org.opengis.feature.type.AttributeDescriptor type)
type
- protected void remove(MutableFIDFeature current) throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
JDBCFeatureWriter.doInsert(org.geotools.data.jdbc.MutableFIDFeature)
protected java.sql.PreparedStatement createDeleteStatement(java.sql.Connection conn, org.opengis.feature.simple.SimpleFeatureType featureType) throws java.sql.SQLException
conn
- featureType
-
java.sql.SQLException
protected java.sql.PreparedStatement createUpdateStatement(java.sql.Connection conn, org.opengis.feature.simple.SimpleFeatureType featureType) throws java.sql.SQLException
conn
- featureType
-
java.sql.SQLException
protected void doUpdate(org.opengis.feature.simple.SimpleFeature live, org.opengis.feature.simple.SimpleFeature current) throws java.io.IOException, java.sql.SQLException
doUpdate
in class JDBCFeatureWriter
java.io.IOException
java.sql.SQLException
org.geotools.data.jdbc.JDBCFeatureWriter#doUpdate(org.geotools.feature.Feature,
org.geotools.feature.Feature)
protected boolean useQueryDataForInsert()
useQueryDataForInsert
in class JDBCFeatureWriter
JDBCFeatureWriter.useQueryDataForInsert()
public void close() throws java.io.IOException
FeatureWriter
close
in interface FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
close
in class JDBCFeatureWriter
java.io.IOException
- if there there are problems releasing underlying resources, or
possibly if close has been called (up to the implementation).FeatureWriter.close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |