Interface PrepareRequest

  • All Superinterfaces:
    Request

    public interface PrepareRequest
    extends Request
    A request to prepare a CQL query.

    Driver clients should rarely have to deal directly with this type, it's used internally by Session's prepare methods. However a RetryPolicy implementation might use it if it needs a custom behavior for prepare requests.

    A client may also provide their own implementation of this interface to customize which attributes are propagated when preparing a simple statement; see SyncCqlSession.prepare(SimpleStatement) for more explanations.

    • Method Detail

      • getQuery

        @NonNull
        String getQuery()
        The CQL query to prepare.
      • isIdempotent

        @NonNull
        default Boolean isIdempotent()
        Whether the request is idempotent; that is, whether applying the request twice leaves the database in the same state.

        This is used internally for retries and speculative executions: if a request is not idempotent, the driver will take extra care to ensure that it is not sent twice (for example, don't retry if there is the slightest chance that the request reached a coordinator).

        Note that this refers to the prepare query itself, not to the bound statements that will be created from the prepared statement (see areBoundStatementsIdempotent()).

        Specified by:
        isIdempotent in interface Request
        Returns:
        a boolean value, or null to use the default value defined in the configuration.
        See Also:
        DefaultDriverOption.REQUEST_DEFAULT_IDEMPOTENCE
      • getExecutionProfileNameForBoundStatements

        @Nullable
        String getExecutionProfileNameForBoundStatements()
        The name of the execution profile to use for the bound statements that will be created from the prepared statement.

        Note that this will be ignored if getExecutionProfileForBoundStatements() returns a non-null value.

      • getExecutionProfileForBoundStatements

        @Nullable
        DriverExecutionProfile getExecutionProfileForBoundStatements()
        The execution profile to use for the bound statements that will be created from the prepared statement.
      • getRoutingKeyspaceForBoundStatements

        CqlIdentifier getRoutingKeyspaceForBoundStatements()
        The routing keyspace to use for the bound statements that will be created from the prepared statement.
      • getRoutingKeyForBoundStatements

        ByteBuffer getRoutingKeyForBoundStatements()
        The routing key to use for the bound statements that will be created from the prepared statement.
      • getRoutingTokenForBoundStatements

        Token getRoutingTokenForBoundStatements()
        The routing key to use for the bound statements that will be created from the prepared statement.

        If it's not null, it takes precedence over getRoutingKeyForBoundStatements().

      • getCustomPayloadForBoundStatements

        @NonNull
        Map<String,​ByteBuffer> getCustomPayloadForBoundStatements()
        Returns the custom payload to send alongside the bound statements that will be created from the prepared statement.
      • areBoundStatementsIdempotent

        @Nullable
        Boolean areBoundStatementsIdempotent()
        Whether bound statements that will be created from the prepared statement are idempotent.

        This follows the same semantics as isIdempotent().

      • getTimeoutForBoundStatements

        @Nullable
        Duration getTimeoutForBoundStatements()
        The timeout to use for the bound statements that will be created from the prepared statement. If the value is null, the default value will be used from the configuration.
      • getPagingStateForBoundStatements

        ByteBuffer getPagingStateForBoundStatements()
        The paging state to use for the bound statements that will be created from the prepared statement.
      • getPageSizeForBoundStatements

        int getPageSizeForBoundStatements()
        The page size to use for the bound statements that will be created from the prepared statement. If the value is 0 or negative, the default value will be used from the configuration.
      • getConsistencyLevelForBoundStatements

        @Nullable
        ConsistencyLevel getConsistencyLevelForBoundStatements()
        The consistency level to use for the bound statements that will be created from the prepared statement or null to use the default value from the configuration.
      • getSerialConsistencyLevelForBoundStatements

        @Nullable
        ConsistencyLevel getSerialConsistencyLevelForBoundStatements()
        The serial consistency level to use for the bound statements that will be created from the prepared statement or null to use the default value from the configuration.
      • areBoundStatementsTracing

        boolean areBoundStatementsTracing()
        Whether bound statements that will be created from the prepared statement are tracing.