In my application I am experiencing a hanging transaction: what that means, is that the statement in the transaction does not complete, the firebird server does not seem to respond to my client.
Here is the source, of course the application is complex so I'll try unwrap information for clarity here:
The tables involved are described here:
image,
product_imageWhen the function is invoked with one item in the urls array, the following queries are generated and run in one transaction created by the parent function. In a debug environment no other transactions are running in the background.
In this transaction the first query being executed is:
DELETE FROM image i
WHERE EXISTS (
SELECT 1
FROM product_image pi
WHERE pi.product_id = ?
AND pi.image_id =
i.id )
Then the second query being executed is:
INSERT INTO image (id, url) SELECT
CAST(? AS BINARY(16)),
CAST(? AS BLOB SUB_TYPE TEXT)
FROM RDB$DATABASE
And the third query being executed is:
INSERT INTO product_image (product_id, image_id, image_rank) SELECT
CAST(? AS BINARY(16)),
CAST(? AS BINARY(16)),
CAST(? AS INTEGER)
FROM RDB$DATABASE
This third query never ends.
I have been looking at the documentation to figure out what is happening. What am I doing wrong?
I am trying to keep these queries within one transaction because I do not want to implement some app-level transactioning logic.