Skip to content
forked from xerions/mariaex

Pure elixir database driver for Mariadb / Mysql

License

Notifications You must be signed in to change notification settings

mtokioka/mariaex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mariaex Build Status Coverage Status Deps Status

Usage

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

def deps do
  [{:mariaex, "~> 0.7.3"} ]
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

About

Pure elixir database driver for Mariadb / Mysql

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 100.0%