Class DefaultPreparedStatement

    • Method Detail

      • isSkipMetadata

        public boolean isSkipMetadata()
      • bind

        public BoundStatement bind​(Object... values)
        Description copied from interface: PreparedStatement
        Creates a new BoundStatement object and bind its variables to the provided values.

        While the number of values cannot be greater than the number of bound variables, the number of values may be fewer than the number of bound variables. In that case, the remaining variables will have to be bound to values by another mean because the resulting BoundStatement being executable.

        This method is a convenience for new BoundStatement(this).bind(...).

        Specified by:
        bind in interface PreparedStatement
        Parameters:
        values - the values to bind to the variables of the newly created BoundStatement.
        Returns:
        the newly created BoundStatement with its variables bound to values.
        See Also:
        BoundStatement.bind(java.lang.Object...)
      • getRoutingKey

        public ByteBuffer getRoutingKey()
        Description copied from interface: PreparedStatement
        Returns the routing key set for this query.
        Specified by:
        getRoutingKey in interface PreparedStatement
        Returns:
        the routing key for this query or null if none has been explicitly set on this PreparedStatement.
      • setConsistencyLevel

        public PreparedStatement setConsistencyLevel​(ConsistencyLevel consistency)
        Description copied from interface: PreparedStatement
        Sets a default consistency level for all bound statements created from this prepared statement.

        If no consistency level is set through this method, the bound statement created from this object will use the default consistency level (LOCAL_ONE).

        Changing the default consistency level is not retroactive, it only applies to BoundStatement created after the change.

        Specified by:
        setConsistencyLevel in interface PreparedStatement
        Parameters:
        consistency - the default consistency level to set.
        Returns:
        this PreparedStatement object.
      • setSerialConsistencyLevel

        public PreparedStatement setSerialConsistencyLevel​(ConsistencyLevel serialConsistency)
        Description copied from interface: PreparedStatement
        Sets a default serial consistency level for all bound statements created from this prepared statement.

        If no serial consistency level is set through this method, the bound statement created from this object will use the default serial consistency level (SERIAL).

        Changing the default serial consistency level is not retroactive, it only applies to BoundStatement created after the change.

        Specified by:
        setSerialConsistencyLevel in interface PreparedStatement
        Parameters:
        serialConsistency - the default serial consistency level to set.
        Returns:
        this PreparedStatement object.
      • getQueryString

        public String getQueryString()
        Description copied from interface: PreparedStatement
        Returns the string of the query that was prepared to yield this PreparedStatement.

        Note that a CQL3 query may be implicitly applied to the current keyspace (that is, if the keyspace is not explicitly qualified in the query itself). For prepared queries, the current keyspace used is the one at the time of the preparation, not the one at execution time. The current keyspace at the time of the preparation can be retrieved through PreparedStatement.getQueryKeyspace().

        Specified by:
        getQueryString in interface PreparedStatement
        Returns:
        the query that was prepared to yield this PreparedStatement.
      • getQueryKeyspace

        public String getQueryKeyspace()
        Description copied from interface: PreparedStatement
        Returns the keyspace at the time that this prepared statement was prepared, (that is the one on which this statement applies unless it specified a keyspace explicitly).
        Specified by:
        getQueryKeyspace in interface PreparedStatement
        Returns:
        the keyspace at the time that this statement was prepared or null if no keyspace was set when the query was prepared (which is possible since keyspaces can be explicitly qualified in queries and so may not require a current keyspace to be set).
      • isTracing

        public boolean isTracing()
        Description copied from interface: PreparedStatement
        Returns whether tracing is enabled for this prepared statement, i.e. if BoundStatement created from it will use tracing by default.
        Specified by:
        isTracing in interface PreparedStatement
        Returns:
        true if this prepared statement has tracing enabled, false otherwise.
      • setRetryPolicy

        public PreparedStatement setRetryPolicy​(RetryPolicy policy)
        Description copied from interface: PreparedStatement
        Convenience method to set a default retry policy for the BoundStatement created from this prepared statement.

        Note that this method is completely optional. By default, the retry policy used is the one returned Policies.getRetryPolicy() in the cluster configuration. This method is only useful if you want to override this default policy for the BoundStatement created from this PreparedStatement. to punctually override the default policy for this request.

        Specified by:
        setRetryPolicy in interface PreparedStatement
        Parameters:
        policy - the retry policy to use for this prepared statement.
        Returns:
        this PreparedStatement object.
      • getRetryPolicy

        public RetryPolicy getRetryPolicy()
        Description copied from interface: PreparedStatement
        Returns the retry policy sets for this prepared statement, if any.
        Specified by:
        getRetryPolicy in interface PreparedStatement
        Returns:
        the retry policy sets specifically for this prepared statement or null if none have been set.
      • getPartitioner

        public com.datastax.driver.core.Token.Factory getPartitioner()
        Description copied from interface: PreparedStatement
        The partitioner for this prepared statement.
        Specified by:
        getPartitioner in interface PreparedStatement
        Returns:
        the partitioner for this query, or null if no partitioner has been specified. In the latter case, the cluster-wide partitioner will be used.
      • getIncomingPayload

        public Map<String,​ByteBuffer> getIncomingPayload()
        Description copied from interface: PreparedStatement
        Return the incoming payload, that is, the payload that the server sent back with its PREPARED response, if any, or null, if the server did not include any custom payload.

        Note that if an incoming payload is present, and if no outgoing payload has been explicitly set, then each time a BoundStatement is created (with either PreparedStatement.bind() or PreparedStatement.bind(Object...)), the resulting BoundStatement will inherit from this value as its default outgoing payload.

        Implementors should return a read-only view of the original map, but even though, its values would remain inherently mutable. Callers should take care not to modify the returned map in any way.

        This feature is only available with ProtocolVersion.V4 or above; with lower versions, this method will always return null.

        Specified by:
        getIncomingPayload in interface PreparedStatement
        Returns:
        the custom payload that the server sent back with its response, if any, or null, if the server did not include any custom payload.
      • isLWT

        public boolean isLWT()
        Whether a prepared statement is LWT statement
        Specified by:
        isLWT in interface PreparedStatement