JuliaDatabases / MySQL.jl

Access MySQL from Julia
https://juliadatabases.github.io/MySQL.jl/dev
Other
106 stars 36 forks source link

UndefVarError: `execute` not defined #216

Open kafisatz opened 4 months ago

kafisatz commented 4 months ago

Recently, MySQL.transaction(conn) do is not working anymore for me. I am not sure if this is related to DBInterface.jl or MySQL.jl

If I explicitly qualify execute as DBInterface.execute(conn, "START TRANSACTION") in the function definition of transaction things work just fine.

including @quinnj as there were recent changes to transaction

here is an MWE

dbc = (username="admin",db="fortuna",hostname="mill-zur-fs2",pw="some_password")

dr = tempdir()
using Pkg
Pkg.activate(dr)
Pkg.add("MySQL")

using MySQL

conn = MySQL.DBInterface.connect(MySQL.Connection, dbc.hostname, dbc.username,dbc.pw,db=dbc.db)
#dftest001 = DBInterface.execute(conn, "SELECT * FROM testtable limit 3") |> DataFrame

txt = """CREATE TABLE test001 (
  `ab` VARCHAR(45) NULL,
  `cd` INT NULL);
  """

dftest001 = DBInterface.execute(conn, txt) |> DataFrame

MySQL.transaction(conn) do
    rs = """INSERT INTO test001 (ab, cd) VALUES ('ab',1),('axxb',11);""" 
    DBInterface.execute(conn,rs);
end

ERROR: UndefVarError: `execute` not defined
Stacktrace:
 [1] transaction(f::var"#27#28", conn::MySQL.Connection)
   @ MySQL C:\Users\bernhard.konig\.julia\packages\MySQL\pGOcg\src\load.jl:108
 [2] top-level scope
   @ REPL[121]:1
quinnj commented 4 months ago

This should have been fixed in the 1.4.5 release; can you double check your version?