MySQL Forums
Forum List  »  Turkish

Mysql Trigger çalışma mantığı
Posted by: Mert Çıklabakkal
Date: October 31, 2018 05:36AM

Web tabanlı çok kullanıcılı bir sistem planlıyorum, aklıma takılan bir kısım var;
Bu sistemde A tablosundaki Decimal bir alanı belirli koşulları yerine getiren birden fazla kullanıcının aynı anda alanın bir önceki değerine bağlı olarak arttırması (update etmesi) gerekiyor. Bunu transaction ile uygulama tarafından halletmek belki daha doğru olur ama kısa vadede bunu veri tabanından trigger ile yapmam gerekli.

araştırma sonucu elde ettiğim bilgilere göre:
1) A(soru): Can triggers access tables?
B(Cevap): A trigger can access both old and new data in its own table. A trigger can also affect other tables, but it is not permitted to modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger.

2) -The trigger cache does not detect when metadata of the underlying objects has changed. If a trigger uses a table and the table has changed since the trigger was loaded into the cache, the trigger operates using the outdated metadata.

1. kısım için şunu anladım çok kullanıcılı bir sistemde A kullanıcısı tarafından trigger tetiklendiği anda B Kullanıcısı da tetiklerse, Trigger A kullanıcısı tarafından tetiklendiği için B kullanıcısı tetikleyemeyecek!

Böyle bir durum söz konusu mu?

Değil ise

2. kısım için, bir row için trigger tetiklendikten sonra trigger o row u cache liyor ve trigger çalışırken o row güncellenirse triggerın cache lediği kaydı değiştirmiyor buda yanlış data setlenmesine sebeb olabilir mi?

Şimdiden teşekkürler.

Options: ReplyQuote


Subject
Views
Written By
Posted
Mysql Trigger çalışma mantığı
1439
October 31, 2018 05:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.