Skip to content

Instantly share code, notes, and snippets.

@siscia
Created December 21, 2015 22:45
Show Gist options
  • Select an option

  • Save siscia/be9859d464f286bede92 to your computer and use it in GitHub Desktop.

Select an option

Save siscia/be9859d464f286bede92 to your computer and use it in GitHub Desktop.
simo@simo:~/numerino$ iex -S mix
Erlang/OTP 18 [erts-7.2] [source] [64-bit] [smp:8:8] [async-threads:10] [kernel-poll:false]
Interactive Elixir (1.1.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> {:ok, conn} = :esqlite3.open('testGabri.sqlite')
{:ok, {:connection, #Reference<0.0.7.160>, ""}}
iex(2)> :esqlite3.exec('CREATE TABLE simple (message TEXT)', conn)
:ok
iex(3)> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn)
:ok
iex(4)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{100136, :ok}
iex(5)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{104288, :ok}
iex(6)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{97510, :ok}
iex(7)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{98690, :ok}
iex(8)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{100771, :ok}
iex(9)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{105275, :ok}
iex(10)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{106096, :ok}
iex(11)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{110191, :ok}
iex(12)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{101280, :ok}
iex(13)> :timer.tc(fn -> :esqlite3.exec('INSERT INTO simple (message) VALUES (\"test\")', conn) end)
{105727, :ok}
iex(14)> :timer.tc(fn -> :esqlite3.exec('BEGINN; COMMIT;', conn) end)
{351, {:error, {:sqlite_error, 'near "BEGINN": syntax error'}}}
iex(15)> :timer.tc(fn -> :esqlite3.exec('BEGIN; COMMIT;', conn) end)
{272, :ok}
iex(16)> :timer.tc(fn -> :esqlite3.exec('BEGIN; COMMIT;', conn) end)
{265, :ok}
iex(17)> :timer.tc(fn -> :esqlite3.exec('BEGIN; COMMIT;', conn) end)
{282, :ok}
iex(18)> {:ok, stat} = :esqlite3.prepare('INSERT INTO simple (message) VALUES (\"test\")', conn)
{:ok, ""}
iex(19)> :esqlite3.bind(stat, [])
:ok
iex(20)> :esqlite3.bind(stat, [])
:ok
iex(21)> :esqlite3.bind(stat, [])
:ok
iex(22)> :timer.tc(fn -> :esqlite3.step(stat) end)
{97920, :"$done"}
iex(23)> {:ok, stat} = :esqlite3.prepare('INSERT INTO simple (message) VALUES (\?)', conn)
{:ok, ""}
iex(24)> :esqlite3.bind(stat, ["test"])
:ok
iex(25)> :esqlite3.bind(stat, ["test1"])
:ok
iex(26)> :esqlite3.bind(stat, ["test2"])
:ok
iex(27)> :esqlite3.bind(stat, ["test3"])
:ok
iex(28)> :timer.tc(fn -> :esqlite3.step(stat) end)
{101666, :"$done"}
iex(29)>
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment