mariaex

Pure Elixir database driver for MariaDB / MySQL

Latest version: 0.9.1 registry icon
Maintenance score
0
Safety score
0
Popularity score
75
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High
0.9.1 0 0 0 0
0.9.0 0 0 0 0
0.9.0-rc.0 0 0 0 0
0.8.4 0 0 0 0
0.8.3 0 0 0 0
0.8.2 0 0 0 0
0.8.1 0 0 0 0
0.8.0 0 0 0 0
0.7.9 0 0 0 0
0.7.8 0 0 0 0
0.7.7 0 0 0 0
0.7.6 0 0 0 0
0.7.5 0 0 0 0
0.7.4 0 0 0 0
0.7.3 0 0 0 0
0.7.2 0 0 0 0
0.7.1 0 0 0 0
0.7.0 0 0 0 0
0.6.5 0 0 0 0
0.6.4 0 0 0 0
0.6.3 0 0 0 0
0.6.2 0 0 0 0
0.6.1 0 0 0 0
0.6.0 0 0 0 0
0.5.0 0 0 0 0
0.4.4 0 0 0 0
0.4.3 0 0 0 0
0.4.2 0 0 0 0
0.4.1 0 0 0 0
0.4.0 0 0 0 0
0.3.2 0 0 0 0
0.3.1 0 0 0 0
0.3.0 0 0 0 0
0.2.2 0 0 0 0
0.2.1 0 0 0 0
0.2.0 0 0 0 0
0.1.7 0 0 0 0
0.1.6 0 0 0 0
0.1.5 0 0 0 0
0.1.4 0 0 0 0
0.1.3 0 0 0 0
0.1.2 0 0 0 0
0.1.1 0 0 0 0
0.1.0 0 0 0 0

Stability
Latest release:

0.9.1 - this version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant



Mariaex Build Status Coverage Status Deps Status

Usage

Add Mariaex as a dependency in your mix.exs file.

def deps do
  [{:mariaex, "~> 0.8.2"} ]
end

After you are done, run mix deps.get in your shell to fetch and compile Mariaex. Start an interactive Elixir shell with iex -S mix.

  iex(1)> {:ok, p} = Mariaex.start_link(username: "ecto", database: "ecto_test")
  {:ok, #PID<0.108.0>}

  iex(2)> Mariaex.query(p, "CREATE TABLE test1 (id serial, title text)")
  {:ok, %Mariaex.Result{columns: [], command: :create, num_rows: 0, rows: []}}

  iex(3)> Mariaex.query(p, "INSERT INTO test1 VALUES(1, 'test')")
  {:ok, %Mariaex.Result{columns: [], command: :insert, num_rows: 1, rows: []}}

  iex(4)> Mariaex.query(p, "INSERT INTO test1 VALUES(2, 'test2')")
  {:ok, %Mariaex.Result{columns: [], command: :insert, num_rows: 1, rows: []}}

  iex(5)> Mariaex.query(p, "SELECT id, title FROM test1")
  {:ok,
   %Mariaex.Result{columns: ["id", "title"], command: :select, num_rows: 2,
    rows: [[1, "test"], [2, "test2"]}}

Configuration

Important configuration, which depends on used charset for support unicode chars, see :binary_as in Mariaex.start_link/1

JSON library

As default, Poison is used for JSON library in mariaex to support JSON column.

If you want to use another library, please set config.exs like below.

config :mariaex, json_library: SomeLibrary

=======

Data representation

MySQL                 Elixir
----------            ------
NULL                  nil
TINYINT               42
INT                   42
BIGINT                42
FLOAT                 42.0
DOUBLE                42.0
DECIMAL               #Decimal<42.0> *
VARCHAR               "eric"
TEXT                  "eric"
BLOB                  <<42>>
DATE                  %Date{year: 2013, month: 10, day: 12}
TIME                  %Time{hour: 0, minute: 37, second: 14} **
YEAR                  2013
DATETIME              %DateTime{year: 2013 month: 10, day: 12, hour: 0, minute: 37, second: 14} **
TIMESTAMP             %DateTime{year: 2013 month: 10, day: 12, hour: 0, minute: 37, second: 14} **
BIT                   << 1 >>
GEOMETRY/POINT        %Mariaex.Geometry.Point{coordinates: {1.0, -1.0}, srid: 42}
GEOMETRY/LINESTRING   %Mariaex.Geometry.LineString{coordinates: [{0.0, 0.0}, {10.0, 10.0}, {20.0, 25.0}, {50.0, 60.0}], srid: 0}
GEOMETRY/POLYGON      %Mariaex.Geometry.Polygon{coordinates: [[{0.0, 0.0}, {10.0, 0.0}, {10.0, 10.0}, {0.0, 10.0}, {0.0, 0.0}], [{5.0, 5.0}, {7.0, 5.0}, {7.0, 7.0}, {5.0, 7.0}, {5.0, 5.0}]], srid: 0}