Skip to content

Commit 6e1bffa

Browse files
committed
Test official Connector C 3.4.9 on Windows
1 parent 4143a22 commit 6e1bffa

4 files changed

Lines changed: 45 additions & 11 deletions

File tree

.github/workflows/issue236-windows.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
issue236:
14-
name: Windows ${{ matrix.os }} / JLL ${{ matrix.jll-version }}
14+
name: Windows ${{ matrix.os }} / ${{ matrix.connector }}
1515
runs-on: ${{ matrix.os }}
1616
timeout-minutes: 30
1717
strategy:
@@ -20,9 +20,10 @@ jobs:
2020
os:
2121
- windows-2022
2222
- windows-2025
23-
jll-version:
24-
- default
25-
- 3.3.9
23+
connector:
24+
- jll-default
25+
- jll-3.3.9
26+
- official-3.4.9
2627

2728
steps:
2829
- uses: actions/checkout@v5
@@ -39,12 +40,40 @@ jobs:
3940
mysql-version: "8.4"
4041
root-password: root
4142

43+
- name: Download official Connector/C
44+
if: matrix.connector == 'official-3.4.9'
45+
shell: pwsh
46+
run: |
47+
$msi = Join-Path $env:RUNNER_TEMP "mariadb-connector-c-3.4.9-win64.msi"
48+
$target = Join-Path $env:RUNNER_TEMP "mariadb-connector-c-3.4.9"
49+
Invoke-WebRequest `
50+
-Uri "https://dlm.mariadb.com/4751028/Connectors/c/connector-c-3.4.9/mariadb-connector-c-3.4.9-win64.msi" `
51+
-OutFile $msi
52+
Start-Process msiexec.exe -Wait -ArgumentList @("/a", $msi, "/qn", "TARGETDIR=$target")
53+
54+
$dll = Get-ChildItem $target -Recurse -Filter libmariadb.dll | Select-Object -First 1
55+
if ($null -eq $dll) {
56+
throw "Could not find libmariadb.dll under $target"
57+
}
58+
59+
$plugin = Get-ChildItem $target -Recurse -Directory |
60+
Where-Object { Test-Path (Join-Path $_.FullName "caching_sha2_password.dll") } |
61+
Select-Object -First 1
62+
if ($null -eq $plugin) {
63+
throw "Could not find Connector/C plugin directory under $target"
64+
}
65+
66+
"MYSQLJL_LIBMARIADB_OVERRIDE=$($dll.FullName)" >> $env:GITHUB_ENV
67+
"MYSQLJL_PLUGIN_DIR_OVERRIDE=$($plugin.FullName)" >> $env:GITHUB_ENV
68+
"$($dll.DirectoryName)" >> $env:GITHUB_PATH
69+
4270
- name: Run issue 236 diagnostic
4371
shell: pwsh
4472
env:
4573
MYSQLJL_HOST: 127.0.0.1
4674
MYSQLJL_PORT: "3306"
4775
MYSQLJL_USER: root
4876
MYSQLJL_PASSWORD: root
49-
MYSQLJL_JLL_VERSION: ${{ matrix.jll-version }}
77+
MYSQLJL_CONNECTOR: ${{ matrix.connector }}
78+
MYSQLJL_JLL_VERSION: ${{ matrix.connector == 'jll-3.3.9' && '3.3.9' || 'default' }}
5079
run: julia --startup-file=no test/issue236_windows.jl

src/api/API.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export DateAndTime
77
using MariaDB_Connector_C_jll
88
using OpenSSL_jll: libssl, libcrypto
99

10-
const PLUGIN_DIR = joinpath(MariaDB_Connector_C_jll.artifact_dir, "lib", "mariadb", "plugin")
10+
const PLUGIN_DIR = get(ENV, "MYSQLJL_PLUGIN_DIR_OVERRIDE", joinpath(MariaDB_Connector_C_jll.artifact_dir, "lib", "mariadb", "plugin"))
1111

1212
# Pre-load OpenSSL libraries so they're available when MariaDB loads plugins.
1313
# MariaDB authentication plugins (e.g., caching_sha2_password) depend on OpenSSL,
@@ -37,4 +37,4 @@ include("capi.jl")
3737
# Prepared statement API functions
3838
include("papi.jl")
3939

40-
end # module
40+
end # module

src/api/ccalls.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
const libmariadb_for_ccall = get(ENV, "MYSQLJL_LIBMARIADB_OVERRIDE", libmariadb)
2+
13
macro c(func, ret, args, vals...)
24
if Sys.iswindows()
35
esc(quote
4-
ret = ccall( ($func, libmariadb), stdcall, $ret, $args, $(vals...))
6+
ret = ccall( ($func, libmariadb_for_ccall), stdcall, $ret, $args, $(vals...))
57
end)
68
else
79
esc(quote
8-
ret = ccall( ($func, libmariadb), $ret, $args, $(vals...))
10+
ret = ccall( ($func, libmariadb_for_ccall), $ret, $args, $(vals...))
911
end)
1012
end
1113
end

test/issue236_windows.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ function main()
143143
logline("JULIA_VERSION ", VERSION)
144144
logline("OS ", Sys.KERNEL, " MACHINE ", Sys.MACHINE)
145145
logline("WORD_SIZE ", Sys.WORD_SIZE)
146-
logline("LIBMARIADB ", MariaDB_Connector_C_jll.libmariadb)
147-
logline("LIBMARIADB_HANDLE ", Libdl.dlopen_e(MariaDB_Connector_C_jll.libmariadb))
146+
logline("CONNECTOR ", get(ENV, "MYSQLJL_CONNECTOR", "unknown"))
147+
logline("JLL_LIBMARIADB ", MariaDB_Connector_C_jll.libmariadb)
148+
logline("CCALL_LIBMARIADB ", MySQL.API.libmariadb_for_ccall)
149+
logline("PLUGIN_DIR ", MySQL.API.PLUGIN_DIR)
150+
logline("LIBMARIADB_HANDLE ", Libdl.dlopen_e(MySQL.API.libmariadb_for_ccall))
148151

149152
conn = prepare_database()
150153
try

0 commit comments

Comments
 (0)