-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Cursor with fetchSize > 1 results in error on prepared statement #329
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please do not close. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Do not close. |
Please re-open. |
Hello, I have the same problem using odbc from Windows to Informix. If it can help, here the ODBC trace generated :
|
Hi, I found that the error come from this code on odbc_connection.cpp : if (set_position && data->get_data_supports.block && data->fetch_size > 1)
{
// In case the result set contains columns that contain LONG data
// types, use SQLSetPos to set the row we are transferring bound data
// from, and use SQLGetData in the same loop.
return_code =
SQLSetPos
(
data->hstmt,
(SQLSETPOSIROW) row_index + 1,
SQL_POSITION,
SQL_LOCK_NO_CHANGE
);
if (!SQL_SUCCEEDED(return_code))
{
return return_code;
}
} I don't understand why, but SQLSetPos() fail. If I comment this block the fetchSize is working, except when one of the columns is "long_data" and must be retrieved via SQLGetData() So I suppose we can use a partial fix in this case, by skipping SQLSetPos() when there are no long_data's columns. if (data->has_long_data && set_position && data->get_data_supports.block && data->fetch_size > 1) |
Describe your system
odbc
Package Version: 2.4.7Describe the bug
The ODBC driver returns a "Invalid cursor position" error if a fetchSize > 1 is specified for a prepared statement in statement.execute.
Expected behavior
Regular cursor behaviour when specifying a fetchSize > 1
To Reproduce
Code
Additional context
Specifying a fetchSize without a prepared statement does return as expected. So it seems that something goes wrong with a cursor on a prepared statement.
The text was updated successfully, but these errors were encountered: