@@ -11,16 +11,16 @@ that returns a valid, live database connection that can be queried against.
1111"""
1212function connect end
1313
14- connect (T, args... ; kw... ) = throw (NotImplementedError (" `DBInterface.connect` not implemented for `$T `" ))
14+ # Different `close!` signatures have their own docstrings.
15+ function close! end
1516
1617"""
1718 DBInterface.close!(conn::DBInterface.Connection)
1819
1920Immediately closes a database connection so further queries cannot be processed.
2021"""
21- function close! end
22+ close! (conn :: Connection )
2223
23- close! (conn:: Connection ) = throw (NotImplementedError (" `DBInterface.close!` not implemented for `$(typeof (conn)) `" ))
2424
2525" Database packages should provide a `DBInterface.Statement` subtype which represents a valid, prepared SQL statement that can be executed repeatedly"
2626abstract type Statement end
@@ -38,7 +38,6 @@ which is often convenient when building applications.
3838"""
3939function prepare end
4040
41- prepare (conn:: Connection , sql:: AbstractString ) = throw (NotImplementedError (" `DBInterface.prepare` not implemented for `$(typeof (conn)) `" ))
4241prepare (f:: Function , sql:: AbstractString ) = prepare (f (), sql)
4342
4443const PREPARED_STMTS = Dict {Symbol, Statement} ()
@@ -79,8 +78,6 @@ For use-cases involving multiple resultsets from a single query, see `DBInterfac
7978"""
8079function execute end
8180
82- execute (stmt:: Statement , params= ()) = throw (NotImplementedError (" `DBInterface.execute` not implemented for `$(typeof (stmt)) `" ))
83-
8481execute (conn:: Connection , sql:: AbstractString , params= ()) = execute (prepare (conn, sql), params)
8582
8683struct LazyIndex{T} <: AbstractVector{Any}
@@ -138,28 +135,23 @@ executemultiple(conn::Connection, sql::AbstractString, params=()) = executemulti
138135
139136Close a prepared statement so further queries cannot be executed.
140137"""
141- close! (stmt:: Statement ) = throw ( NotImplementedError ( " `DBInterface.close!` not implemented for ` $( typeof (stmt)) ` " ))
138+ close! (stmt:: Statement )
142139
143140"""
144141 DBInterface.lastrowid(x::Cursor) => Int
145142
146143If supported by the specific database cursor, returns the last inserted row id after executing an INSERT statement.
147144"""
148- lastrowid ( :: T ) where {T} = throw ( NotImplementedError ( " `DBInterface. lastrowid` not implemented for $T " ))
145+ function lastrowid end
149146
150147"""
151148 DBInterface.close!(x::Cursor) => Nothing
152149
153150Immediately close a resultset cursor. Database packages should overload for the provided resultset `Cursor` object.
154151"""
155- close! (x) = throw ( NotImplementedError ( " `DBInterface.close!` not implemented for ` $( typeof (x)) ` " ) )
152+ close! (x:: Cursor )
156153
157154# exception handling
158- " Error for signaling a database package hasn't implemented an interface method"
159- struct NotImplementedError <: Exception
160- msg:: String
161- end
162-
163155" Error for signaling that parameters are used inconsistently or incorrectly."
164156struct ParameterError <: Exception
165157 msg:: String
0 commit comments