Skip to content
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

Transaction stay in active status (retaining) after select (update) statement [ODBC109] #106

Closed
firebird-automations opened this issue Feb 28, 2011 · 3 comments

Comments

@firebird-automations
Copy link

Submitted by: Ivan Volnikov (ivan_v)

Attachments:
OdbcFb.zip

This problem leads to accumulation on server side of the locked transactions from other applications which completions not till the end of complete transactions expect.
All it leads to deceleration of operation of the server because of necessity to trace not up to the end closed transactions.
To be treated only by reconnection.
--------------------------------------------------------------------------
The problem is property autoCommit call commit_retaining instead of commit from method IscStatement::deleteResultSet.
--------------------------------------------------------------------------
void IscStatement::deleteResultSet(IscResultSet * resultSet)
{
resultSets.deleteItem (resultSet);
if (resultSets.isEmpty())
{
if ( connection )
{
if ( transactionLocal )
{
if ( transactionInfo.autoCommit )
commitLocal();
}
else if ( connection->transactionInfo.autoCommit )
connection->commitAuto();

                    if \( isActiveCursor\(\) \)
                    \{
                            // Close cursors too\.
                            ISC\_STATUS statusVector\[20\];
                            connection\-\>GDS\-\>\_dsql\_free\_statement\( statusVector, &statementHandle, DSQL\_close \);
                            // Cursor already closed or not assigned
                            if \( statusVector\[1\] && statusVector\[1\] \!= 335544569\)
                                    THROW\_ISC\_EXCEPTION \(connection, statusVector\);
                    \}
            \}
            openCursor = false;
            typeStmt = stmtNone;

    \}

}
--------------------------------------------------------------------------
To solve the problem I use that:
--------------------------------------------------------------------------
void IscStatement::deleteResultSet(IscResultSet * resultSet)
{
resultSets.deleteItem (resultSet);
if (resultSets.isEmpty())
{
bool needCloseCursors = isActiveCursor();
openCursor = false;
typeStmt = stmtNone;

            if \( connection \)
            \{
                    if \( transactionLocal \)
                    \{
                            if \( transactionInfo\.autoCommit \)
                                    commitLocal\(\);
                    \}
                    else if \( connection\-\>transactionInfo\.autoCommit \)
                            connection\-\>commitAuto\(\);

                    if \( needCloseCursors \)
                    \{
                            // Close cursors too\.
                            ISC\_STATUS statusVector\[20\];
                            connection\-\>GDS\-\>\_dsql\_free\_statement\( statusVector, &statementHandle, DSQL\_close \);
                            // Cursor already closed or not assigned
                            if \( statusVector\[1\] && statusVector\[1\] \!= 335544569\)
                                    THROW\_ISC\_EXCEPTION \(connection, statusVector\);
                    \}
            \}

    \}

}
--------------------------------------------------------------------------

Commits: e8fcf6b 7ba202b

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Attachment: OdbcFb.zip [ 12007 ]

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.1 [ 10430 ]

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants