Class TransactionQueryOptions
A limited subset of Query
Inherited Members
Namespace: Couchbase.Client.Transactions.Config
Assembly: Couchbase.NetClient.dll
Syntax
public class TransactionQueryOptions
Methods
| Edit this page View SourceAdHoc(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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance |
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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
Parameter(string, object)
Set a parameter by key and value.
Declaration
public TransactionQueryOptions Parameter(string key, object val)
Parameters
Returns
Type | Description |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance |
Remarks
This is an advanced API and should only be tuned with care.
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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance |
Remarks
This is an advanced API and should only be tuned with care.
Raw(string, object)
Allows providing custom JSON key/value pairs for advanced usage.
Declaration
public TransactionQueryOptions Raw(string key, object val)
Parameters
Returns
Type | Description |
---|---|
Transaction |
The same TransactionsQueryOptions instance |
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:
- CREATE INDEX
- DROP INDEX
- INSERT
- MERGE
- UPDATE
- UPSERT
- 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 |
---|---|
Transaction |
The same TransactionsQueryOptions instance |
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 |
---|---|
Transaction |
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.
ScanConsistency(QueryScanConsistency)
Sets the Scan Consistency value for this query.
Declaration
public TransactionQueryOptions ScanConsistency(QueryScanConsistency scanConsistency)
Parameters
Type | Name | Description |
---|---|---|
Query |
scanConsistency | The ScanConsistency value |
Returns
Type | Description |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
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 |
---|---|---|
Time |
scanWait | The maximum duration the query engine is willing to wait before failing. |
Returns
Type | Description |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
Serializer(ITypeSerializer)
Sets the user-defined TypeSerializer to use for parameter values and results.
Declaration
public TransactionQueryOptions Serializer(ITypeSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
IType |
serializer | A Type Serializer, such as DefaultJsonSerializer or a custom serializer. |
Returns
Type | Description |
---|---|
Transaction |
The same TransactionsQueryOptions instance. |
Timeout(TimeSpan)
Declaration
public TransactionQueryOptions Timeout(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
Time |
timeout |
Returns
Type | Description |
---|---|
Transaction |
The same TransactionsQueryOptions instance |