因此,你们需要的是:
- one and only one user can have a certain free part id somewhere on the page. It is not allowed to have the user open the form and let them fill out details and then have the process fail after submitting the page due to for example, number already taken by another user.
- this already rules out the standard mechanisms used in apex. Concurrency and lost update checks only happen in the DML processing point, usually on submit after computations and validations.
- i was thinking about marking a row which a user selects for updating. However, this would also have to be undone. That is okay as long as a user actually clicks the Cancel button, but you can t catch other events without an extra framework. Even then, you can only catch browser events. If the user would shoot down the browser process or even crash, what will happen with the marked record!? It ll just sit there, waiting for a developer to fix this, or not realizing they never actually ran out of numbers.
- maybe it d be possible to write an own locking mechanism: create a lock onload of the page. Name this lock after the chosen part id, so it can be checked against. Another onload process on this page should check a lock on the input id. If a lock exists, then fail and do something, like a redirect. A created lock can also be given a timeout, so this would actually provide a backup for crashing browsers and computers. You d then need to remove this lock when the user cancels the operation. Clicking away through breadcrumbs or navigation is still not caught, but you could rely on the lock timeout. Or use a framework extension such as the Skillbuilders save before exit. You could then use a page process to remove the lock on the different exit events (through ajax calls). The solution would still not be 100% optimal though. An example would be where there is only 1 record left, and a user wants to assign something. However, a lock is still timing out for some reason, so the user gets an error message and so is led to believe no ids are left. Again, this may be solved by providing a more detailed error message, stating there are numbers left but are currently locked ("try again later"? - :-/ )
这些事情在我头上刚刚起作用。 我曾尝试过一些东西,如挑选来更新,但并没有工作。 值得注意的是,一旦整块被拆除,24小时就被释放。
我正在想一味地找到一些东西,但实实在在没有。 我只字不提这一要求(我说了吗?),这样一来也就 st了如何最好地解决这一问题。
Edit: i 记住i ve used dbms_locks some where in the past 5 years, 或许你应当尝试这样做。 但是,DBMS_LOCK在工作期间(这里有 d)无权使用。 因此,请见rel=“nofollow”
你们做的是:建立后载人程序,并在那里建立排他性锁(你当然不想分享任何东西)。 你们希望,这一id子对挑选出来的那部分人来说是独一无二的。 • 确保要么在锁定时停工(如果是LexWAIT=永远!) 或者有一个取消锁闭的程序,这样,你就能够摆脱麻烦。
-- this is just a handle though, not the actual lock
dbms_lock.allocate_unique(lockname => lock_part_ ||company1_part_id,
lockhandle => v_lockhandle,
expiration_secs => 300 -- 5 mins
);
-- request does the actual lock,
-- so this ll give errors when called for the same lockhandle
-- and a lock is already in effect
v_result := dbms_lock.request(lockhandle => v_lockhandle,
lockmode => dbms_lock.x_mode,
timeout => 0 -- fail instantly and don t wait to put a lock if already locked,
release_on_commit => true/false -- try both, not sure if it ll work with TRUE
);
release_on_commit
Set this parameter to TRUE to release the lock on
commit or roll-back.
Otherwise, the lock is held until it is explicitly released or until
the end of the session.
如果情况良好,另一场会议则由于你创造的锁锁,能够打开同样的大门。 绕过你,必须尝试放弃,但是,它不应该是对现有24小时进行硬性测试,为错误提供适当的反馈。
DBMS_LOCK.request
Return Values
表70-10 职务回报价值
Return Value Description
0 Success
1 Timeout
2 Deadlock
3 Parameter error
4 Already own lock specified by id or lockhandle
5 Illegal lock handle
我喜欢开小节,但如果你只用一页就离开你,并且有许多不同的过程,那么,所有习惯都用在这个一页。 或许可以很容易地找到这个系统,但我只能把它看作是一个老板。