Statements

Quick overview

Statements are what you pass to Session.Execute() and Session.ExecuteAsync().

There are three types:

  • SimpleStatement: a simple implementation built directly from a character string. Typically used for queries that are executed only once or a few times.
  • BoundStatement (from PreparedStatement): obtained by binding values to a prepared query. Typically used for queries that are executed often, with different values.
  • BatchStatement: a statement that groups multiple statements to be executed as a batch.

All statement types share a common set of execution attributes, that can be set through setters:

Note that some attributes can either be set programmatically, or inherit a default value defined in the Builder. We recommended setting these values in the Builder whenever possible (you can create execution profiles to capture common combinations of those options).