Header menu logo Nao

Ado Module

Low-level, provider-agnostic ADO.NET helpers built on System.Data.Common. All SQL uses '@name' parameters (supported by SQLite, SQL Server, PostgreSQL and MySQL providers) and portable DDL (CREATE TABLE IF NOT EXISTS).

Functions and values

Function or value Description

addParam cmd name value

Full Usage: addParam cmd name value

Parameters:

Add a parameter to a command, mapping null to DBNull.

cmd : DbCommand
name : string
value : obj

boolValue b

Full Usage: boolValue b

Parameters:
    b : bool

Returns: obj

Encode a boolean as a portable integer parameter value.

b : bool
Returns: obj

executeNonQuery factory sql parameters

Full Usage: executeNonQuery factory sql parameters

Parameters:
Returns: Task<int>

Execute a non-query statement, returning affected row count.

factory : IDbConnectionFactory
sql : string
parameters : (string * obj) list
Returns: Task<int>

executeTransaction factory statements

Full Usage: executeTransaction factory statements

Parameters:
Returns: Task<unit>

Execute several statements inside a single transaction.

factory : IDbConnectionFactory
statements : (string * (string * obj) list) list
Returns: Task<unit>

getBool r col

Full Usage: getBool r col

Parameters:
Returns: bool

Read a boolean column (stored as integer 0/1 for portability).

r : DbDataReader
col : string
Returns: bool

getString r col

Full Usage: getString r col

Parameters:
Returns: string

Read a non-null string column by name.

r : DbDataReader
col : string
Returns: string

getStringOpt r col

Full Usage: getStringOpt r col

Parameters:
Returns: string option

Read a nullable string column by name.

r : DbDataReader
col : string
Returns: string option

query factory sql parameters map

Full Usage: query factory sql parameters map

Parameters:
Returns: Task<'a list>

Run a query and project each row with the supplied mapper.

factory : IDbConnectionFactory
sql : string
parameters : (string * obj) list
map : DbDataReader -> 'a
Returns: Task<'a list>

Type something to start searching.