This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 1486ae77 fix(go/adbc/pkg): export Adbc* symbols on Windows (#916)
1486ae77 is described below

commit 1486ae770d7cb747dca86aa0375833adc9f080c6
Author: David Li <[email protected]>
AuthorDate: Wed Jul 19 13:58:51 2023 -0400

    fix(go/adbc/pkg): export Adbc* symbols on Windows (#916)
    
    Fixes #898.
---
 go/adbc/pkg/_tmpl/driver.go.tmpl                    |  6 +++++-
 go/adbc/pkg/flightsql/driver.go                     |  6 +++++-
 go/adbc/pkg/panicdummy/driver.go                    |  6 +++++-
 go/adbc/pkg/snowflake/driver.go                     |  6 +++++-
 python/adbc_driver_flightsql/tests/test_lowlevel.py | 14 ++++++++++++++
 python/adbc_driver_snowflake/tests/test_lowlevel.py |  8 ++++++++
 6 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/go/adbc/pkg/_tmpl/driver.go.tmpl b/go/adbc/pkg/_tmpl/driver.go.tmpl
index 248800f7..7432f001 100644
--- a/go/adbc/pkg/_tmpl/driver.go.tmpl
+++ b/go/adbc/pkg/_tmpl/driver.go.tmpl
@@ -19,7 +19,11 @@
 
 package main
 
-// #cgo CXXFLAGS: -std=c++11
+// ADBC_EXPORTING is required on Windows, or else the symbols
+// won't be accessible to the driver manager
+
+// #cgo CFLAGS: -DADBC_EXPORTING
+// #cgo CXXFLAGS: -std=c++11 -DADBC_EXPORTING
 // #include "../../drivermgr/adbc.h"
 // #include "utils.h"
 // #include <stdint.h>
diff --git a/go/adbc/pkg/flightsql/driver.go b/go/adbc/pkg/flightsql/driver.go
index 2936f90e..a8a606dd 100644
--- a/go/adbc/pkg/flightsql/driver.go
+++ b/go/adbc/pkg/flightsql/driver.go
@@ -21,7 +21,11 @@
 
 package main
 
-// #cgo CXXFLAGS: -std=c++11
+// ADBC_EXPORTING is required on Windows, or else the symbols
+// won't be accessible to the driver manager
+
+// #cgo CFLAGS: -DADBC_EXPORTING
+// #cgo CXXFLAGS: -std=c++11 -DADBC_EXPORTING
 // #include "../../drivermgr/adbc.h"
 // #include "utils.h"
 // #include <stdint.h>
diff --git a/go/adbc/pkg/panicdummy/driver.go b/go/adbc/pkg/panicdummy/driver.go
index 33a4f984..73c34eae 100644
--- a/go/adbc/pkg/panicdummy/driver.go
+++ b/go/adbc/pkg/panicdummy/driver.go
@@ -21,7 +21,11 @@
 
 package main
 
-// #cgo CXXFLAGS: -std=c++11
+// ADBC_EXPORTING is required on Windows, or else the symbols
+// won't be accessible to the driver manager
+
+// #cgo CFLAGS: -DADBC_EXPORTING
+// #cgo CXXFLAGS: -std=c++11 -DADBC_EXPORTING
 // #include "../../drivermgr/adbc.h"
 // #include "utils.h"
 // #include <stdint.h>
diff --git a/go/adbc/pkg/snowflake/driver.go b/go/adbc/pkg/snowflake/driver.go
index 12307b1a..51b6ce5b 100644
--- a/go/adbc/pkg/snowflake/driver.go
+++ b/go/adbc/pkg/snowflake/driver.go
@@ -21,7 +21,11 @@
 
 package main
 
-// #cgo CXXFLAGS: -std=c++11
+// ADBC_EXPORTING is required on Windows, or else the symbols
+// won't be accessible to the driver manager
+
+// #cgo CFLAGS: -DADBC_EXPORTING
+// #cgo CXXFLAGS: -std=c++11 -DADBC_EXPORTING
 // #include "../../drivermgr/adbc.h"
 // #include "utils.h"
 // #include <stdint.h>
diff --git a/python/adbc_driver_flightsql/tests/test_lowlevel.py 
b/python/adbc_driver_flightsql/tests/test_lowlevel.py
index 149888d4..23101c1f 100644
--- a/python/adbc_driver_flightsql/tests/test_lowlevel.py
+++ b/python/adbc_driver_flightsql/tests/test_lowlevel.py
@@ -16,11 +16,25 @@
 # under the License.
 
 import pyarrow
+import pytest
 
 import adbc_driver_flightsql
 import adbc_driver_manager
 
 
+def test_load_driver():
+    # Fails, but in environments where we don't spin up testing
+    # servers, this checks that we can at least *load* the driver
+    with pytest.raises(
+        adbc_driver_manager.OperationalError, match="Error while dialing"
+    ):
+        with adbc_driver_flightsql.connect("grpc://127.0.0.100:12345") as db:
+            with adbc_driver_manager.AdbcConnection(db) as conn:
+                with adbc_driver_manager.AdbcStatement(conn) as stmt:
+                    stmt.set_sql_query("SELECT 1")
+                    stmt.execute_query()
+
+
 def test_query_trivial(dremio):
     with adbc_driver_manager.AdbcStatement(dremio) as stmt:
         stmt.set_sql_query("SELECT 1")
diff --git a/python/adbc_driver_snowflake/tests/test_lowlevel.py 
b/python/adbc_driver_snowflake/tests/test_lowlevel.py
index 6186f889..18d1e778 100644
--- a/python/adbc_driver_snowflake/tests/test_lowlevel.py
+++ b/python/adbc_driver_snowflake/tests/test_lowlevel.py
@@ -29,6 +29,14 @@ def snowflake(snowflake_uri: str):
             yield conn
 
 
+def test_load_driver():
+    # Fails, but in environments where we don't spin up testing
+    # servers, this checks that we can at least *load* the driver
+    with pytest.raises(adbc_driver_manager.ProgrammingError, match="account is 
empty"):
+        with adbc_driver_snowflake.connect(""):
+            pass
+
+
 def test_query_trivial(snowflake):
     with adbc_driver_manager.AdbcStatement(snowflake) as stmt:
         stmt.set_sql_query("SELECT 1")

Reply via email to