Revision 23680 branches/v2_0_0_prep/libraries/libFMap_dataDB/src/org/gvsig/fmap/data/feature/db/jdbc/AbstractJDBCIterator.java
AbstractJDBCIterator.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
public abstract class AbstractJDBCIterator implements Iterator { |
43 | 43 |
|
44 |
public AbstractJDBCIterator(JDBCStore store, DBFeatureType featureType, |
|
45 |
String sql, int fetchSize, FeatureManager featureManager, |
|
46 |
Filter featureFilter) throws ReadException { |
|
47 |
this.store = store; |
|
48 |
this.featureType = featureType; |
|
49 |
this.fetchSize = fetchSize; |
|
50 |
this.sql = sql; |
|
51 |
this.page = 0; |
|
52 |
this.index = 0; |
|
53 |
this.featureManager = featureManager; |
|
54 |
this.featureFilter = featureFilter; |
|
55 |
this.createResulset(); |
|
56 |
} |
|
57 | 44 |
protected boolean nextChecked = false; |
58 | 45 |
protected Feature feature; |
59 | 46 |
protected ResultSet rs; |
... | ... | |
68 | 55 |
protected int index; |
69 | 56 |
protected FeatureManager featureManager = null; |
70 | 57 |
protected Filter featureFilter = null; |
58 |
|
|
59 |
private int initialPosition = 1; |
|
71 | 60 |
|
61 |
public AbstractJDBCIterator(JDBCStore store, DBFeatureType featureType, |
|
62 |
String sql, int fetchSize, FeatureManager featureManager, |
|
63 |
Filter featureFilter, int initialPosition) throws ReadException { |
|
64 |
this.store = store; |
|
65 |
this.featureType = featureType; |
|
66 |
this.fetchSize = fetchSize; |
|
67 |
this.sql = sql; |
|
68 |
this.page = 0; |
|
69 |
this.index = 0; |
|
70 |
this.featureManager = featureManager; |
|
71 |
this.featureFilter = featureFilter; |
|
72 |
this.initialPosition = initialPosition; |
|
73 |
this.createResulset(); |
|
74 |
} |
|
75 |
|
|
76 |
public AbstractJDBCIterator(JDBCStore store, DBFeatureType featureType, |
|
77 |
String sql, int fetchSize, FeatureManager featureManager, |
|
78 |
Filter featureFilter) throws ReadException { |
|
79 |
this(store, featureType, sql, fetchSize, featureManager, featureFilter, |
|
80 |
1); |
|
81 |
} |
|
82 |
|
|
72 | 83 |
protected Feature nextDBFeature() { |
73 | 84 |
Feature feature = null; |
74 | 85 |
while (true) { |
... | ... | |
143 | 154 |
Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, |
144 | 155 |
ResultSet.CONCUR_READ_ONLY); |
145 | 156 |
this.rs = st.executeQuery(mSql); |
157 |
|
|
158 |
if (initialPosition > 1) { |
|
159 |
rs.absolute(initialPosition); |
|
160 |
} |
|
146 | 161 |
|
147 | 162 |
} catch (java.sql.SQLException e) { |
148 | 163 |
throw new SQLException(mSql, this.store.getName(), e); |
Also available in: Unified diff