Couchbase .NET SDK __CB_SDK_VERSION__

Show / Hide Table of Contents

Class TransactionQueryOptions

A limited subset of QueryOptions that are usable in Transactions.

Inheritance
object
TransactionQueryOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Couchbase.Client.Transactions.Config
Assembly: Couchbase.NetClient.dll
Syntax
public class TransactionQueryOptions

Constructors

View Source

TransactionQueryOptions()

Declaration
public TransactionQueryOptions()

Methods

View Source

AdHoc(bool)

Allows turning this request into a prepared statement query.

If set to false, the SDK will transparently perform "prepare and execute" logic the first time this query is seen and then subsequently reuse the prepared statement name when sending it to the server. If a query is executed frequently, this is a good way to speed it up since it will save the server the task of re-parsing and analyzing the query.

If you are using prepared statements, make sure that if certain parts of the query string change you are using named or positional parameters. If the statement string itself changes it cannot be cached.

Declaration
public TransactionQueryOptions AdHoc(bool adhoc)
Parameters
Type Name Description
bool adhoc

If set to false this query will be turned into a prepared statement query.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance

View Source

ClientContextId(string)

Supports providing a custom client context ID for this query.

If no client context ID is provided by the user, a UUID is generated and sent automatically so by default it is always possible to identify a query when debugging. If you do not want to send one, pass either null or an empty string to this method.

Declaration
public TransactionQueryOptions ClientContextId(string clientContextId)
Parameters
Type Name Description
string clientContextId

The client context ID - if null or empty it will not be sent.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

FlexIndex(bool)

Sets a value indicating whether or not to use FlexIndex.

Declaration
public TransactionQueryOptions FlexIndex(bool flexIndex)
Parameters
Type Name Description
bool flexIndex

The FlexIndex boolean.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

Parameter(object)

Sets a positional parameter for this query.

Declaration
public TransactionQueryOptions Parameter(object paramValue)
Parameters
Type Name Description
object paramValue

The value to set.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

Parameter(params object[])

Sets multiple parameter values by position.

Declaration
public TransactionQueryOptions Parameter(params object[] values)
Parameters
Type Name Description
object[] values

The values to include.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

Parameter(string, object)

Set a parameter by key and value.

Declaration
public TransactionQueryOptions Parameter(string key, object val)
Parameters
Type Name Description
string key

The key of the parameter.

object val

The value of the parameter.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

PipelineBatch(int)

Supports customizing the number of items execution operators can batch for fetch from the KV layer on the server.

Declaration
public TransactionQueryOptions PipelineBatch(int batchSize)
Parameters
Type Name Description
int batchSize

The pipeline batch size.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance

Remarks

This is an advanced API and should only be tuned with care.

View Source

PipelineCap(int)

Allows customizing the maximum number of items each execution operator can buffer between various operators on the server.

Declaration
public TransactionQueryOptions PipelineCap(int capacity)
Parameters
Type Name Description
int capacity

The pipeline cap size

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance

Remarks

This is an advanced API and should only be tuned with care.

View Source

Profile(QueryProfile)

Declaration
public TransactionQueryOptions Profile(QueryProfile profile)
Parameters
Type Name Description
QueryProfile profile
Returns
Type Description
TransactionQueryOptions
View Source

Raw(string, object)

Allows providing custom JSON key/value pairs for advanced usage.

Declaration
public TransactionQueryOptions Raw(string key, object val)
Parameters
Type Name Description
string key
object val
Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance

View Source

Readonly(bool)

Allows explicitly marking a query as being readonly and not mutating and documents on the server side.

In addition to providing some security in that you are not accidentally modifying data, setting this flag to true also helps the client to more proactively retry and re-dispatch a query since then it can be sure it is idempotent. As a result, if your query is readonly then it is a good idea to set this flag.

If set to true, then (at least) the following statements are not allowed:

  1. CREATE INDEX
  2. DROP INDEX
  3. INSERT
  4. MERGE
  5. UPDATE
  6. UPSERT
  7. DELETE
Declaration
public TransactionQueryOptions Readonly(bool @readonly)
Parameters
Type Name Description
bool readonly

True if readonly should be set, false is the default and will use the server side default.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance

View Source

ScanCap(int)

Supports customizing the maximum buffered channel size between the indexer and the query service.

Declaration
public TransactionQueryOptions ScanCap(int capacity)
Parameters
Type Name Description
int capacity

The scan cap size, use 0 or negative number to disable.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

Remarks

This is an advanced API and should only be tuned with care. Use 0 or a negative number to disable.

View Source

ScanConsistency(QueryScanConsistency)

Sets the Scan Consistency value for this query.

Declaration
public TransactionQueryOptions ScanConsistency(QueryScanConsistency scanConsistency)
Parameters
Type Name Description
QueryScanConsistency scanConsistency

The ScanConsistency value

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

ScanWait(TimeSpan)

Allows customizing how long the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.

Declaration
public TransactionQueryOptions ScanWait(TimeSpan scanWait)
Parameters
Type Name Description
TimeSpan scanWait

The maximum duration the query engine is willing to wait before failing.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

Serializer(ITypeSerializer)

Sets the user-defined TypeSerializer to use for parameter values and results.

Declaration
public TransactionQueryOptions Serializer(ITypeSerializer serializer)
Parameters
Type Name Description
ITypeSerializer serializer

A Type Serializer, such as DefaultJsonSerializer or a custom serializer.

Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance.

View Source

Timeout(TimeSpan)

Declaration
public TransactionQueryOptions Timeout(TimeSpan timeout)
Parameters
Type Name Description
TimeSpan timeout
Returns
Type Description
TransactionQueryOptions

The same TransactionsQueryOptions instance

  • View Source
In this article
Back to top Copyright © 2020 Couchbase, Inc. All rights reserved.