@@ -72,7 +72,7 @@ defmodule Sqlitex do
7272
7373 * `action` -> `:insert | :update | :delete`
7474 * `table` -> charlist of the table name. Example: `'posts'`
75- * `rowid` -> internal immutable rowid index of the row.
75+ * `rowid` -> internal immutable rowid index of the row.
7676 This is *NOT* the `id` or `primary key` of the row.
7777 See the [official docs](https://www.sqlite.org/c3ref/update_hook.html).
7878 """
@@ -82,17 +82,38 @@ defmodule Sqlitex do
8282 :esqlite3 . set_update_hook ( pid , db , timeout )
8383 end
8484
85+ @ doc """
86+ Send a raw SQL statement to the database
87+
88+ This function is intended for running fully-complete SQL statements.
89+ No query preparation, or binding of values takes place.
90+ This is generally useful for things like re-playing a SQL export back into the database.
91+ """
8592 @ spec exec ( connection , string_or_charlist ) :: :ok | sqlite_error
8693 @ spec exec ( connection , string_or_charlist , Keyword . t ) :: :ok | sqlite_error
8794 def exec ( db , sql , opts \\ [ ] ) do
8895 timeout = Keyword . get ( opts , :db_timeout , Config . db_timeout ( ) )
8996 :esqlite3 . exec ( sql , db , timeout )
9097 end
9198
99+ @ doc "A shortcut to `Sqlitex.Query.query/3`"
100+ @ spec query ( Sqlitex . connection , String . t | charlist ) :: { :ok , [ [ ] ] } | { :error , term ( ) }
101+ @ spec query ( Sqlitex . connection , String . t | charlist , [ { atom , term } ] ) :: { :ok , [ [ ] ] } | { :error , term ( ) }
92102 def query ( db , sql , opts \\ [ ] ) , do: Sqlitex.Query . query ( db , sql , opts )
103+
104+ @ doc "A shortcut to `Sqlitex.Query.query!/3`"
105+ @ spec query! ( Sqlitex . connection , String . t | charlist ) :: [ [ ] ]
106+ @ spec query! ( Sqlitex . connection , String . t | charlist , [ bind: [ ] , into: Enum . t , db_timeout: integer ( ) ] ) :: [ Enum . t ]
93107 def query! ( db , sql , opts \\ [ ] ) , do: Sqlitex.Query . query! ( db , sql , opts )
94108
109+ @ doc "A shortcut to `Sqlitex.Query.query_rows/3`"
110+ @ spec query_rows ( Sqlitex . connection , String . t | charlist ) :: { :ok , % { } } | Sqlitex . sqlite_error
111+ @ spec query_rows ( Sqlitex . connection , String . t | charlist , [ bind: [ ] , db_timeout: integer ( ) ] ) :: { :ok , % { } } | Sqlitex . sqlite_error
95112 def query_rows ( db , sql , opts \\ [ ] ) , do: Sqlitex.Query . query_rows ( db , sql , opts )
113+
114+ @ doc "A shortcut to `Sqlitex.Query.query_rows!/3`"
115+ @ spec query_rows! ( Sqlitex . connection , String . t | charlist ) :: % { }
116+ @ spec query_rows! ( Sqlitex . connection , String . t | charlist , [ bind: [ ] , db_timeout: integer ( ) ] ) :: % { }
96117 def query_rows! ( db , sql , opts \\ [ ] ) , do: Sqlitex.Query . query_rows! ( db , sql , opts )
97118
98119 @ doc """
0 commit comments