compat.nanodbc
#includeSmall 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… |