Subject | Re: [firebird-support] Object in use... wtf??? |
---|---|
Author | Ann Harrison |
Post date | 2013-11-26T15:56:03Z |
On Tue, Nov 26, 2013 at 8:03 AM, Kjell Rilbe <kjell.rilbe@...> wrote:
Scenario, in a single connection I do this:
1. Start transaction.
2. Create table.
3. Commit.
4. Start transaction.
5. Insert rows.
6. Select using join with other tables.
7. Commit.
8. Start transaction.
9. Drop table.
---> ERROR: Object is in use.
Tried to add rd.Close after the for loop, but it didn't help. What did help was to close the connection and reopen it between the select commit and the starting the transaction for the drop.
But why is that necessary?
I know nothing about .Net or its options. The underlying problem is that prepared statements are associated with a connection, not a transaction. That means that when you reuse a statement, Firebird doesn't have to parse, compile, and optimize it. To prevent unfortunate accidents. Firebird won't drop tables that are referenced in saved statements. Someone in the .Net area should be able to figure out how to close statement handles so you can drop tables that only your connection has used.Good luck,Ann