xdenser / node-firebird-libfbclient

Firebird SQL binding
MIT License
82 stars 34 forks source link

Reuse FBStatement across new transactions #76

Closed heri16 closed 7 years ago

heri16 commented 7 years ago

The code below fails:

statement = conn.prepareSync(...);

transaction = conn.startNewTransactionSync();
if (!transaction.inTransaction) { transaction.startSync(); }
statement.execInTransSync(transaction, '|' + itemNos.join('|') + '|');
transaction.rollbackSync();

transaction = conn.startNewTransactionSync();
if (!transaction.inTransaction) { transaction.startSync(); }
statement.execInTransSync(transaction, '|' + itemNos.join('|') + '|');

With Error:

Error: In FBStatement::execSync, free_statement - Dynamic SQL Error
SQL error code = -501
Attempt to reclose a closed cursor

    at Error (native)
    at fetch (D:\slackbot\accurate_db.js:165:23)
    at D:\slackbot\accurate_db.js:189:13
    at prepare (D:\slackbot\accurate_db.js:150:11)
    at D:\slackbot\accurate_db.js:187:11
    at D:\slackbot\node_modules\firebird\firebird.js:78:17
heri16 commented 7 years ago

Thanks for looking into this.