From: | 靳骄阳 <jinjiaoyang(at)smail(dot)nju(dot)edu(dot)cn> |
---|---|
To: | pgsql-odbc <pgsql-odbc(at)postgresql(dot)org> |
Subject: | SQLNumResultCols does not have a timeout |
Date: | 2024-05-06 07:44:55 |
Message-ID: | tencent_19D47A7E4615ED57765B47F2@qq.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Hello,
I stuck in SQLNumResultCols afterunplug my Ethernet cable.
My configuration:
-----------------
server - Linux x86 + postgresql 14.2
client - Linux x86 + postgresql ODBC 16.00
Problem description:
--------------------
My code is as follow:
SQLHENV henv;
SQLHDBC hdbc;
SQLRETURN retcode;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
SQLCHAR* connStr = (SQLCHAR*)"DRIVER={PostgreSQL};"
"SERVER=173.20.99.107;"
"Port=5432;"
"DATABASE=cpspg;"
"UserName=sac;"
"Password=sac;"
"Keepalive=1"
"KeepaliveTime=1;"
"KeepaliveInterval=1"
"Parse=1"
"UseServerSidePrepare=0";
//"CHARSET=UTF8;"
//"AUTOCOMMIT=0";
retcode = SQLDriverConnect(hdbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);
if (retcode == SQL_SUCCESS || retcode== SQL_SUCCESS_WITH_INFO)
{
SQLHANDLE hstmt;
SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
const char* sql_statement = "select now()";
retcode = SQLPrepare(hstmt, (SQLCHAR*)sql_statement, SQL_NTS);
std::string temp;
std::cout << "input something:";
std::cin >> temp;
SQLSMALLINT count;
retcode = SQLNumResultCols(hstmt, &count);
std::cout << "col count is " << count << std::endl;
if (retcode == SQL_SUCCESS || retcode== SQL_SUCCESS_WITH_INFO)
{
std::cout << "insert success" << std::endl;
}
else
{
HandleDiagnosticRecord(hdbc, SQL_HANDLE_DBC, retcode);
}
//SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_ROLLBACK);
SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT);
SQLDisconnect(hdbc);
}
else
{
HandleDiagnosticRecord(hdbc, SQL_HANDLE_DBC, retcode);
}
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);
I unplug my Ethernet cable when wait input and then input something, the program stucked in SQLNumResultCols. Finally got stuck in function PQgetResult and pqWaitTimed.
So my question is: Is this a bug or how to set timeout when the network has lost?
Thanks
Jin
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Chambre | 2024-05-08 11:17:11 | Building psqlODBC on newer Visual Studio versions |
Previous Message | Dave Cramer | 2024-04-18 20:16:37 | Please test release on github |