Revision 14041 branches/v10/extensions/extOracleSpatial/src/es/prodevelop/cit/gvsig/fmap/drivers/jdbc/oracle/OracleSpatialWriter.java

View differences:

OracleSpatialWriter.java
117 117
    }
118 118

  
119 119
    public void preProcess() throws EditionException {
120
    	
121
    	IConnection conn = ((DBLayerDefinition) tableDef).getConnection();;
122
    	
120 123
        if (tableCreation) {
121 124
            String srid_epsg = ((DBLayerDefinition) tableDef).getSRID_EPSG();
122 125

  
......
146 149
                    oracleSRID, bbox, dim_aux, storeWithSrid);
147 150

  
148 151
            //dimensions);
149
            IConnection conn = ((DBLayerDefinition) tableDef).getConnection();
150 152

  
153
            
154

  
151 155
            boolean removed = true;
152 156

  
153 157
            try {
......
209 213

  
210 214
            rowIndex = 0;
211 215

  
212
            try {
213
            	((ConnectionJDBC)conn).getConnection().setAutoCommit(false);
214
            }
215
            catch (SQLException e) {
216
                logger.error("Error while setting auto commit FALSE: " +
217
                    e.getMessage());
218
            }
219 216
        }
220 217
        else {
218
        	
221 219
        }
220
        
221
        try {
222
        	((ConnectionJDBC)conn).getConnection().setAutoCommit(false);
223
        	((ConnectionJDBC)conn).getConnection().commit();
224
        }
225
        catch (SQLException e) {
226
            logger.error("Error while setting auto commit FALSE: " +
227
                e.getMessage());
228
        }
229
        
222 230
    }
223 231

  
224 232
    public void process(IRowEdited _row) throws EditionException {
......
255 263
        }
256 264
    }
257 265

  
258
    private void addRowInCreation(IRowEdited irow) throws EditionException {
259
        // TODO: Build value-independent SQL, then use addBatch()
260
        /*
261
        DefaultRowEdited row = (DefaultRowEdited) irow;
262
        IFeature ifeat = (IFeature) row.getLinkedRow();
263
        String _sql_insert = OracleSpatialDriver.getRowInsertSql(
264
                        ifeat, (DBLayerDefinition) tableDef, rowIndex, geoColName);
265

  
266
        Connection conn = ((DBLayerDefinition) tableDef).getConnection();
267

  
268
        try {
269
                // java.sql.PreparedStatement ps = conn.prepareStatement(_sql_insert);
270
                creationStatement = conn.prepareStatement(_sql_insert);
271
                // Shape shp = ifeat.getGeometry().getInternalShape();
272
                IGeometry _ig = ifeat.getGeometry();
273
                // STRUCT st = driver.shapeToStruct(shp, lyrShapeType, conn, oracleSRID, false);
274
                STRUCT st = OracleSpatialDriver.iGeometryToSTRUCT(_ig, lyrShapeType, conn,
275
                                oracleSRID, storeWithSrid, aguBien, isGeoCS);
276

  
277
                ps.setObject(1, st);
278
                ps.execute();
279
                ps.close();
280
                rowIndex++;
281

  
282
                // getDriver().addRow(irow.getID());
283
        } catch (Exception ex) {
284
                logger.error("Error while executing SQL for row insertion: " + ex.getMessage(), ex);
285
                throw new EditionException(ex.getMessage());
286
        }
287
        */
288
    }
289

  
290 266
    private void addRow(IRowEdited irow) throws EditionException {
291 267
        DefaultRowEdited row = (DefaultRowEdited) irow;
292 268
        IFeature ifeat = (IFeature) row.getLinkedRow();
......
439 415

  
440 416
            try {
441 417
            	((ConnectionJDBC)conn).getConnection().commit();
442
            	((ConnectionJDBC)conn).getConnection().setAutoCommit(true);
443 418
            }
444 419
            catch (SQLException e) {
445 420
                logger.error(

Also available in: Unified diff