mcpp index

compat.nanodbc

#include

Small C++ wrapper for the native C ODBC API

#include <nanodbc/nanodbc.h>
mcpp add compat.nanodbc@2.14.0

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// 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 · 项目 tests/examples/nanodbc

构建

targets
nanodbc (lib)
language
c++23
import std
no
include dirs
*, mcpp_generated/include

源文件 (1)

  • */nanodbc/nanodbc.cpp

生成的文件

  • mcpp_generated/include/mcpp_nanodbc_char_traits.h

版本

版本平台 镜像sha256
2.14.0 最新 LinuxWindowsmacOS 源站 56228372042b…