Install
nanodbc is distributed in form of source code package.
nanodbc is intentionally small enough that you can drag and drop the header and implementation files into your project and run with it.
Binary packages, if available, are provided and supported by third-parties, developers and maintainers of numerous package managers.
Source
You can build nanodbc library, build and run tests using CMake.
git clone https://github.com/nanodbc/nanodbc.git
cd nanodbc
mkdir build
cd build
cmake ..
cmake --build .
ctest -V --output-on-failure
Requirements
Optionally, you will also need:
ODBC drivers, depending on DBMS you want to target (eg. running tests).
Boost.Locale, alternative for Unicode conversion routines.
libc++, alternative C++11 and later implementation.
Build
Although detailed build process depends on CMake generator used, number of common targets are always available.
For example, CMake configuration using Makefiles generator:
cd nanodbc
mkdir build
cd build
cmake -G "Unix Makefiles" [options] ..
make # creates shared library
make nanodbc # creates shared library
make tests # builds the tests
make test # runs the tests
make check # builds and then runs tests
make examples # builds all the example programs
make install # installs nanodbc.h and shared library
CMake OPTION and cache entry variables are available to specify
with -D
switch to enable or disable nanodbc built-in features.
All boolean options follow the CMake OPTION default value convention: if no initial value is provided, OFF is used.
List of CMake options specific to nanodbc, in alphabetical order:
- NANODBC_DISABLE_ASYNCboolean
Disable all async features. May resolve build issues in older ODBC versions.
- NANODBC_DISABLE_EXAMPLESboolean
Do not build examples.
- NANODBC_DISABLE_INSTALLboolean
Do not generate install target.
- NANODBC_DISABLE_LIBCXXboolean
Do not use libc++, if available on the system.
- NANODBC_DISABLE_TESTSboolean
Do not build tests. Do not generate
test
andcheck
targets.- NANODBC_ENABLE_BOOSTboolean
Use Boost for Unicode string convertions (requires Boost.Locale). Workaround to issue #44.
- NANODBC_ENABLE_UNICODEboolean
Enable Unicode support.
nanodbc::string
becomesstd::u16string
orstd::u32string
.- NANODBC_ENABLE_WORKAROUND_NODATAboolean
Enable
SQL_NO_DATA
workaround #33.- NANODBC_ODBC_VERSIONstring
Force ODBC version to use. Possible values are
SQL_OV_ODBC3
orSQL_OV_ODBC3_80
. Default value isSQL_OV_ODBC3_80
, if available.
Standard CMake options are also available, for example:
- BUILD_SHARED_LIBSboolean
Build nanodbc as A shared library. Default value is OFF.
If you are not using CMake to build nanodbc, you will need to set the options, using the corresponding names, as preprocessor defines yourself.
Test
Tests use the Catch test framework. CMake automatically fetches the latest version of Catch for you at build time.
Once nanodbc build is ready, use ctest to run tests in CMake generator-agnostic way:
ctest -V --output-on-failure
Alternatively, build test target (eg. make test).
Binaries
This section aim to list all known binary packages of nanodbc.
If you maintain binary package of nanodbc and you’d like to list it here, please submit new entry via pull request or open an issue
Windows
vcpkg port of nanodbc