بتاريخ: 28 مارس 200619 سنة comment_64551 السلام عليكمعند دخول اي مستخدم الى الفورم يسجل وقت الدخول والتاريخ واسم الفورم والعمليات التي قام بها من حذف وتعديل واضافة ولما يخرج من الفورم انا كاتب كود في الترجر key-exit من اجل تخزين وقت الخروج وهذا الكودupdate user_events set log_out_time =v_log_out_timewhere user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;commit_form;طبعا المتغيرات معرفة وقيمها موجودة ويعمل صح وعند الخروج يخزنولكن المشكلة هو انني في نفس هذا الترجر كاتب كود بحيث اذا دخل المستخد الفورم وعمل تغييرات وخرج دون ان يعمل commit يساله الفورم اذا اراد التخزين اذا اختار نعم يعمل commit ويخرج واذا اختار لا يخرج من دون commitالمشكلة : هو اذا عمل تغييرات وكبس خروج ينفذ الترجر key-exit ويسجل وقت الخروج ويعمل commit ولا يساله طبعا هل تريد حفظ التغييرات لانه يكون نفذ جملة commitفي الاعلىكيف ممكن احل المشكلة او وين ممكن اكتب الكود الذي يسجل وقت الخروج من الفورم غير هذا المكان لتفادي هذه المشكلةمع جزيل الشكر تقديم بلاغ
بتاريخ: 28 مارس 200619 سنة comment_64573 هلا اخي مبدأ يوجد حل لمشكلتك ولكن لا تنسي ان هذه الفكره اصلا بها مشاكل في حالة حدوث انهاء غير طبيعي للديفلوبر مثل حدوث اغلاق مفاجئ للفورمز او للجهاز اما الحل فيكمن في انشاء داله باستخدام PRAGMA AUTONOMOUS_TRANSACTION;وهذا شرح سريع لها من اوراكل هيلب A transaction is a series of SQL statements that does a logical unit of work. Often, one transaction starts another. In some applications, a transaction must operate outside the scope of the transaction that started it. This can happen, for example, when a transaction calls out to a data cartridge. An autonomous transaction is an independent transaction started by another transaction, the main transaction. Autonomous transactions let you suspend the main transaction, do SQL operations, commit or roll back those operations, then resume the main transaction. Figure 5-1 shows how control flows from the main transaction (MT) to an autonomous transaction (AT) and back again. Figure 5-1 Transaction Control Flow Advantages of Autonomous Transactions Once started, an autonomous transaction is fully independent. It shares no locks, resources, or commit-dependencies with the main transaction. So, you can log events, increment retry counters, and so on, even if the main transaction rolls back. More important, autonomous transactions help you build modular, reusable software components. For example, stored procedures can start and finish autonomous transactions on their own. A calling application need not know about a procedure's autonomous operations, and the procedure need not know about the application's transaction context. That makes autonomous transactions less error-prone than regular transactions and easier to use. Furthermore, autonomous transactions have all the functionality of regular transactions. They allow parallel queries, distributed processing, and all the transaction control statements including SET TRANSACTION. Defining Autonomous Transactions To define autonomous transactions, you use the pragma (compiler directive) AUTONOMOUS_TRANSACTION. The pragma instructs the PL/SQL compiler to mark a routine as autonomous (independent). In this context, the term routine includes top-level (not nested) anonymous PL/SQL blocks local, stand-alone, and packaged functions and procedures methods of a SQL object type database triggers You can code the pragma anywhere in the declarative section of a routine. But, for readability, code the pragma at the top of the section. The syntax follows: PRAGMA AUTONOMOUS_TRANSACTION; In the following example, you mark a packaged function as autonomous: CREATE PACKAGE banking AS ... FUNCTION balance (acct_id INTEGER) RETURN REAL; END banking; CREATE PACKAGE BODY banking AS ... FUNCTION balance (acct_id INTEGER) RETURN REAL IS PRAGMA AUTONOMOUS_TRANSACTION; my_bal REAL; BEGIN ... END; END banking; Restriction: You cannot use the pragma to mark all subprograms in a package (or all methods in an object type) as autonomous. Only individual routines can be marked autonomous. For example, the following pragma is illegal: CREATE PACKAGE banking AS PRAGMA AUTONOMOUS_TRANSACTION; -- illegal ... FUNCTION balance (acct_id INTEGER) RETURN REAL; END banking; In the next example, you mark a stand-alone procedure as autonomous: CREATE PROCEDURE close_account (acct_id INTEGER, OUT balance) AS PRAGMA AUTONOMOUS_TRANSACTION; my_bal REAL; BEGIN ... END; In the following example, you mark a PL/SQL block as autonomous: DECLARE PRAGMA AUTONOMOUS_TRANSACTION; my_empno NUMBER(4); BEGIN ... END; مع تمنياتي بالتوفيق Restriction: You cannot mark a nested PL/SQL block as autonomous. In the example below, you mark a database trigger as autonomous. Unlike regular triggers, autonomous triggers can contain transaction control statements such as COMMIT and ROLLBACK. CREATE TRIGGER parts_trigger BEFORE INSERT ON parts FOR EACH ROW DECLARE PRAGMA AUTONOMOUS_TRANSACTION; BEGIN INSERT INTO parts_log VALUES(:new.pnum, :new.pname); COMMIT; -- allowed only in autonomous triggers END; Autonomous versus Nested Transactions Although an autonomous transaction is started by another transaction, it is not a nested transaction for the following reasons: It does not share transactional resources (such as locks) with the main transaction. It does not depend on the main transaction. For example, if the main transaction rolls back, nested transactions roll back, but autonomous transactions do not. Its committed changes are visible to other transactions immediately. (A nested transaction's committed changes are not visible to other transactions until the main transaction commits.) تقديم بلاغ
بتاريخ: 28 مارس 200619 سنة comment_64575 السلام عليكم هقولك فكرة بس موش جربتها بصراحة يعني ممكن تشتغل و ممكن لا ضع الكود الذي يشيك ااذ كان عمل تغييرات فيسأل اذا كان يريد الحفظ ام لا قبل الكود الذي يسجل وقت الخروج فاذا كان يريد الحفظ اعمل كوميت اما اذا كان لايردي الحفظ فاعمل rollback او clear_form; بدلا من الخروج من الفورم قبل ان تسجل وقت الخروج و سيكون قد تم مسح التغييرات ثم سجل وقت الخروج بعد هذه العملية قولي لو جربتها كدة اشتغلت و لا لا بالتوفيق تقديم بلاغ
بتاريخ: 28 مارس 200619 سنة كاتب الموضوع comment_64579 السلام عليكممشكور يا اخي بلاك اند وايتانا قرات الموضوع وفهمت بشكل عام ولكن بصراحة مش عارف شو اعمل بالضبطيعني عندك فكرة شو المطلوب عمله وايش لازم اغير وشكرا على الرد وبارك الله فيك تقديم بلاغ
بتاريخ: 28 مارس 200619 سنة comment_64584 اخي الكريم جرب كود تخزين الخروج في ترريجر post-logoutهذا التريجر ينفذ عند الخروج نهائيا من الفورم او لحظة الخروجطبعا جرب التريجر على مستوى الفورم تقديم بلاغ
بتاريخ: 29 مارس 200619 سنة كاتب الموضوع comment_64675 السلام عليكماخي الكريم adminوضعت كود التخزين على الترجر post-logout وما زبط اي ما خزن وقت الخروج اما عندما كان في الترجر ke y-exit كان يخزن تقديم بلاغ
بتاريخ: 29 مارس 200619 سنة كاتب الموضوع comment_64680 مشكيرون يا شباب نجت الطريقة اللي نصحني بها الاخ mustafa76 وهي اعادة ترتيب الكود كالتاليdeclarealert_number number;v_login_date date;v_log_out_time varchar2(100);v_log_in_time varchar2(100);v_form_name varchar2(100);beginglobal_pkg.set_log_out_time(to_char(SYSDATE,'hh24:MI:ss')); v_log_out_time:=global_pkg.get_log_out_time;v_login_date:=global_pkg.get_login_date;v_log_in_time :=global_pkg.get_log_in_time;v_form_name :=global_pkg.get_form_name; ------------------------------------------if :system.form_status ='CHANGED' THENalert_number:=show_alert('exit_alert');if alert_number=alert_button1 thenalert_number:=show_alert('save');if alert_number=alert_button1 thenupdate user_events set log_out_time =v_log_out_timewhere user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;commit_form;exit_form;elsif alert_number=alert_button2 thenupdate user_events set log_out_time =v_log_out_timewhere user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;forms_ddl('commit');exit_form(no_validate);else null;end if;--end of save alertend if;--end of exit alertelsif :system.mode = 'ENTER-QUERY' then Set_Block_Property(:system.cursor_block,CURRENT_RECORD_ATTRIBUTE ,'default');exit_form;elseupdate user_events set log_out_time =v_log_out_timewhere user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;forms_ddl('commit');exit_form;end if;end ;/*declarealert_number number;v_login_date date;v_log_out_time varchar2(100);v_log_in_time varchar2(100);v_form_name varchar2(100);beginglobal_pkg.set_log_out_time(to_char(SYSDATE,'hh24:MI:ss')); v_log_out_time:=global_pkg.get_log_out_time;v_login_date:=global_pkg.get_login_date;v_log_in_time :=global_pkg.get_log_in_time;v_form_name :=global_pkg.get_form_name;update user_events set log_out_time =v_log_out_timewhere user_name=:global.user_name and login_date=v_login_date and log_in_time=v_log_in_time and form_name=v_form_name;commit_form; ------------------------------------------if :system.form_status ='CHANGED' THENalert_number:=show_alert('exit_alert');if alert_number=alert_button1 thenalert_number:=show_alert('save');if alert_number=alert_button1 thencommit_form;exit_form;elsif alert_number=alert_button2 thenexit_form(no_commit);else null;end if;end if;elsif :system.mode = 'ENTER-QUERY' then Set_Block_Property(:system.cursor_block,CURRENT_RECORD_ATTRIBUTE ,'default');exit_form;elseexit_form;end if;end ; تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.