Class Statement

java.lang.Object
com.aerospike.client.query.Statement

public final class Statement
extends Object
Query statement parameters.
  • Constructor Details

  • Method Details

    • setNamespace

      public void setNamespace​(String namespace)
      Set query namespace.
    • getNamespace

      public String getNamespace()
      Get query namespace.
    • setSetName

      public void setSetName​(String setName)
      Set optional query setname.
    • getSetName

      public String getSetName()
      Get optional query setname.
    • setIndexName

      public void setIndexName​(String indexName)
      Set optional query index name. If not set, the server will determine the index from the filter's bin name.
    • getIndexName

      public String getIndexName()
      Get optional query index name.
    • setBinNames

      public void setBinNames​(String... binNames)
      Set query bin names.
    • getBinNames

      public String[] getBinNames()
      Get query bin names.
    • setFilter

      public void setFilter​(Filter filter)
      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

      public Filter getFilter()
      Return query index filter.
    • setPredExp

      public void setPredExp​(PredExp... predExp)
      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

      public PredExp[] 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

      public void setAggregateFunction​(String packageName, String functionName, Value... functionArgs)
      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 resides
      functionName - aggregation function name
      functionArgs - 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 webapps
      resourcePath - class path where Lua resource is located
      packageName - server package where user defined function resides
      functionName - aggregation function name
      functionArgs - arguments to pass to function name, if any
    • getResourceLoader

      public ClassLoader getResourceLoader()
      Return resource class loader.
    • getResourcePath

      public String getResourcePath()
      Return resource path.
    • getPackageName

      public String getPackageName()
      Return aggregation file name.
    • getFunctionName

      public String getFunctionName()
      Return aggregation function name.
    • getFunctionArgs

      public Value[] getFunctionArgs()
      Return aggregation function arguments.
    • setOperations

      public void setOperations​(Operation[] operations)
      Set operations to be performed on query/execute.
    • getOperations

      public Operation[] 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.