From 248572b734677bce8df3c5e245fc65fbdb30b1bd Mon Sep 17 00:00:00 2001 From: Kyrylo Simonov Date: Wed, 31 May 2023 23:18:33 -0500 Subject: [PATCH 1/2] Fix SQLPrepare and SQLExecDirect - https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlprepare-function?view=sql-server-ver16#syntax - https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlexecdirect-function?view=sql-server-ver16#syntax --- src/API.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/API.jl b/src/API.jl index 83c8e32..e1ccab0 100644 --- a/src/API.jl +++ b/src/API.jl @@ -382,7 +382,7 @@ end function SQLPrepare(stmt::Ptr{Cvoid},query::AbstractString) q = cwstring(query) @odbc(:SQLPrepareW, - (Ptr{Cvoid},Ptr{SQLWCHAR},Int16), + (Ptr{Cvoid},Ptr{SQLWCHAR},SQLINTEGER), stmt,q,length(q)) end @@ -443,7 +443,7 @@ execute(stmt::Handle) = @checksuccess stmt SQLExecute(getptr(stmt)) function SQLExecDirect(stmt::Ptr{Cvoid},query::AbstractString) q = cwstring(query) @odbc(:SQLExecDirectW, - (Ptr{Cvoid},Ptr{SQLWCHAR},Int), + (Ptr{Cvoid},Ptr{SQLWCHAR},SQLINTEGER), stmt,q,length(q)) end From 47b5782e9380ead6c2392e8b908b2d3753e2d046 Mon Sep 17 00:00:00 2001 From: Kyrylo Simonov Date: Wed, 31 May 2023 23:24:49 -0500 Subject: [PATCH 2/2] Fix SQLInstallerError, SQLInstallDriverEx, SQLRemoveDriver - https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlinstallererror-function?view=sql-server-ver16#syntax - https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlinstalldriverex-function?view=sql-server-ver16#syntax - https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlremovedriver-function?view=sql-server-ver16#syntax --- src/API.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/API.jl b/src/API.jl index e1ccab0..8f5be79 100644 --- a/src/API.jl +++ b/src/API.jl @@ -576,12 +576,12 @@ end function installererror() buf = Vector{UInt8}(undef, 512) - code = Ref{UInt16}() + code = Ref{UInt32}() len = Ref{UInt16}() i = 1 err = "" while @odbcinst(:SQLInstallerError, - (UInt16, Ref{UInt16}, Ptr{UInt8}, UInt16, Ref{UInt16}), + (UInt16, Ref{UInt32}, Ptr{UInt8}, UInt16, Ref{UInt16}), i, code, buf, sizeof(buf), len) != SQL_NO_DATA err *= str(buf, len[]) i += 1 @@ -608,17 +608,17 @@ function adddriver(name, path; kw...) driver = "$name\0Driver=$path$ex\0\0" out = Vector{UInt8}(undef, 1024) ref = Ref{UInt16}() - usage = Ref{UInt16}() + usage = Ref{UInt32}() ret = @checkinst @odbcinst(:SQLInstallDriverEx, - (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, UInt16, Ref{UInt16}, UInt16, Ref{UInt16}), + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, UInt16, Ref{UInt16}, UInt16, Ref{UInt32}), driver, C_NULL, out, length(out), ref, 2, usage) return ret end function removedriver(name, removedsns) - usage = Ref{UInt16}() + usage = Ref{UInt32}() ret = @checkinst @odbcinst(:SQLRemoveDriver, - (Ptr{UInt8}, Bool, Ref{UInt16}), + (Ptr{UInt8}, Bool, Ref{UInt32}), name, removedsns, usage) return ret end