compat.nanodbc
#includeSmall C++ wrapper for the native C ODBC API
#include <nanodbc/nanodbc.h>
mcpp add compat.nanodbc@2.14.0
Usage
From this repository's own test project — built and run by CI, not written for the website.
// compat.nanodbc — connect to a DSN that does not exist and assert nanodbc
// reports the driver manager's own diagnostics as a nanodbc::database_error.
//
// Deliberately DATABASE-FREE. A CI runner has no database server and no ODBC
// driver, so a successful connect asserts nothing that can hold everywhere.
// What IS guaranteed is the driver manager (unixODBC), which is the layer
// nanodbc wraps: the failed connect still walks handle allocation, the DSN
// lookup and the diagnostic formatting, and every one of those symbols comes
// from the compiled nanodbc.cpp — a half-linked package fails here.
#ifdef HAVE_NANODBC
#include <nanodbc/nanodbc.h>
import std;
int main() {
bool ok = true;
auto check = [&](bool cond, std::string_view what) {
if (!cond) {
std::println("FAIL: {}", what);
ok = false;
}
};
// …
tests/examples/nanodbc/tests/error_path.cpp · project tests/examples/nanodbc
Build
- targets
nanodbc (lib)- language
c++23- import std
- no
- include dirs
*, mcpp_generated/include
Sources (1)
*/nanodbc/nanodbc.cpp
Generated files
mcpp_generated/include/mcpp_nanodbc_char_traits.h
Versions
| Version | Platforms | Mirrors | sha256 |
|---|---|---|---|
2.14.0 latest |
LinuxWindowsmacOS | source | 56228372042b… |