检查连接是否在libpqxx(postgres)中处于活动状态
Check a Connection is still active or not in libpqxx (postgres)
如何检查特定连接是否已完成其工作或在 postgres 中仍处于活动状态?我正在创建与数据库的连接数组,并且我想获得一个不在任何事务中的连接。我正在使用C++和libpqxx库来连接数据库。谁能告诉我如何检查这个。
我想做这样的事情,
connection* conList;
for(int i=0;i<10;i++)
{
conList[i]=new connection("dbname=test user=postgres password=abc123 hostaddr=127.0.0.1 port=5432");
}
int i=0;
while(true)
{
if(conList[i] has not any active transaction )
{
//do something
}
i++;
}
假设 tbis 是因为您有一个多线程应用程序,您将需要知道哪个线程具有哪个连接。就用它。
相关文章:
- 当可输入框在窗口中处于活动状态时获得通知的任何方法
- 在使用 gSoap 链接多个 SOAP 服务时启用保持活动状态
- 生成线程并在运行时执行其他操作,只要它处于活动状态
- 如何确定boost msm中的特定状态是否为活动状态
- GCC (libstdc++) 运行时如何在异常处于活动状态时决定终止 ()
- “B1的多重定义”,即使警卫处于活动状态
- 全局挂钩 DLL 仅在 C# 主窗口处于活动状态/前台时调用 C# 回调方法
- 保持 boost.process 在函数之外处于活动状态,该函数被调用
- 当 /Whorearchive选项处于活动状态时,无法使用Visual Studio链接到Windows上的自构建张量
- IBM Rhapsody c++ 代码生成 - 为什么总是在状态图周围放置一个活动状态
- 暂停游戏OnSteamVR叠加层处于活动状态
- 我怎么知道哪种上下文处于活动状态
- 如何使用QEvent::WindowBlocked,以便特定窗口始终处于活动状态?
- 如何保持异步函数中使用成员的shared_ptr对象的活动状态?
- 错误保持活动状态延迟
- 如何在C API中检查MySql连接是否处于活动状态
- 类的堆分配对象是否在其作用域之后但在 C++ 中调用其析构函数之前处于活动状态
- 当条件处于活动状态时停止 arduino 循环
- 如何防止我的dll在某个进程未处于活动状态时运行
- 检查连接是否在libpqxx(postgres)中处于活动状态