Package com.gigaspaces.datasource
Interface SQLDataProvider<T>
- All Superinterfaces:
ManagedDataSource<T>
- All Known Subinterfaces:
ExternalDataSource<T>
- All Known Implementing Classes:
DataStorage,SharedIteratorSQLDataProviderDecorator,SQLDataProviderExceptionHandler,SQLDataProviderSplitter
Deprecated.
SQLDataProvidershould be implemented when complex queries are used by the client. The space usesSQLDataProviderwhen the query can not be expressed as one template. Usually in the following scenarios:
-SQLQuery. - extended matching. - range values.SQLDataProvideris an interface that handlesSQLQueryobjects, generated by space. This interface This interface can be implemented instead of theDataProvider. In case that both interface are implemented - the space will choose SQLDataProvider.
- Since:
- 6.0
- Author:
- anna
-
Field Summary
Fields inherited from interface com.gigaspaces.datasource.ManagedDataSource
NUMBER_OF_PARTITIONS, STATIC_PARTITION_NUMBER -
Method Summary
Methods inherited from interface com.gigaspaces.datasource.ManagedDataSource
init, initialLoad, shutdown
-
Method Details
-
iterator
Deprecated.Create an iterator over all objects that match the given
SQLQuery. SQLQuery contains a string representation of SQL 'where' clause. The format matches thePreparedStatementformat(field1 = ? and field2 > ? and ....). The prepared values are accessible bySQLQuery.getPreparedValues() method Example implementation with SQL PreparedStatement:PreparedStatement st = con.prepareStatement(query.getSelectAllQuery()); int index = 0; if(query.hasPreparedValues()) { for(Iterator iter = query.getPreparedValues().iterator();iter.hasNext()) { st.setObject(++index,iter.next()); } } ResultSet rs = st.executeQuery(); return new ResultSetIterator(rs);- Returns:
- a
DataIteratoror null if no data was found that match the given template - Throws:
DataSourceException
-
SpaceDataSourceinstead.