Visitar URL original
Seq (SQLProvider) | SQLProvider

SQLProvider

Seq Module

Functions and values

Function or value Description

``deleteallitemsfromsingletable`` _arg1

Full Usage: ``deleteallitemsfromsingletable`` _arg1

Parameters:
Returns: Task<int>
Type parameters: 'T

WARNING! Execute SQLProvider DELETE FROM query to remove elements from the database.

_arg1 : IQueryable<'T>
Returns: Task<int>

averageAsync

Full Usage: averageAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T (requires comparison)

Execute SQLProvider query to get the avg of elements, and release the OS thread while query is being executed.

Returns: IQueryable<'T> -> Task<'T>

exactlyOneAsync

Full Usage: exactlyOneAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T

Execute SQLProvider query to get the only element of the sequence. Throws `ArgumentNullException` if the seq is empty. Throws `ArgumentException` if the seq contains more than one element.

Returns: IQueryable<'T> -> Task<'T>

executeQueryAsync

Full Usage: executeQueryAsync

Returns: IQueryable<'a> -> Task<'a seq>
Type parameters: 'a

Execute SQLProvider query and release the OS thread while query is being executed.

Returns: IQueryable<'a> -> Task<'a seq>

headAsync

Full Usage: headAsync

Returns: IQueryable<'a> -> Task<'a>
Type parameters: 'a

Execute SQLProvider query to take one result and release the OS thread while query is being executed. Like normal head: Throws exception if no elements exists. See also tryHeadAsync.

Returns: IQueryable<'a> -> Task<'a>

lengthAsync

Full Usage: lengthAsync

Returns: IQueryable<'a> -> Task<int>
Type parameters: 'a

Execute SQLProvider query to count the elements, and release the OS thread while query is being executed.

Returns: IQueryable<'a> -> Task<int>

lockForUpdate query

Full Usage: lockForUpdate query

Parameters:
    query : IQueryable<'T> - A SQLProvider query of a table's rows, joined ones too; not distinct, grouped, counted, aggregated or a union, and not a part of another query (a sub-query, a join's table) or a delete.

Returns: IQueryable<'T> The query, locking its rows when any executor runs it. A queryable that isn't a database query, such as a mock context's, comes back as it is; a SQLProvider query behind an in-memory step (Seq.map, then AsQueryable) is refused, as its rows couldn't be locked.
Type parameters: 'T

Marks a query to lock the rows it reads until the transaction ends, against lost updates: another transaction that locks, changes or deletes one of them waits until this one commits or rolls back.

Run it inside a transaction: a TransactionScope, with TransactionScopeAsyncFlowOption.Enabled in async code. Outside one the lock ends with the query. PostgreSQL, MySQL and Oracle write FOR UPDATE (PostgreSQL not the rows of a left-outer-joined table; Oracle not with skip, nor with take or head after a sort), Firebird FOR UPDATE WITH LOCK (one table, no joins), SQL Server the UPDLOCK and ROWLOCK table hints; SQLite, MS Access, DuckDB and ODBC have no row locks and refuse it. See "Locking rows" in the documentation.

query : IQueryable<'T>

A SQLProvider query of a table's rows, joined ones too; not distinct, grouped, counted, aggregated or a union, and not a part of another query (a sub-query, a join's table) or a delete.

Returns: IQueryable<'T>

The query, locking its rows when any executor runs it. A queryable that isn't a database query, such as a mock context's, comes back as it is; a SQLProvider query behind an in-memory step (Seq.map, then AsQueryable) is refused, as its rows couldn't be locked.

Example

 use scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)
 let! order = query { for o in ctx.Main.Orders do where (o.OrderId = id); select o } |> Seq.lockForUpdateHeadAsync
 order.Freight <- order.Freight + 1m
 do! ctx.SubmitUpdatesAsync()
 scope.Complete()
val scope: obj
val order: obj
val query: Linq.QueryBuilder
val o: obj
custom operation: where (bool) Calls Linq.QueryBuilder.Where
val id: x: 'T -> 'T
custom operation: select ('Result) Calls Linq.QueryBuilder.Select
module Seq from Microsoft.FSharp.Collections

lockForUpdateAsync query

Full Usage: lockForUpdateAsync query

Parameters:
    query : IQueryable<'T> - The query, as lockForUpdate takes it.

Returns: Task<'T seq> The rows read, each locked.
Type parameters: 'T

Runs a query with its rows locked until the transaction ends (see lockForUpdate), releasing the OS thread while the database works.

query : IQueryable<'T>

The query, as lockForUpdate takes it.

Returns: Task<'T seq>

The rows read, each locked.

lockForUpdateHeadAsync query

Full Usage: lockForUpdateHeadAsync query

Parameters:
    query : IQueryable<'T> - The query, as lockForUpdate takes it.

Returns: Task<'T> The row, locked. Fails when the query reads no rows; see lockForUpdateTryHeadAsync.
Type parameters: 'T

Reads the query's first row, locked until the transaction ends (see lockForUpdate), releasing the OS thread while the database works.

Oracle refuses it after a sort.

query : IQueryable<'T>

The query, as lockForUpdate takes it.

Returns: Task<'T>

The row, locked. Fails when the query reads no rows; see lockForUpdateTryHeadAsync.

lockForUpdateTryHeadAsync query

Full Usage: lockForUpdateTryHeadAsync query

Parameters:
    query : IQueryable<'T> - The query, as lockForUpdate takes it.

Returns: Task<'T option> The row, locked, or None when the query reads no rows.
Type parameters: 'T

Reads the query's first row, if any, locked until the transaction ends (see lockForUpdate), releasing the OS thread while the database works.

Oracle refuses it after a sort.

query : IQueryable<'T>

The query, as lockForUpdate takes it.

Returns: Task<'T option>

The row, locked, or None when the query reads no rows.

maxAsync

Full Usage: maxAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T (requires comparison)

Execute SQLProvider query to get the max of elements, and release the OS thread while query is being executed.

Returns: IQueryable<'T> -> Task<'T>

minAsync

Full Usage: minAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T (requires comparison)

Execute SQLProvider query to get the min of elements, and release the OS thread while query is being executed.

Returns: IQueryable<'T> -> Task<'T>

stdDevAsync

Full Usage: stdDevAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T (requires comparison)

Execute SQLProvider query to get the standard deviation of elements, and release the OS thread while query is being executed.

Returns: IQueryable<'T> -> Task<'T>

sumAsync

Full Usage: sumAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T (requires comparison)

Execute SQLProvider query to get the sum of elements, and release the OS thread while query is being executed.

Returns: IQueryable<'T> -> Task<'T>

tryExactlyOneAsync

Full Usage: tryExactlyOneAsync

Returns: IQueryable<'T> -> Task<'T option>
Type parameters: 'T

Execute SQLProvider query to get the only element of the sequence. Returns `None` if there are zero or more than one element in the seq.

Returns: IQueryable<'T> -> Task<'T option>

tryHeadAsync

Full Usage: tryHeadAsync

Returns: IQueryable<'a> -> Task<'a option>
Type parameters: 'a

Execute SQLProvider query to take one result and release the OS thread while query is being executed. Returns None if no elements exists.

Returns: IQueryable<'a> -> Task<'a option>

varianceAsync

Full Usage: varianceAsync

Returns: IQueryable<'T> -> Task<'T>
Type parameters: 'T (requires comparison)

Execute SQLProvider query to get the variance of elements, and release the OS thread while query is being executed.

Returns: IQueryable<'T> -> Task<'T>

Type something to start searching.