Subject | Years of 'doing it wrong' ;) |
---|---|
Author | Lester Caine |
Post date | 2019-04-13T11:09:17Z |
I've been using ADOdb in my php frameworks since I first started using
PHP for client interfaces. Ive always had a niggle where occasionally a
save would not be visible until I reloaded the page. It's never been a
particular problem until recently so I've not dug deep enough to solve
it. Coming up on 20 years of more than happy operation :)
We have started to use a section of the code that needs the load to work
properly so I've had a dig finally and of cause the answer is simple ...
ADOdb wraps every post in a transaction ... and all the elements roll
back nicely if it fails and commit once successful. But of cause the
original connection is still sitting on the default transaction. OK so
simply hide the new transaction and everything works fine. I fact I am
convinced that originally ADOdb only used the connection ID and did not
bother with transaction ID which was probably a good fix at the time.
The question is "What am I missing" to get the default transaction to
see the committed records from a wrapped commit using the transaction
ID? Certainly in C++ days this just worked so I've not had to think
about it.
In reality I don't think the process needs the second transaction in
this case and a commit or rollback on the default one is more than
enough - which is the fix I've put in - but I can see developments
coming up which would benefit from a separate transaction or more ...
something which ADOdb can't cope with anyway, only allowing one call to
fbird_trans, but can the PHP driver handle multiple transaction IDs anyway?
--
Lester Caine - G8HFL
-----------------------------
Contact - https://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - https://lsces.co.uk
EnquirySolve - https://enquirysolve.com/
Model Engineers Digital Workshop - https://medw.co.uk
Rainbow Digital Media - https://rainbowdigitalmedia.co.uk
PHP for client interfaces. Ive always had a niggle where occasionally a
save would not be visible until I reloaded the page. It's never been a
particular problem until recently so I've not dug deep enough to solve
it. Coming up on 20 years of more than happy operation :)
We have started to use a section of the code that needs the load to work
properly so I've had a dig finally and of cause the answer is simple ...
ADOdb wraps every post in a transaction ... and all the elements roll
back nicely if it fails and commit once successful. But of cause the
original connection is still sitting on the default transaction. OK so
simply hide the new transaction and everything works fine. I fact I am
convinced that originally ADOdb only used the connection ID and did not
bother with transaction ID which was probably a good fix at the time.
The question is "What am I missing" to get the default transaction to
see the committed records from a wrapped commit using the transaction
ID? Certainly in C++ days this just worked so I've not had to think
about it.
In reality I don't think the process needs the second transaction in
this case and a commit or rollback on the default one is more than
enough - which is the fix I've put in - but I can see developments
coming up which would benefit from a separate transaction or more ...
something which ADOdb can't cope with anyway, only allowing one call to
fbird_trans, but can the PHP driver handle multiple transaction IDs anyway?
--
Lester Caine - G8HFL
-----------------------------
Contact - https://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - https://lsces.co.uk
EnquirySolve - https://enquirysolve.com/
Model Engineers Digital Workshop - https://medw.co.uk
Rainbow Digital Media - https://rainbowdigitalmedia.co.uk