Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure string options are converted to proper strings before passing … #204

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/api/capi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -964,14 +964,20 @@ For more information about option files used by MySQL programs, see Section 4.2.
function setoption(mysql::MYSQL, option::mysql_option, arg="0")
if option in CUINTOPTS
ref = Ref{Cuint}(Cuint(arg))
return @checksuccess mysql mysql_options(mysql.ptr, option, ref)
elseif option in CULONGOPTS
ref = Ref{Culong}(Culong(arg))
return @checksuccess mysql mysql_options(mysql.ptr, option, ref)
elseif option in BOOLOPTS
ref = Ref{Bool}(Bool(arg))
return @checksuccess mysql mysql_options(mysql.ptr, option, ref)
else
ref = arg == C_NULL ? C_NULL : convert(Ptr{Cvoid}, pointer(arg))
str = arg == C_NULL ? C_NULL : String(arg)
GC.@preserve str begin
ref = str == C_NULL ? C_NULL : convert(Ptr{Cvoid}, pointer(str))
return @checksuccess mysql mysql_options(mysql.ptr, option, ref)
end
end
return @checksuccess mysql mysql_options(mysql.ptr, option, ref)
end

#="""
Expand Down