Does the psqlodbc driver support asynchronous queries?
От | Juan Tiritas |
---|---|
Тема | Does the psqlodbc driver support asynchronous queries? |
Дата | |
Msg-id | CABEPBqP1HHCjmVTPPXjHtMw7AvJAWK1Gu0LNc0sSM_2fB5f_tw@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Does the psqlodbc driver support asynchronous queries?
|
Список | pgsql-odbc |
Hello everyone,
I'm trying to run asynchronous queries with unixODBC + psqlodbcw.so in linux (RHEL5), but I can not do it.
I'm trying to run asynchronous queries with unixODBC + psqlodbcw.so in linux (RHEL5), but I can not do it.
The next code:
//-------
// Get the Async state
SQLINTEGER attrState;
SQLGetConnectAttr(hstmt, SQL_ATTR_ASYNC_ENABLE, &attrState, 0, NULL);
std::cout << "Async is set to: " << attrState << std::endl;
SQLINTEGER attrState;
SQLGetConnectAttr(hstmt, SQL_ATTR_ASYNC_ENABLE, &attrState, 0, NULL);
std::cout << "Async is set to: " << attrState << std::endl;
// Enable Async Operation - if ASYNC is not allowed, SQLSetStmtAttr
// will return an error
retcode = SQLSetStmtAttr (hstmt, SQL_ATTR_ASYNC_ENABLE,
(SQLPOINTER) SQL_ASYNC_ENABLE_ON, SQL_IS_INTEGER);
CHECK_ERROR(retcode, "SQLSetStmtAttr(SQL_ATTR_ASYNC_ENABLE)",
hstmt, SQL_HANDLE_STMT);
// will return an error
retcode = SQLSetStmtAttr (hstmt, SQL_ATTR_ASYNC_ENABLE,
(SQLPOINTER) SQL_ASYNC_ENABLE_ON, SQL_IS_INTEGER);
CHECK_ERROR(retcode, "SQLSetStmtAttr(SQL_ATTR_ASYNC_ENABLE)",
hstmt, SQL_HANDLE_STMT);
// Get the Async state again
SQLGetConnectAttr(hstmt, SQL_ATTR_ASYNC_ENABLE, &attrState, 0, NULL);
std::cout << "Async is set to: " << attrState << " now " << std::endl;
SQLGetConnectAttr(hstmt, SQL_ATTR_ASYNC_ENABLE, &attrState, 0, NULL);
std::cout << "Async is set to: " << attrState << " now " << std::endl;
// Execute SELECT whilst status SQL_STILL_EXECUTING
//retcode = SQLExecDirect (hstmt, stmt, SQL_NTS);
while (SQLExecDirect (hstmt, stmt, SQL_NTS) == SQL_STILL_EXECUTING) {
printf ("\nStill executing ...");
printf ("\nSnooze ..");
sleep(1);
printf ("\nAwake ..");
retcode = SQLExecDirect (hstmt, stmt, SQL_NTS);
}
//retcode = SQLExecDirect (hstmt, stmt, SQL_NTS);
while (SQLExecDirect (hstmt, stmt, SQL_NTS) == SQL_STILL_EXECUTING) {
printf ("\nStill executing ...");
printf ("\nSnooze ..");
sleep(1);
printf ("\nAwake ..");
retcode = SQLExecDirect (hstmt, stmt, SQL_NTS);
}
//-------
Returns the next output:
Async is set to: -1074166952
Async is set to: -1074166952 now
Async is set to: -1074166952 now
and the select is not working in asynchronous mode.
Am I doing something wrong or the postgres odbc driver does not support asynchronous calls through unixODBC?
Thanks in advance.
Regards,
Juan Tiritas
Thanks in advance.
Regards,
Juan Tiritas
В списке pgsql-odbc по дате отправления: