Skip to content

Commit 63dc515

Browse files
authored
Refine docstring of SQLite.Stmt (#311)
1 parent 4f996e9 commit 63dc515

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/SQLite.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function prepare_stmt_wrapper(db::DB, sql::AbstractString)
117117
end
118118

119119
"""
120-
SQLite.Stmt(db, sql) => SQL.Stmt
120+
SQLite.Stmt(db, sql; register = true) => SQL.Stmt
121121
122122
Prepares an optimized internal representation of SQL statement in
123123
the context of the provided SQLite3 `db` and constructs the `SQLite.Stmt`
@@ -127,15 +127,14 @@ Julia object that holds a reference to the prepared statement.
127127
(mainly for usage where the same statement is executed multiple times
128128
with different parameters bound as values).
129129
130-
Internally `SQLite.Stmt` constructor creates the [`SQLite._Stmt`](@ref) object that is managed by `db`.
131-
`SQLite.Stmt` references the `SQLite._Stmt` by its unique id.
132-
133130
The `SQLite.Stmt` will be automatically closed/shutdown when it goes out of scope
134131
(i.e. the end of the Julia session, end of a function call wherein it was created, etc.).
135132
One can also call `DBInterface.close!(stmt)` to immediately close it.
136133
137-
All prepared statements of a given DB connection are also automatically closed when the
138-
DB is disconnected or when [`SQLite.finalize_statements!`](@ref) is explicitly called.
134+
The keyword argument `register` controls whether the created `Stmt` is registered in the
135+
provided SQLite3 database `db`. All registered and unclosed statements of a given DB
136+
connection are automatically closed when the DB is garbage collected or closed explicitly
137+
after calling `close(db)` or `DBInterface.close!(db)`.
139138
"""
140139
mutable struct Stmt <: DBInterface.Statement
141140
db::DB

0 commit comments

Comments
 (0)