Package com.aerospike.client.query
Class Statement
java.lang.Object
com.aerospike.client.query.Statement
public final class Statement extends Object
Query statement parameters.
-
Constructor Summary
Constructors Constructor Description Statement()
-
Method Summary
Modifier and Type Method Description String[]
getBinNames()
Get query bin names.Filter
getFilter()
Return query index filter.Value[]
getFunctionArgs()
Return aggregation function arguments.String
getFunctionName()
Return aggregation function name.String
getIndexName()
Get optional query index name.String
getNamespace()
Get query namespace.Operation[]
getOperations()
Return operations to be performed on query/execute.String
getPackageName()
Return aggregation file name.PredExp[]
getPredExp()
Return predicate expression filters.int
getRecordsPerSecond()
Return records per second.ClassLoader
getResourceLoader()
Return resource class loader.String
getResourcePath()
Return resource path.String
getSetName()
Get optional query setname.long
getTaskId()
Return task ID.boolean
isScan()
Return if full namespace/set scan is specified.void
prepare(boolean returnData)
Prepare statement just prior to execution.boolean
returnData()
Does command return data.void
setAggregateFunction(ClassLoader resourceLoader, String resourcePath, String packageName, String functionName, Value... functionArgs)
Set Lua aggregation function parameters for a Lua package located in a resource file.void
setAggregateFunction(String packageName, String functionName, Value... functionArgs)
Set Lua aggregation function parameters for a Lua package located on the filesystem.void
setBinNames(String... binNames)
Set query bin names.void
setFilter(Filter filter)
Set optional query index filter.void
setIndexName(String indexName)
Set optional query index name.void
setNamespace(String namespace)
Set query namespace.void
setOperations(Operation[] operations)
Set operations to be performed on query/execute.void
setPredExp(PredExp... predExp)
Set optional predicate expression filters in postfix notation.void
setRecordsPerSecond(int recordsPerSecond)
Limit returned records per second (rps) rate for each server.void
setReturnData(boolean returnData)
Set whether command returns data.void
setSetName(String setName)
Set optional query setname.void
setTaskId(long taskId)
Set optional query task id.
-
Constructor Details
-
Statement
public Statement()
-
-
Method Details
-
setNamespace
Set query namespace. -
getNamespace
Get query namespace. -
setSetName
Set optional query setname. -
getSetName
Get optional query setname. -
setIndexName
Set optional query index name. If not set, the server will determine the index from the filter's bin name. -
getIndexName
Get optional query index name. -
setBinNames
Set query bin names. -
getBinNames
Get query bin names. -
setFilter
Set optional query index filter. This filter is applied to the secondary index on query. Query index filters must reference a bin which has a secondary index defined. -
getFilter
Return query index filter. -
setPredExp
Set optional predicate expression filters in postfix notation. Predicate expression filters are applied on the query results on the server. Predicate expression filters may occur on any bin in the record.This method is redundant because PredExp can now be set in the base Policy for any transaction (including queries).
Postfix notation is described here: http://wiki.c2.com/?PostfixNotation
Example:
// (c >= 11 and c <= 20) or (d > 3 and (d < 5) stmt.setPredExp( PredExp.integerBin("c"), PredExp.integerValue(11), PredExp.integerGreaterEq(), PredExp.integerBin("c"), PredExp.integerValue(20), PredExp.integerLessEq(), PredExp.and(2), PredExp.integerBin("d"), PredExp.integerValue(3), PredExp.integerGreater(), PredExp.integerBin("d"), PredExp.integerValue(5), PredExp.integerLess(), PredExp.and(2), PredExp.or(2) ); // Record last update time > 2017-01-15 stmt.setPredExp( PredExp.recLastUpdate(), PredExp.integerValue(new GregorianCalendar(2017, 0, 15)), PredExp.integerGreater() );
-
getPredExp
Return predicate expression filters. -
setTaskId
public void setTaskId(long taskId)Set optional query task id. -
getTaskId
public long getTaskId()Return task ID. -
setRecordsPerSecond
public void setRecordsPerSecond(int recordsPerSecond)Limit returned records per second (rps) rate for each server. Do not apply rps limit if recordsPerSecond is zero (default). Currently only applicable to a query without a defined filter. -
getRecordsPerSecond
public int getRecordsPerSecond()Return records per second. -
setAggregateFunction
Set Lua aggregation function parameters for a Lua package located on the filesystem. This function will be called on both the server and client for each selected item.- Parameters:
packageName
- server package where user defined function residesfunctionName
- aggregation function namefunctionArgs
- arguments to pass to function name, if any
-
setAggregateFunction
public void setAggregateFunction(ClassLoader resourceLoader, String resourcePath, String packageName, String functionName, Value... functionArgs)Set Lua aggregation function parameters for a Lua package located in a resource file. This function will be called on both the server and client for each selected item.- Parameters:
resourceLoader
- class loader where resource is located. Example: MyClass.class.getClassLoader() or Thread.currentThread().getContextClassLoader() for webappsresourcePath
- class path where Lua resource is locatedpackageName
- server package where user defined function residesfunctionName
- aggregation function namefunctionArgs
- arguments to pass to function name, if any
-
getResourceLoader
Return resource class loader. -
getResourcePath
Return resource path. -
getPackageName
Return aggregation file name. -
getFunctionName
Return aggregation function name. -
getFunctionArgs
Return aggregation function arguments. -
setOperations
Set operations to be performed on query/execute. -
getOperations
Return operations to be performed on query/execute. -
setReturnData
public void setReturnData(boolean returnData)Set whether command returns data. -
returnData
public boolean returnData()Does command return data. -
prepare
public void prepare(boolean returnData)Prepare statement just prior to execution. For internal use. -
isScan
public boolean isScan()Return if full namespace/set scan is specified.
-