Revision 3462 trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGisDriver.java

View differences:

PostGisDriver.java
69 69
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
70 70
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
71 71
import com.iver.cit.gvsig.fmap.drivers.jdbc.WKBParser;
72
import com.iver.cit.gvsig.fmap.layers.XMLException;
72 73

  
73 74
/**
74 75
 * @author FJP
......
135 136
                setAbsolutePosition(index);
136 137
    	        // strAux = rs.getString(1);	        
137 138
    	        // geom = parser.read(strAux);
139
                if (rs!=null){
138 140
	            byte[] data = rs.getBytes(1);	        
139 141
	            geom = parser.parse(data);
140
	            
142
                }
141 143
            } catch (SQLException e) {
142 144
                e.printStackTrace();
143 145
            }
......
447 449
            fetch_min = 0;
448 450
            fetch_max = FETCH_SIZE-1;
449 451
        }
450
        while (index > fetch_max)
452
        while (index > fetch_max && index!=0)
451 453
        {
452 454
            rs = st.executeQuery("fetch forward " + FETCH_SIZE + " in wkb_cursor");
453 455
            // rs.next();
......
458 460
            fetch_max = fetch_min + FETCH_SIZE -1;
459 461
            // System.out.println("fetchSize = " + rs.getFetchSize() + " " + fetch_min + "-" + fetch_max);
460 462
        } 
463
        if (rs !=null)
461 464
        rs.absolute(index - fetch_min + 1);
462 465
        
463 466
        // rs.absolute(index+1);
......
629 632
     * @see com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver#getFeatureIterator(java.awt.geom.Rectangle2D, java.lang.String, java.lang.String[])
630 633
     */
631 634
    public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG, String[] alphaNumericFieldsNeeded) throws DriverException {
632
        if (workingArea != null)
635
    	try{
636
    	if (workingArea != null)
633 637
            r = r.createIntersection(workingArea);
634
        
638
    	//if (getLyrDef()==null){
639
    		load();
640
			//throw new DriverException("Fallo de la conexi?n");
641
    	//}
635 642
        String strAux = getGeometryField(getLyrDef().getFieldGeometry());
643
       
636 644
        boolean found = false;
637 645
        if (alphaNumericFieldsNeeded != null)
638 646
        {
......
663 671
        System.out.println("SqlAux getFeatureIterator = " + sqlAux);
664 672

  
665 673
        return getFeatureIterator(sqlAux);
674
    	}catch (Exception e) {
675
			throw new DriverException(e);
676
		}
666 677
    }
667 678
    
668 679
    

Also available in: Unified diff