[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: Exclusive-lock i transakcja
Informacie znalezione w Knowledge Base (www.progress.com/support/)
mfg
Maciej Frackiewicz
mfrackie@comilex.com
Kbase Id:
<<...>>
13974
Title:
<<...>>
Why an EXCLUSIVE-LOCK does not always start a TRANSACTION
<<...>>
Why an EXCLUSIVE-LOCK does not always start a TRANSACTION
In the following three examples, the first will show that no
transaction is active, whereas the second two examples will show an
active transaction. Why?
Example 1:
FIND FIRST customer NO-LOCK.
FOR EACH customer EXCLUSIVE-LOCK:
MESSAGE TRANSACTION.
END.
Example 2:
FOR EACH customer EXCLUSIVE-LOCK:
MESSAGE TRANSACTION.
END.
Example 3:
FIND FIRST customer NO-LOCK.
FOR EACH customer EXCLUSIVE-LOCK:
MESSAGE TRANSACTION.
UPDATE customer.
END.
Example 3:
FIND FIRST customer NO-LOCK.
FOR EACH customer EXCLUSIVE-LOCK:
MESSAGE TRANSACTION.
UPDATE customer.
END.
The answer is:
If you want a FOR EACH to be a transaction, the rule is to put the
TRANSACTION keyword there. If there is no transaction keyword, but
the FOR EACH block contains a FIND... EXCLUSIVE-LOCK on a buffer other
than one in the FOR EACH itself, or an UPDATE/CREATE/DELETE on a
database file (not a workfile, worktable or temptable) then it
defaults to TRANSACTION. If there is an EXCLUSIVE-LOCK on one of the
buffers in the FOR EACH statement, and that buffer is scoped to the
FOR EACH block, then it will also default to TRANSACTION. In the
first example, the CUSTOMER buffer is not scoped to the FOR EACH block
and the keyword TRANSACTION was not used on the FOR EACH statement,
and there were no UPDATE/DELETE/CREATE statements within the block, so
so it does not default to TRANSACTION. The second example has
EXCLUSIVE-LOCK on a buffer that is scoped to the FOR EACH block, so it
does default to TRANSACTION, and the third example has an UPDATE
statement, so it also defaults to TRANSACTION.
Progress Software Technical Support Note # 13974
> -----Ursprüngliche Nachricht-----
> Von: Siergiej Szablykin [SMTP:SSzablykin@lukas.com.pl]
> Gesendet am: Montag, 28. August 2000 13:10
> An: progress@zeto.bydgoszcz.pl
> Betreff: Exclusive-lock i transakcja
>
> W dokumentacji Progress'a napisano, ze transakcja rozpoczyna sie miedzy
> innymi kiedy mamy exclusive-lock na rekordzie w tabeli w bazie. Natomiast
> kod ponizej wykazuje, ze raczej nie zawsze jest to prawda (zamiast tabeli
> _File mozna uzyc jaka kolwiek inna tabele). Czy moze u kogos innego
> wystepuje taka sytuacja? Czy moze ktos wie czy mozna znalezc opis danego
> zachowania w dokumentacji? [Problem znika gdy odkomentujemy opcje
> "transaction".]
>
> Platforma:
> Progress 8.3a (nie pamietam patch)
> PC - Win32 Intel
> WinNT 4.0, Win95, Win98
>
>
> /********************************/
> for first _file exclusive-lock:
> message transaction
> view-as alert-box.
> end.
>
> run a.
>
> procedure a:
> for first _file exclusive-lock /*transaction*/ :
> message transaction
> view-as alert-box.
> end.
> end procedure.
> /********************************/
>
>
> ------
> Strona WWW: http://pluton.pol.lublin.pl/pugpl/index.htm
> Obsluga listy: listserv@zeto.bydgoszcz.pl
> Archiwum listy: http://www.zeto.bydgoszcz.pl/progress/index.html
> ------
------
Strona WWW: http://pluton.pol.lublin.pl/pugpl/index.htm
Obsluga listy: listserv@zeto.bydgoszcz.pl
Archiwum listy: http://www.zeto.bydgoszcz.pl/progress/index.html
------