|
pfc_timer
|
|
Full name
|
pfc_n_cst_tmgmultiple.pfc_timer
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_timer()
|
Name
|
Datatype
|
lb_deleted
|
boolean
|
ldtm_when
|
datetime
|
li_idx
|
integer
|
li_index
|
integer
|
li_rc
|
integer
|
li_rowcount
|
integer
|
ls_filter
|
string
|
event pfc_timer;call super::pfc_timer;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_timer
//
// Arguments: None
//
// Returns: integer
// 1 - Success
// 0 - Disabled
// -1 - Error
//
// Description:
// Processes all registered objects that have enties where the next time that
// they are to be notified is after the time received.
//
// Note:
// While this process is going on, ignore any timer interrupts that may occur.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
string ls_filter
integer li_rc
integer li_rowcount
integer li_idx = 1
integer li_index
datetime ldtm_when
boolean lb_deleted = False
If of_IsDisabled() Then
// We are busy then reject any timer interrupts
Return 0
End If
If of_IsAutoDisable() Then
// Disable the service.
of_SetDisabled(True)
End If
ldtm_when = datetime(today(),now())
// Filter the datastore
ls_filter = "next_time <= datetime(date('"+ &
string(date(ldtm_when),'[shortdate]')+"'), time('"+ &
string(time(ldtm_when),'[time]')+"'))"
li_rc = ids_list.SetFilter(ls_filter)
li_rc = ids_list.Filter()
li_rc = ids_list.Sort()
// Process any rows that are ready to go
li_rowcount = ids_list.rowCount()
Do While li_idx <= li_rowcount
li_index = ids_list.object.index[li_idx]
If isvalid(inv_tmgregister[li_index].ipo_notify) Then
// Notify the object.
If inv_tmgregister[li_index].ii_notifystyle = TRIGGEREVENT Then
inv_tmgregister[li_index].ipo_notify.TriggerEvent( &
inv_tmgregister[li_index].is_notifyevent)
Else
inv_tmgregister[li_index].ipo_notify.PostEvent( &
inv_tmgregister[li_index].is_notifyevent)
End If
ldtm_when = ids_list.object.next_time[li_idx]
ldtm_when = inv_datetime.of_RelativeDatetime( &
ldtm_when, inv_tmgregister[li_index].il_notifyinterval)
ids_list.object.next_time[li_idx] = ldtm_when
li_idx++
Else
// Update the Support list.
// keep the loop index in the same place so we can get the next row.
// decrement the number of rows.
ids_list.DeleteRow(li_idx)
li_rowcount --
lb_deleted = True
End If
Loop
If lb_deleted Then
// found at least one entry that was no longer valid.
// Recalculate the interval.
of_ReCalcInterval()
End If
If of_IsAutoDisable() Then
// OK to start processing timer interrupts again
of_SetDisabled(False)
End If
Return 1
end event