glite/connection
Types
Query result with column names and typed rows
pub type QueryResult {
QueryResult(
columns: List(String),
rows: List(List(value.Value)),
)
}
Constructors
-
QueryResult(columns: List(String), rows: List(List(value.Value)))
Result from stepping a prepared statement
pub type StepResult {
Row(List(value.Value))
Done
}
Constructors
-
Row(List(value.Value)) -
Done
Opaque prepared statement handle
pub type StmtHandle
Values
pub fn changes(db: DbHandle) -> Int
Get the number of rows affected by the last INSERT/UPDATE/DELETE
pub fn exec_sql(
db: DbHandle,
sql: String,
) -> Result(Nil, error.Error)
Execute raw SQL without parameters or results (for PRAGMAs, DDL, etc.)
pub fn execute(
db: DbHandle,
sql: String,
params: List(value.Value),
) -> Result(Int, error.Error)
Execute a statement that does not return rows. Returns the number of rows affected.
pub fn execute_many(
db: DbHandle,
sql: String,
params_list: List(List(value.Value)),
) -> Result(Int, error.Error)
Execute a statement many times with different parameter sets. Prepares once, then binds+steps for each param set in one FFI call. Returns the total number of rows affected.
pub fn ffi_changes(db: DbHandle) -> Int
pub fn ffi_last_insert_rowid(db: DbHandle) -> Int
pub fn last_insert_rowid(db: DbHandle) -> Int
Get the rowid of the last inserted row
pub fn open(
config: config.Config,
) -> Result(DbHandle, error.Error)
Open a database and apply configuration PRAGMAs
pub fn query(
db: DbHandle,
sql: String,
params: List(value.Value),
) -> Result(QueryResult, error.Error)
Execute a query and return columns + rows