ODBC.jl icon indicating copy to clipboard operation
ODBC.jl copied to clipboard

const not defined.

Open FinPl opened this issue 3 years ago • 5 comments

Hello, it seems like the commit 2d61d2 introduces a bug. In fact the const SQL_STILL_EXECUTING as been removed from the const definitions and therefore isn't recognised as a return value.

FinPl avatar Oct 12 '22 15:10 FinPl

@pankgeorg, would you mind taking a look?

quinnj avatar Oct 12 '22 16:10 quinnj

Hey @FinPl ! This constant was defined twice in the file; I thought that was a mistake, that was why I removed it.

image

Can you share some minimal example where this breaks?

Thank you!

pankgeorg avatar Oct 12 '22 17:10 pankgeorg

Ok, my bad, I thought that was the cause of the issue. I'll try to narrow it down.

FinPl avatar Oct 12 '22 17:10 FinPl

Ok, my bad, I thought that was the cause of the issue. I'll try to narrow it down.

If it works on 1.1.1 and not on 1.1.2 it's probably something I did so I really want to help out. Note that 1.1.2 will now throw on runtime errors like DivisionByZero error; the behaviour before was different - you got back the results up to the error.

Anything you can share is valuable!

Thanks, Panagiotis

pankgeorg avatar Oct 12 '22 17:10 pankgeorg

Hello, the problem has nothing to do with the last commit, I am very sorry for that.

It has something to do with the SQL_ATTR_AUTOCOMMIT set when begining a transaction(). It looks like results may vary depending on the way the functions are precompiled. Everything works if we call API.setcommitmode(conn.dbc, true) on line 110 of load.jl Do you have any recommendations ?

Here is a way to reproduce the error:

using ODBC, DataFrames
path = "yourPath.accdb"
conn = ODBC.Connection("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" * path)
df = DataFrame(ABC=[1.,2.,3.])
ODBC.load(df,conn, "errorsRightAway")

ERROR: HY011: [Microsoft][Pilote ODBC Microsoft Access]Définition de l'attribut impossible à ce stage Stacktrace: [1] error(s::String) @ Base .\error.jl:35 [2] setcommitmode(dbc::ODBC.API.Handle, on::Bool) @ ODBC.API C:\Users\genc01.julia\packages\ODBC\9VZTC\src\API.jl:111 [3] transaction(f::ODBC.var"#46#47"{Bool, Int64, ODBC.Connection}, conn::ODBC.Connection) @ ODBC C:\Users\genc01.julia\packages\ODBC\9VZTC\src\load.jl:110 [4] load(itr::DataFrame, conn::ODBC.Connection, name::String; append::Bool, quoteidentifiers::Bool, debug::Bool, limit::Int64, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ ODBC C:\Users\genc01.julia\packages\ODBC\9VZTC\src\load.jl:96 [5] load(itr::DataFrame, conn::ODBC.Connection, name::String) @ ODBC C:\Users\genc01.julia\packages\ODBC\9VZTC\src\load.jl:74 [6] top-level scope @ c:\Users\genc01\Documents\Github_repos\SCT_MDL\Admin\Modelisation\src\testODBC.jl:276

FinPl avatar Oct 13 '22 20:10 FinPl