sqlitex v1.0.0 Sqlitex.Query

Summary

Functions

Runs a query and returns the results

Same as query/3 but raises a Sqlitex.QueryError on error

Functions

query(db, sql, opts \\ [])

Specs

query(Sqlitex.connection, String.t | char_list, bind: [], into: Enum.t) ::
  [Enum.t] |
  Sqlitex.sqlite_error

Runs a query and returns the results.

Parameters

  • db - A sqlite database.
  • sql - The query to run as a string.
  • opts - Options to pass into the query. See below for details.

Options

  • bind - If your query has parameters in it, you should provide the options to bind as a list.
  • into - The collection to put results into. This defaults to a list.

Returns

  • [results...] on success
  • {:error, _} on failure.
query!(db, sql, opts \\ [])

Specs

query!(Sqlitex.connection, String.t | char_list, bind: [], into: Enum.t) :: [Enum.t]

Same as query/3 but raises a Sqlitex.QueryError on error.

Returns the results otherwise.