Package com.streambase.sb.operator
Interface PreparedQuery
-
public interface PreparedQuery
A query that has been prepared against a table. Prepared queries can be executed multiple times with different arguments.- Since:
- 7.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompiledTuple
createArgumentTuple()
Factory for argument tuples for this prepared query.void
execute(CompiledTuple args, RowConsumer consumer)
Run the query against a given set of arguments, and pass the results toconsumer
void
execute(CompiledTuple args, TableAccessor table, RowConsumer consumer)
Execute the queryboolean
isShareable()
whether it is safe to share this prepared query object with multiple threads which can execute it on different table instances Note that the tables MUST have the same definition
-
-
-
Method Detail
-
createArgumentTuple
CompiledTuple createArgumentTuple()
Factory for argument tuples for this prepared query.- Returns:
- a tuple suitable for populating values and passing to execute.
-
execute
void execute(CompiledTuple args, RowConsumer consumer) throws StreamBaseException
Run the query against a given set of arguments, and pass the results toconsumer
- Parameters:
args
- Tuple of arguments for this prepared query. This tuple must come fromcreateArgumentTuple()
consumer
- ARowConsumer
that will be passed each row in the results of the query one by one- Throws:
StreamBaseException
- If the query does not run properly, or if the consumer throws an exception
-
execute
void execute(CompiledTuple args, TableAccessor table, RowConsumer consumer) throws StreamBaseException
Execute the query- Parameters:
args
- Prepared query arguments. Must have been created usingcreateArgumentTuple()
table
- Table accessorconsumer
-RowConsumer
that will be passed each row in the result set- Throws:
StreamBaseException
- Error executing query, or consume reports an error
-
isShareable
boolean isShareable()
whether it is safe to share this prepared query object with multiple threads which can execute it on different table instances Note that the tables MUST have the same definition- Returns:
- where it's safe to share this prepared query
-
-