diff --git a/src/dbinterface.jl b/src/dbinterface.jl index 19a72666..aab00e39 100644 --- a/src/dbinterface.jl +++ b/src/dbinterface.jl @@ -1,9 +1,11 @@ -DBInterface.connect(::Type{Connection}, args...; kws...) = Connection(args...; kws...) - -DBInterface.prepare(conn::Connection, args...; kws...) = prepare(conn, args...; kws...) - -function DBInterface.execute(conn::Union{Connection,Statement}, args...; kws...) - return execute(conn, args...; kws...) +struct DBConnection <: DBInterface.Connection + conn::Connection end -DBInterface.close!(conn::Connection) = close(conn) +DBInterface.connect(::Type{Connection}, args...; kws...) = DBConnection(Connection(args...; kws...)) +DBInterface.prepare(conn::DBConnection, args...; kws...) = prepare(conn.conn, args...; kws...) +DBInterface.execute(conn::DBConnection, args...; kws...) = execute(conn.conn, args...; kws...) +DBInterface.execute(conn::DBConnection, str::AbstractString; kws...) = execute(conn.conn, str; kws...) +DBInterface.execute(conn::DBConnection, str::AbstractString, params; kws...) = execute(conn.conn, str, params; kws...) +DBInterface.execute(stmt::Statement, args...; kws...) = execute(stmt, args...; kws...) +DBInterface.close!(conn::DBConnection) = close(conn) diff --git a/test/runtests.jl b/test/runtests.jl index 6a018f64..3129ad70 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1897,7 +1897,7 @@ end @testset "DBInterface integration" begin conn = DBInterface.connect(LibPQ.Connection, "dbname=postgres user=$DATABASE_USER") - @test conn isa LibPQ.Connection + @test conn isa LibPQ.DBConnection result = DBInterface.execute( conn,