Dearests,
I have a connect
problem with MySQL.jl
. I’m writing a module that do some custom queries to a local mysql database. It looks like:
module PfamDatabaseTools
global connection = MySQL.connect("127.0.0.1","myname","mypasswd")
include("file1.jl")
...
include("fileN.jl")
println(connection)
end #end module
Now I activate the package (]activate .
) and after precompilation I see correctly printed on screen
a regular connection
Host: 127.0.0.1
Port: 3306
User: myname
DB:
Now the problem is that if I now try to see what happens to my connection I get a
julia> PfamDatabaseTools.connection
Null MySQL Connection
I tryed to change global
into const
, but same result. Note that if I do the same outside the module by squeezing all file*jl
into a single file, and opening the connection at the beginning of the file, everything works perfectly.
Shooting in the dark, I also tried to GC.@preserve
the connection variable, with no success either. It’s like if at the end of the module precompilation, the connection disappears.
Any ideas?