Revision 1755 branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGisDriver.java

View differences:

PostGisDriver.java
68 68
    private WKTParser parser = new WKTParser();
69 69
    private int fetch_min=-1;
70 70
    private int fetch_max=-1;
71
    private Statement st;
71
    
72 72
    private Rectangle2D fullExtent = null;
73 73
    private String strAux;
74 74
    
......
147 147
	    try {
148 148
	        st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
149 149
	        st.setFetchSize(5000);
150
	        rs = st.executeQuery(sqlOrig);
150
	        st.execute("declare wkb_cursor binary cursor for " + sqlOrig);
151
	        rs = st.executeQuery("fetch forward all in wkb_cursor");
152
	        st.execute("BEGIN"); 
153
	        bCursorActivo = true; 
154
	        // rs = st.executeQuery(sqlOrig);
151 155
            fetch_min = 0;
152 156
            fetch_max = rs.getFetchSize();
153
            metaData = rs.getMetaData();
157
            metaData = rs.getMetaData(); 
154 158
        } catch (SQLException e) {
155 159
            // TODO Auto-generated catch block
156 160
            e.printStackTrace();
......
189 193
     * @see com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver#getGeometryIterator(java.lang.String)
190 194
     */
191 195
    public GeometryIterator getGeometryIterator(String sql) throws com.iver.cit.gvsig.fmap.DriverException {
192
        Statement st;
193 196
        PostGisGeometryIterator geomIterator = null;
194 197
        try {
195 198
            st = conn.createStatement();
196 199
            st.setFetchSize(2000);
197
            ResultSet rs = st.executeQuery(sql);
200
            if (bCursorActivo)
201
                close();
202
	        st.execute("declare wkb_cursor binary cursor for " + sql);
203
	        ResultSet rs = st.executeQuery("fetch forward all in wkb_cursor");
204
            // st.execute("BEGIN");
205
            bCursorActivo = true;
206
            // ResultSet rs = st.executeQuery(sql);
198 207
            geomIterator = new PostGisGeometryIterator(rs);
199 208
        } catch (SQLException e) {
200 209
            e.printStackTrace();

Also available in: Unified diff