MysqlexPool (mysqlex_pool v0.2.2)

A Simple wrapper around mxsqlex to add pooling

Link to this section Summary

Functions

execute a mysql query

execute a mysql query

Callback implementation for Application.start/2.

Link to this section Functions

Link to this function

query(statement)

Specs

query(String.t()) :: {:ok, Mysqlex.Result.t()} | {:error, any()}

execute a mysql query

Examples

iex>MysqlexPool.query( "SELECT ID, Name FROM `city` WHERE id = 1" )
{ :ok, %Mysqlex.Result{columns: ["ID", "Name"], command: :select, last_insert_id: nil, num_rows: 1, rows: [{1, "Kabul"}] } }
Link to this function

query(statement, params)

Specs

query(String.t(), List.t()) :: {:ok, Mysqlex.Result.t()} | {:error, any()}

execute a mysql query

Examples

iex>MysqlexPool.query( "SELECT ID, Name FROM `city` WHERE id = ?", [ 1 ] )
{ :ok, %Mysqlex.Result{columns: ["ID", "Name"], command: :select, last_insert_id: nil, num_rows: 1, rows: [{1, "Kabul"}] } }
iex>MysqlexPool.query( "SELECT ID, city.Name as City, Population FROM city WHERE city.CountryCode IN ( SELECT country.Code FROM country WHERE Population < ? ) ORDER BY Population desc LIMIT 0,?", [ 50_000, 2 ] )
{ :ok, %Mysqlex.Result{columns: ["ID", "City", "Population"], command: :select, last_insert_id: nil, num_rows: 2, rows: [{915, "Gibraltar", 27025}, {553, "George Town", 19600}] } }
Link to this function

start(type, args)

Specs

start(atom(), :permanent | :transient | :temporary) :: :ok | {:error, term()}

Callback implementation for Application.start/2.

Link to this function

start_link(opts)

Specs

start_link({}) ::
  {:ok, pid()}
  | :ignore
  | {:error, {:already_started, pid()} | {:shutdown, term()} | term()}