SpaceDataSource
instead.@Deprecated public interface SQLDataProvider<T> extends ManagedDataSource<T>
SQLDataProvider
should be implemented when complex queries are used by the client. The space usesSQLDataProvider
when the query can not be expressed as one template. Usually in the following scenarios:
-SQLQuery
. - extended matching. - range values.SQLDataProvider
is an interface that handlesSQLQuery
objects, 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.
NUMBER_OF_PARTITIONS, STATIC_PARTITION_NUMBER
Modifier and Type | Method and Description |
---|---|
DataIterator<T> |
iterator(SQLQuery<T> query)
Deprecated.
Create an iterator over all objects that match the given
SQLQuery . |
init, initialLoad, shutdown
DataIterator<T> iterator(SQLQuery<T> query) throws DataSourceException
Create an iterator over all objects that match the givenSQLQuery
. SQLQuery contains a string representation of SQL 'where' clause. The format matches thePreparedStatement
format(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);
DataIterator
or null if no data was found that match the given templateDataSourceException
Copyright © GigaSpaces.