Cargo Features

[dependencies]
odbc-api = { version = "10.0.0", default-features = false, features = ["narrow", "wide", "odbc_version_3_5", "odbc_version_3_80", "iodbc", "derive"] }
narrow iodbc?

Use narrow function calls.

Many functions which accept string arguments in the ODBC C API come in two different flavours. For example SQLConnect and SQLConnectW. The former are called narrow function calls and the latter are called wide. They differ in the type they used to encode characters (u8 vs u16). Sadly narrow may not always be assumed to be UTF-8 as it is dependend on the system locale which is usually not UTF-8 on windows system. The wide function calls could be relied upon to always be UTF-16 on any platform, but do not seem to work well with iodbc and are less battle tested with Linux versions of ODBC drivers.

Currently this library uses wide function call on windows systems by default. On non windows systems however narrow function calls are used. Enabling this feature will cause the use of the narrow function calls even on windows system. One reason to do so, would be e.g. you know your program is running on a windows system with an UTF-8 locale, and trust the driver to handle UTF-8 appropriatly. If both narrow and wide work, narrow usually is faster and needs less encoding and decoding between string representations.

Note that this is the encoding used for statement text and other string arguments, yet not for the payload of VARCHAR columns, or other column types in the result set. This can be choosen at runtime by the application.

wide

Use wide function calls.

See the documentation of narrow feature above for more information. Enabling this feature will trigger the use of wide function calls, even on "non-windows" platforms. If both narrow and wide are enabled, wide takes precedence.

Affects column_description::utf8_to_vec_char, sql_char::SqlChar, sql_char::DecodingError, sql_char::slice_to_utf8, sql_char::slice_to_cow_utf8

odbc_version_3_5 iodbc?

odbc-api uses ODBC 3.80 by default, which is well supported both in windows and on linux through UnixODBC. Yet iodbc, for now does only support ODBC 3.5, so you can set this flag in order to include only symbols available in ODBC 3.5 and create an environment which declares the ODBC version to be 3.0 which works together with the iodbc driver manager. If you want to use ODBC 3.5 please take care to deactivate default features to not have the ODBC version 3.80 feature active at the same time.

Enables odbc_version_3_50 of odbc-sys

Low level bindings to ODBC API calls into libodbc.so

odbc_version_3_80 default

The ODBC version your application should declare if it runs on windows, or on linux using UnixOdbc.

Enables odbc_version_3_80 of odbc-sys

Affects statement::Statement.complete_async

iodbc = narrow, odbc_version_3_5

In order to work with iodbc we need to only use symbols defined in ODBC 3.5. We need to use narrow function calls and preferale link against libiodbc.so instead of libodbc.so.

Enables iodbc of odbc-sys

derive

Allows deriving custom implementations of FetchRow for row wise bulk fetching.

Enables odbc-api-derive

default = odbc_version_3_80

The odbc_version_3_80 feature is set by default whenever odbc-api is added without default-features = false somewhere in the dependency tree.