JuliaDatabases / DBInterface.jl

Database interface definitions for Julia
https://juliadatabases.org/DBInterface.jl/dev/
Other
84 stars 12 forks source link

Additional prepare method and lastrowid function #20

Closed quinnj closed 4 years ago

quinnj commented 4 years ago

Adds a method:

DBInterface.prepare(f::Function, sql) = ...

where calling f() should return a DBInterface.Connection. This is convenient in applications where the Connection is more dynamic and should be retrieved at runtime.

Also adds a convenience macro:

DBInterface.@prepare getDB sql

That expands to checking if sql has been prepared and cached yet and if not, calls the new prepare function with the getDB function.

2nd commit adds a new interface method DBInterface.lastrowid(x::Cursor) for databases that support this.