Skip to content

Commit fa6b2eb

Browse files
committed
mv named param @doc example higher
1 parent 8ff7dd5 commit fa6b2eb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

lib/exqlite/sqlite3.ex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ defmodule Exqlite.Sqlite3 do
158158
iex> Sqlite3.step(conn, stmt)
159159
{:row, [42, 3.14, "Alice", <<0, 0, 0>>, nil]}
160160
161+
iex> {:ok, conn} = Sqlite3.open(":memory:", [:readonly])
162+
iex> {:ok, stmt} = Sqlite3.prepare(conn, "SELECT :42, @pi, $name, @blob, :null")
163+
iex> Sqlite3.bind(stmt, %{":42" => 42, "@pi" => 3.14, "$name" => "Alice", :"@blob" => {:blob, <<0, 0, 0>>}, ~c":null" => nil})
164+
iex> Sqlite3.step(conn, stmt)
165+
{:row, [42, 3.14, "Alice", <<0, 0, 0>>, nil]}
166+
161167
iex> {:ok, conn} = Sqlite3.open(":memory:", [:readonly])
162168
iex> {:ok, stmt} = Sqlite3.prepare(conn, "SELECT ?")
163169
iex> Sqlite3.bind(stmt, [42, 3.14, "Alice"])
@@ -173,12 +179,6 @@ defmodule Exqlite.Sqlite3 do
173179
iex> Sqlite3.bind(stmt, [:erlang.list_to_pid(~c"<0.0.0>")])
174180
** (ArgumentError) unsupported type: #PID<0.0.0>
175181
176-
iex> {:ok, conn} = Sqlite3.open(":memory:", [:readonly])
177-
iex> {:ok, stmt} = Sqlite3.prepare(conn, "SELECT :a, @b, $c")
178-
iex> Sqlite3.bind(stmt, %{":a" => 42, "@b" => "Alice", "$c" => nil})
179-
iex> Sqlite3.step(conn, stmt)
180-
{:row, [42, "Alice", nil]}
181-
182182
"""
183183
@spec bind(
184184
statement,
@@ -229,6 +229,7 @@ defmodule Exqlite.Sqlite3 do
229229

230230
defp bind_all_named([], _stmt), do: :ok
231231

232+
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
232233
defp do_bind(stmt, idx, param) do
233234
case convert(param) do
234235
i when is_integer(i) -> bind_integer(stmt, idx, i)

0 commit comments

Comments
 (0)