Revision 31128 branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/store/jdbc/JDBCSetProvider.java
JDBCSetProvider.java | ||
---|---|---|
68 | 68 |
|
69 | 69 |
private JDBCHelper helper = null; |
70 | 70 |
|
71 |
private int defaultFetchSize = 1000; |
|
72 |
|
|
73 |
private long limit = -1l; |
|
74 |
|
|
71 | 75 |
public JDBCSetProvider(JDBCStoreProvider store, FeatureQuery query, |
72 | 76 |
FeatureType featureType) throws DataException { |
73 | 77 |
super(store, query, featureType); |
... | ... | |
85 | 89 |
} else { |
86 | 90 |
setOrder(null); |
87 | 91 |
} |
92 |
|
|
93 |
if (query != null) { |
|
94 |
limit = query.getLimit(); |
|
95 |
} |
|
88 | 96 |
} |
89 | 97 |
|
98 |
/** |
|
99 |
* @return the defaultFetchSize |
|
100 |
*/ |
|
101 |
public int getDefaultFetchSize() { |
|
102 |
return defaultFetchSize; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* @param defaultFetchSize |
|
107 |
* the defaultFetchSize to set |
|
108 |
*/ |
|
109 |
public void setDefaultFetchSize(int defaultFetchSize) { |
|
110 |
this.defaultFetchSize = defaultFetchSize; |
|
111 |
} |
|
112 |
|
|
90 | 113 |
protected String getSqlForEvaluator(Evaluator filter) { |
91 | 114 |
if (filter == null) { |
92 | 115 |
return null; |
... | ... | |
273 | 296 |
|
274 | 297 |
protected String getSQL(long fromIndex) throws DataException { |
275 | 298 |
return getJDBCStoreProvider().compoundSelect(getFeatureType(), filter, |
276 |
order, 0, fromIndex);
|
|
299 |
order, limit, fromIndex);
|
|
277 | 300 |
|
278 | 301 |
} |
279 | 302 |
|
... | ... | |
297 | 320 |
String sql = |
298 | 321 |
store.compoundSelect(getFeatureType(), filter, null, 1, |
299 | 322 |
0); |
300 |
int rsID = store.createResultSet(sql); |
|
323 |
int rsID = store.createResultSet(sql, getFetchSize());
|
|
301 | 324 |
isEmpty = new Boolean(store.resulsetNext(rsID)); |
302 | 325 |
store.closeResulset(rsID); |
303 | 326 |
} else { |
... | ... | |
307 | 330 |
return isEmpty.booleanValue(); |
308 | 331 |
} |
309 | 332 |
|
333 |
protected int getFetchSize() { |
|
334 |
long pageSize = -1; |
|
335 |
if (getQuery() != null) { |
|
336 |
pageSize = getQuery().getPageSize(); |
|
337 |
pageSize = |
|
338 |
pageSize > Integer.MAX_VALUE ? Integer.MAX_VALUE : pageSize; |
|
339 |
} |
|
340 |
return (pageSize > 0 ? (int) pageSize : defaultFetchSize); |
|
341 |
} |
|
342 |
|
|
310 | 343 |
protected JDBCIterator createFastIterator(long index) throws DataException { |
311 | 344 |
if (isEmpty != null && isEmpty.booleanValue()) { |
312 | 345 |
return new EmptyJDBCIterator(); |
313 | 346 |
} |
314 |
int rsID = getJDBCStoreProvider().createResultSet(getSQL(index)); |
|
347 |
int rsID = |
|
348 |
getJDBCStoreProvider().createResultSet(getSQL(index), |
|
349 |
getFetchSize()); |
|
315 | 350 |
return createDefaultFastIterator(rsID); |
316 | 351 |
} |
317 | 352 |
|
... | ... | |
325 | 360 |
if (isEmpty != null && isEmpty.booleanValue()) { |
326 | 361 |
return new EmptyJDBCIterator(); |
327 | 362 |
} |
328 |
int rsID = getJDBCStoreProvider().createResultSet(getSQL(index)); |
|
363 |
int rsID = |
|
364 |
getJDBCStoreProvider().createResultSet(getSQL(index), |
|
365 |
getFetchSize()); |
|
329 | 366 |
return createDefaultIterator(rsID); |
330 | 367 |
} |
331 | 368 |
|
Also available in: Unified diff