From b159069d183fed79344ef5eb3294cd42315f6b84 Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Fri, 12 Mar 2021 19:03:00 +0100 Subject: [PATCH] support for iodbc --- Cargo.toml | 3 ++- README.md | 5 +++++ src/functions.rs | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e0fa058..7a21b7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "odbc-sys" -version = "0.17.1" +version = "0.17.2" authors = ["Markus Klein "] license = "MIT" description = "ODBC ffi bindings" @@ -16,6 +16,7 @@ categories = ["external-ffi-bindings", "database"] [features] default = ["odbc_version_3_80"] static = [] +iodbc = [] odbc_version_3_50 = [] odbc_version_3_80 = ["odbc_version_3_50"] diff --git a/README.md b/README.md index 1ac421e..4f8e414 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ Design Goals * As it is as of now unlikely to happen that anyone is writing ODBC 2.0 applications in Rust therefore deprecated symbols like 'SQLAllocEnv' have been left out intentionally. +Linking +------- + +This library will link against `odbc32.dll` (preinstalled) on Windows systems. On Linux and OS-X it links against `libodbc.so` by default. This is typically provided by [unix-odbc](http://www.unixodbc.org/). Using the `--feature iodbc` you can also link against `libiodbc.so`. This may be interessting if you are trying to connect to some older data sources on OS-X. + Current State ------------- diff --git a/src/functions.rs b/src/functions.rs index c18cf95..bdb592f 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -7,8 +7,10 @@ use crate::{ // static linking is not currently supported here for windows #[cfg_attr(windows, link(name = "odbc32"))] -#[cfg_attr(all(not(windows), not(r#static)), link(name = "odbc"))] -#[cfg_attr(all(not(windows), r#static), link(name = "odbc", kind = "static"))] +#[cfg_attr(all(not(windows), not(feature = "static"), not(feature = "iodbc")), link(name = "odbc"))] +#[cfg_attr(all(not(windows), feature = "static", not(feature = "iodbc")), link(name = "odbc", kind = "static"))] +#[cfg_attr(all(not(windows), not(feature = "static"), feature = "iodbc"), link(name = "iodbc"))] +#[cfg_attr(all(not(windows), feature = "static", feature = "iodbc"), link(name = "iodbc", kind = "static"))] extern "system" { /// Allocates an environment, connection, statement, or descriptor handle. ///