11[ ![ CircleCI] ( https://circleci.com/gh/Sqlite-Ecto/elixir_sqlite.svg?style=svg )] ( https://circleci.com/gh/Sqlite-Ecto/elixir_sqlite )
22[ ![ Coverage Status] ( https://coveralls.io/repos/github/Sqlite-Ecto/elixir_sqlite/badge.svg?branch=master )] ( https://coveralls.io/github/Sqlite-Ecto/elixir_sqlite?branch=master )
3+ [ ![ Inline docs] ( http://inch-ci.org/github/Sqlite-Ecto/elixir_sqlite.svg )] ( http://inch-ci.org/github/Sqlite-Ecto/elixir_sqlite )
4+ [ ![ Hex.pm] ( https://img.shields.io/hexpm/v/elixir_sqlite.svg )] ( https://hex.pm/packages/elixir_sqlite )
5+ [ ![ Hex.pm] ( https://img.shields.io/hexpm/dt/elixir_sqlite.svg )] ( https://hex.pm/packages/elixir_sqlite )
6+
37
48# Sqlite
59Elixir API for interacting with SQLite databases.
@@ -17,13 +21,11 @@ the command has been added to the command-queue of the thread.
1721
1822# Usage
1923``` elixir
20- alias Sqlite .Connection
21- {:ok , database} = Connection .open (database: " /tmp/database.sqlite3" )
22- {:ok , statement} = Connection .prepare (database, " CREATE TABLE data (id int, data text)" )
23- {:ok , _ } = Connection .execute (database, statement, [])
24- {:ok , statement} = Connection .prepare (database, " INSERT INTO data (data) VALUES ($1)" )
25- {:ok , _ } = Connection .execute (database, statement, [" neat!" ])
26- {:ok , %Sqlite .Result {columns: [:data ], num_rows: 1 , rows: [[" neat!" ]]}} = Connection .query (database, " SELECT data FROM data" , [])
24+ {:ok , db} = Sqlite .open (" :memory:" )
25+ Sqlite .exec (" create virtual table test_table using fts3(content text);" , db)
26+ :ok = Sqlite .exec (" create table test_table(one varchar(10), two int);" , db)
27+ :ok = Sqlite .exec ([" insert into test_table values(" , " \" hello1\" " , " ," , " 10);" ], db)
28+ {:ok , 1 } = Sqlite .changes (db)
2729```
2830
2931# Tests
0 commit comments