Packages
exqlite
0.2.2
0.39.0
0.38.0
0.37.0
0.36.0
0.35.0
0.34.0
0.33.1
0.33.0
0.32.1
0.32.0
0.31.0
0.30.1
0.30.0
0.29.0
0.28.0
0.27.1
0.27.0
0.26.0
0.25.0
0.24.2
0.24.1
0.24.0
0.23.0
0.22.0
0.21.0
0.20.0
0.19.0
0.18.0
0.17.0
0.16.2
0.16.1
0.16.0
0.15.0
0.14.0
0.13.15
0.13.14
0.13.13
0.13.12
0.13.11
0.13.10
0.13.9
0.13.8
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.0
0.11.9
0.11.8
0.11.7
0.11.6
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.3
0.10.2
0.10.1
0.10.0
0.9.3
0.9.2
0.9.1
0.9.0
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.9
0.7.8
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.11
0.5.10
0.5.9
0.5.8
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.9
0.4.8
0.4.7
0.4.6
0.4.5
0.4.4
0.4.2
0.4.1
0.4.0
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
An Elixir SQLite3 library
Current section
Files
Jump to
Current section
Files
lib/exqlite/pragma.ex
defmodule Exqlite.Pragma do
@moduledoc """
Handles parsing extra options for the SQLite connection
"""
def journal_mode(nil), do: journal_mode([])
def journal_mode(options) do
case Keyword.get(options, :journal_mode, :delete) do
:delete -> "DELETE"
:memory -> "MEMORY"
:off -> "OFF"
:persist -> "PERSIST"
:truncate -> "TRUNCATE"
:wal -> "WAL"
_ -> raise ArgumentError, "invalid :journal_mode"
end
end
def temp_store(nil), do: temp_store([])
def temp_store(options) do
case Keyword.get(options, :temp_store, :default) do
:file -> 1
:memory -> 2
:default -> 0
_ -> raise ArgumentError, "invalid :temp_store"
end
end
def synchronous(nil), do: synchronous([])
def synchronous(options) do
case Keyword.get(options, :synchronous, :normal) do
:extra -> 3
:full -> 2
:normal -> 1
:off -> 0
_ -> raise ArgumentError, "invalid :synchronous"
end
end
def foreign_keys(nil), do: foreign_keys([])
def foreign_keys(options) do
case Keyword.get(options, :foreign_keys, :on) do
:off -> 0
:on -> 1
_ -> raise ArgumentError, "invalid :foreign_keys"
end
end
def cache_size(nil), do: cache_size([])
def cache_size(options) do
Keyword.get(options, :cache_size, -2000)
end
def cache_spill(nil), do: cache_spill([])
def cache_spill(options) do
case Keyword.get(options, :cache_spill, :on) do
:off -> 0
:on -> 1
_ -> raise ArgumentError, "invalid :cache_spill"
end
end
def case_sensitive_like(nil), do: case_sensitive_like([])
def case_sensitive_like(options) do
case Keyword.get(options, :case_sensitive_like, :off) do
:off -> 0
:on -> 1
_ -> raise ArgumentError, "invalid :case_sensitive_like"
end
end
def auto_vacuum(nil), do: auto_vacuum([])
def auto_vacuum(options) do
case Keyword.get(options, :auto_vacuum, :none) do
:none -> 0
:full -> 1
:incremental -> 2
_ -> raise ArgumentError, "invalid :auto_vacuum"
end
end
def locking_mode(nil), do: locking_mode([])
def locking_mode(options) do
case Keyword.get(options, :locking_mode, :normal) do
:normal -> "NORMAL"
:exclusive -> "EXCLUSIVE"
_ -> raise ArgumentError, "invalid :locking_mode"
end
end
def secure_delete(nil), do: secure_delete([])
def secure_delete(options) do
case Keyword.get(options, :secure_delete, :off) do
:off -> 0
:on -> 1
_ -> raise ArgumentError, "invalid :secure_delete"
end
end
def wal_auto_check_point(nil), do: wal_auto_check_point([])
def wal_auto_check_point(options) do
Keyword.get(options, :wal_auto_check_point, 1000)
end
end