Revision 20376 trunk/libraries/libDataSourceDBBaseDrivers/src/org/gvsig/data/datastores/vectorial/db/jdbc/postgresql/PostgresqlFeaturesWriter.java

View differences:

PostgresqlFeaturesWriter.java
19 19
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCAttributeDescriptor;
20 20
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCFeature;
21 21
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCFeaturesWriter;
22
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCStore;
23 22
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCTypes;
24 23
import org.gvsig.data.exception.InitializeException;
25 24
import org.gvsig.data.exception.InitializeWriterException;
26
import org.gvsig.data.exception.OpenException;
27 25
import org.gvsig.data.exception.ReadException;
28 26
import org.gvsig.data.exception.WriteException;
29 27
import org.gvsig.data.vectorial.IFeature;
......
36 34
import com.iver.cit.gvsig.fmap.core.IGeometry;
37 35
import com.vividsolutions.jts.io.WKBWriter;
38 36

  
39
class PostgresqlFeaturesWriter extends JDBCFeaturesWriter implements ISelectiveWriter {
37
public class PostgresqlFeaturesWriter extends JDBCFeaturesWriter {
40 38
	DBFeatureType featureType;
41 39
	boolean bCreateTable=false;
42 40
	private String toEncode;
43
	JDBCStore store;
44 41
	PostgresqlStoreParameters parameters;
45 42

  
46 43
	private PreparedStatement insertSt;
......
52 49
	}
53 50

  
54 51
	public void init(IFeatureStore store) {
52
		super.init(store);
55 53
		PostgresqlStore pgStore = (PostgresqlStore)store;
56
		this.store = pgStore;
57 54
		this.parameters=pgStore.getParametersPostgresql();
58 55

  
59 56
		this.featureType = (DBFeatureType)this.store.getDefaultFeatureType();
60
		conex = pgStore.getConnection();
61 57

  
62 58
	}
63 59

  
64
	public void postProcess() throws OpenException, WriteException {
65
		try {
66
			conex.commit();
67
		} catch (SQLException e) {
68
			throw new WriteException(this.store.getName(),e);
69
		}
70
	}
71

  
72
	public void cancelActions() throws WriteException{
73
		try {
74
			conex.rollback();
75
		} catch (SQLException e) {
76
			throw new WriteException(this.store.getName(),e);
77
		}
78
	}
79

  
80

  
81 60
	public void preProcess() throws WriteException, ReadException {
61
		super.preProcess();
82 62
		//??????????????????????????
83 63
		// ATENTION: We will transform (in PostGIS class; doubleQuote())
84 64
        // to UTF-8 strings. Then, we tell the PostgreSQL server

Also available in: Unified diff