Working With Timers
http://blog.ebiztechnics.com
Objectives
• Describe Timer
• Usage of timer
• Create timer
• Modify timer
• Handle timer expiration
• Delete timer
http://blog.ebiztechnics.com
Timers
• What is a timer?
A timer is an "internal time clock" that you programmatically create
to perform an action each time the timer expires.
• Built-ins used:
– FIND_TIMER
– CREATE_TIMER
– SET_TIMER
– DELETE_TIMER
– GET_APPLICATION_PROPERTY
(TIMER_NAME)
http://blog.ebiztechnics.com
Usage of Timers
• WHEN-TIMER-EXPIRED Trigger.
• Using timers:
– Periodically query, commit, or rollback
– Show “About…” information at startup
– Display ticker messages
– Display running time
http://blog.ebiztechnics.com
Handling Timer Expiration
Start
(R)
T1
When-Timer-Expired (A)
Query
issued
Timer T2
expired T2
Timer T1
expired
(R)
T2,T1
Completed
When-Timer-Expired (T2)
When-Timer-Expired (T1)
Timer T1
created
Timer T2
created
Timer T1
expired
http://blog.ebiztechnics.com
Creating a Timer
• Syntax:
• Example:
CREATE_TIMER (timer_name, milliseconds, iterate)
v_timer_id := CREATE_TIMER (‘Time1’, 300,repeat);
http://blog.ebiztechnics.com
Modifying a Timer
• Syntax:
• Example:
SET_TIMER (timer_name, milliseconds, iterate)
SET_TIMER (timer_id, milliseconds, iterate)
SET_TIMER (‘Time1’, no_change, no_repeat);
http://blog.ebiztechnics.com
Delete Timer
• Syntax:
DELETE_TIMER (timer_name)
DELETE_TIMER (timer_id)
...
IF NOT ID_NULL (FIND_TIMER (‘Time1’)) THEN
DELETE_TIMER (’Time1’);
END IF;
...
http://blog.ebiztechnics.com
Find Timer Expiration
• Example:
IF GET_APPLICATION_PROPERTY(TIMER_NAME)=‘Time1’
THEN
Select . . . . .
From t1;
ELSE
:control.time_disp:=:SYSTEM.CURRENT_DATETIME;
END IF;
http://blog.ebiztechnics.com
Summary
• Create and modify a timer with built-in
functions
– FIND_TIMER
– CREATE_TIMER
– SET_TIMER
– DELETE_TIMER
– GET_APPLICATION_PROPERTY
(TIMER_NAME)
http://blog.ebiztechnics.com

Oracle Forms : Timers

  • 1.
  • 2.
    Objectives • Describe Timer •Usage of timer • Create timer • Modify timer • Handle timer expiration • Delete timer http://blog.ebiztechnics.com
  • 3.
    Timers • What isa timer? A timer is an "internal time clock" that you programmatically create to perform an action each time the timer expires. • Built-ins used: – FIND_TIMER – CREATE_TIMER – SET_TIMER – DELETE_TIMER – GET_APPLICATION_PROPERTY (TIMER_NAME) http://blog.ebiztechnics.com
  • 4.
    Usage of Timers •WHEN-TIMER-EXPIRED Trigger. • Using timers: – Periodically query, commit, or rollback – Show “About…” information at startup – Display ticker messages – Display running time http://blog.ebiztechnics.com
  • 5.
    Handling Timer Expiration Start (R) T1 When-Timer-Expired(A) Query issued Timer T2 expired T2 Timer T1 expired (R) T2,T1 Completed When-Timer-Expired (T2) When-Timer-Expired (T1) Timer T1 created Timer T2 created Timer T1 expired http://blog.ebiztechnics.com
  • 6.
    Creating a Timer •Syntax: • Example: CREATE_TIMER (timer_name, milliseconds, iterate) v_timer_id := CREATE_TIMER (‘Time1’, 300,repeat); http://blog.ebiztechnics.com
  • 7.
    Modifying a Timer •Syntax: • Example: SET_TIMER (timer_name, milliseconds, iterate) SET_TIMER (timer_id, milliseconds, iterate) SET_TIMER (‘Time1’, no_change, no_repeat); http://blog.ebiztechnics.com
  • 8.
    Delete Timer • Syntax: DELETE_TIMER(timer_name) DELETE_TIMER (timer_id) ... IF NOT ID_NULL (FIND_TIMER (‘Time1’)) THEN DELETE_TIMER (’Time1’); END IF; ... http://blog.ebiztechnics.com
  • 9.
    Find Timer Expiration •Example: IF GET_APPLICATION_PROPERTY(TIMER_NAME)=‘Time1’ THEN Select . . . . . From t1; ELSE :control.time_disp:=:SYSTEM.CURRENT_DATETIME; END IF; http://blog.ebiztechnics.com
  • 10.
    Summary • Create andmodify a timer with built-in functions – FIND_TIMER – CREATE_TIMER – SET_TIMER – DELETE_TIMER – GET_APPLICATION_PROPERTY (TIMER_NAME) http://blog.ebiztechnics.com

Editor's Notes

  • #4 Technical Note Timers are not suitable means of shutting down an application. It is the job of The operating system to recognize idle process and shut them down.
  • #5 Web Design Tip You should restrict the frequency of timers in Web-Deployed forms in order To reduce a potential increase in network traffic. Replacing timers with JavaBeans, which provide similar functionality, will benefit users as code Would be executed on the Web client without invoking network traffic.