gpt4 book ai didi

postgresql - 获取 libpq 运行时版本(来自 libpqxx)

转载 作者:行者123 更新时间:2023-11-29 13:01:09 30 4
gpt4 key购买 nike

在 libpqxx 引用中,我有时可以读到仅限于底层 libpq 版本的内容(“需要 PostgreSQL 7.4 或更高版本的 libpq 版本。”) like here .

现在问题:(1)如何获取当前程序使用的libpq版本(使用libpqxx)? (2) 据我所知,在升级到新的 libpq 版本时,libpqxx 不一定需要重新编译。替换旧的 libpq.dll 涵盖(通常)新技术,例如我的 ssl 压缩。这就是为什么我认为应该在运行时接收 libpq 版本。

最佳答案

从 9.1 到 PQlibVersion,libpq 版本在运行时可用:

int PQlibVersion(void);

The result of this function can be used to determine, at runtime, if specific functionality is available in the currentlyloaded version of libpq. The function can be used, for example, todetermine which connection options are available for PQconnectdb orif the hex bytea output added in PostgreSQL 9.0 is supported.

The number is formed by converting the major, minor, and revisionnumbers into two-decimal-digit numbers and appending them together.For example, version 9.1 will be returned as 90100, and version9.1.2 will be returned as 90102 (leading zeroes are not shown).

libpqxx 好像没有封装这个功能,所以我们要切过去直接得到libpq

关于postgresql - 获取 libpq 运行时版本(来自 libpqxx),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29746966/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com