Sqlitex

Summary

close(db)
create_table(db, name, table_opts \\ [], cols)

Create a new table name where table_opts are a list of table constraints and cols are a keyword list of columns. The following table constraints are supported: :temp and :primary_key. Example:

exec(db, sql)
open(path)
query(db, sql, opts \\ [])
with_db(path, fun)

Functions

close(db)
create_table(db, name, table_opts \\ [], cols)

Create a new table name where table_opts are a list of table constraints and cols are a keyword list of columns. The following table constraints are supported: :temp and :primary_key. Example:

[:temp, {:primary_key, [:id]}]

Columns can be passed as:

  • name: :type
  • name: {:type, constraints}

where constraints is a list of column constraints. The following column constraints are supported: :primary_key, :not_null and :autoincrement. Example:

id: :integer, name: {:text, [:not_null]}

exec(db, sql)
open(path)
query(db, sql, opts \\ [])
with_db(path, fun)