Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
My Function Returns Next PO Number - All Good - Can We Lock Table During Execution ? |
Thu, Jan 11 2024 2:56 PM | Permanent Link |
Andrew Hill | I have the following function that works as intended.
Can I impose a Table Lock during execution with auto release - if locked return -1 CREATE FUNCTION "NextPO" () RETURNS INTEGER BEGIN DECLARE NewPO INTEGER; START TRANSACTION ON TABLES 'PoNumber'; BEGIN EXECUTE IMMEDIATE 'SELECT Number INTO ? FROM PoNumber' USING NewPO; SET NewPO = NewPO + 1; EXECUTE IMMEDIATE 'UPDATE PoNumber SET Number = ?' USING NewPO; COMMIT; EXCEPTION SET NewPO = 0; ROLLBACK; END; RETURN NewPO; END VERSION 1.00 |
Wed, Jan 24 2024 1:47 AM | Permanent Link |
Andrew Hill | Still wanting Table Lock/UnLock in stored procedure - please advise - thanks
|
Wed, Jan 24 2024 2:45 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Andrew
Not a full answer by any means but have a look at this section in the manual "7.24 START TRANSACTION!" there is a parameter TIMEOUT which will abort the transaction if the tables can't be locked Roy Lambert |
Thu, Jan 25 2024 1:08 AM | Permanent Link |
Andrew Hill | OK so then START TRANSACTION LOCKS
|
Thu, Jan 25 2024 8:17 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Andrew
I appologise for not realising you didn't know that. The whole point of a transaction is to make multiple changes to a database essentially atomic. Whilst the transaction is in process the tables in use (or the whole database) are locked, changes are made in memory and only when commit is called do they get written to disk. Roy Lambert |
This web page was last updated on Wednesday, August 14, 2024 at 02:26 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |