org.geotools.data.postgis.fidmapper
Class PostGISAutoIncrementFIDMapper
Object
AbstractFIDMapper
AutoIncrementFIDMapper
PostGISAutoIncrementFIDMapper
- All Implemented Interfaces:
- Serializable, FIDMapper
public class PostGISAutoIncrementFIDMapper
- extends AutoIncrementFIDMapper
- implements FIDMapper
Generate FID based on an auto increment function, the most stable approach for
use with editing.
- Author:
- Jesse Eichar, Refractions Research, Inc., Cory Horner, Refractions Research, Inc.
- See Also:
- Serialized Form
- Module:
modules/plugin/postgis (gt-postgis.jar)
Methods inherited from class AbstractFIDMapper |
getColumnCount, getColumnDecimalDigits, getColumnDecimalDigits, getColumnName, getColumnName, getColumnSize, getColumnSize, getColumnType, getColumnType, getTableName, getTableSchemaName, hasAutoIncrementColumns, initSupportStructures, isAutoIncrement, isAutoIncrement, isVolatile, returnFIDColumnsAsAttributes, setInfo, toString |
Methods inherited from interface FIDMapper |
getColumnCount, getColumnDecimalDigits, getColumnName, getColumnSize, getColumnType, getID, getPKAttributes, hasAutoIncrementColumns, initSupportStructures, isAutoIncrement, isValid, isVolatile, returnFIDColumnsAsAttributes |
PostGISAutoIncrementFIDMapper
public PostGISAutoIncrementFIDMapper(String tableSchemaName,
String tableName,
String colName,
int dataType)
PostGISAutoIncrementFIDMapper
public PostGISAutoIncrementFIDMapper(String tableName,
String colName,
int dataType,
boolean returnFIDColumnsAsAttributes)
createID
public String createID(Connection conn,
SimpleFeature feature,
Statement statement)
throws IOException
- Description copied from interface:
FIDMapper
- Creates a new ID for a feature.
This is done either by querying the database (for auto-increment like
types, for example sequences) or by inspecting the Feature (for
example, for primary keys with business meaning that whose attributes
are included in the Feature ones).
- Specified by:
createID
in interface FIDMapper
- Overrides:
createID
in class AutoIncrementFIDMapper
- Parameters:
conn
- - the database connectionfeature
- - the feature that needs the new FIDstatement
- - the statement used to insert the feature into the
database
- Throws:
IOException
- See Also:
org.geotools.data.jdbc.fidmapper.FIDMapper#createID(java.sql.Connection,
org.geotools.feature.Feature, Statement)
retriveId
public String retriveId(Connection conn,
SimpleFeature feature,
Statement statement)
throws IOException
- Attempts to determine the FID after it was inserted, using four techniques:
1. SELECT currval(pg_get_serial_sequence(...))
2. SELECT currval(sequence name) <-- using other methods to get name
3. SELECT fid ... ORDER BY fid DESC LIMIT 1
- Throws:
IOException
Copyright © 1996-2010 Geotools. All Rights Reserved.