/** * Creates a new {@link InsertRowManager} instance. * * @param fs * feature store, must not be <code>null</code> * @param conn * connection, must not be <code>null</code> * @param idGenMode * feature id generation mode, must not be <code>null</code> */ public InsertRowManager( SQLFeatureStore fs, Connection conn, IDGenMode idGenMode ) { this.fs = fs; this.dialect = fs.getDialect(); this.conn = conn; this.idGenMode = idGenMode; this.tableDeps = fs.getSchema().getKeyDependencies(); }
private int performDeleteRelational( IdFilter filter, Lock lock ) throws FeatureStoreException { checkIfFeaturesAreNotLocked( filter, lock ); int deleted = 0; for ( ResourceId id : filter.getSelectedIds() ) { LOG.debug( "Analyzing id: " + id.getRid() ); IdAnalysis analysis = null; try { analysis = schema.analyzeId( id.getRid() ); LOG.debug( "Analysis: " + analysis ); if ( !schema.getKeyDependencies().getDeleteCascadingByDB() ) { LOG.debug( "Deleting joined rows manually." ); deleteJoinedRows( analysis ); } else { LOG.debug( "Depending on database to delete joined rows automatically." ); } deleted += deleteFeatureRow( analysis ); } catch ( IllegalArgumentException e ) { throw new FeatureStoreException( "Unable to determine feature type for id '" + id + "'." ); } } return deleted; }