sqlitex v1.1.0 Sqlitex.Query
Summary
Functions
Runs a query and returns the results
Same as query/3
but raises a Sqlitex.QueryError on error
Runs a query and returns the results as a list of rows each represented as a list of column values
Same as query_rows/3
but raises a Sqlitex.QueryError on error
Functions
Specs
query(Sqlitex.connection, String.t | charlist, 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.
Specs
query!(Sqlitex.connection, String.t | charlist, bind: [], into: Enum.t) :: [Enum.t]
Same as query/3
but raises a Sqlitex.QueryError on error.
Returns the results otherwise.
Specs
query_rows(Sqlitex.connection, String.t | charlist, [{:bind, []}]) ::
{:ok, %{}} |
Sqlitex.sqlite_error
Runs a query and returns the results as a list of rows each represented as a list of column values.
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.
Returns
- {:ok, %{rows: [[1, 2], [2, 3]], columns: [:a, :b], types: [:INTEGER, :INTEGER]}} on success
- {:error, _} on failure.
Specs
query_rows!(Sqlitex.connection, String.t | charlist, [{:bind, []}]) :: [Enum.t]
Same as query_rows/3
but raises a Sqlitex.QueryError on error.
Returns the results otherwise.