Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #2126 > unrolled thread

Monitoring a DBF

Started byMartin <spam@spam.spam>
First post2011-10-03 10:14 +0100
Last post2011-10-03 15:28 +0100
Articles 7 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Monitoring a DBF Martin <spam@spam.spam> - 2011-10-03 10:14 +0100
    Re: Monitoring a DBF Martin <spam@spam.spam> - 2011-10-03 10:43 +0100
      Re: Monitoring a DBF "Willie Moore" <williem@wmconsulting.com> - 2011-10-03 08:12 -0500
    Re: Monitoring a DBF "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-10-03 20:50 +1100
      Re: Monitoring a DBF Martin <spam@spam.spam> - 2011-10-03 15:28 +0100
    Re: Monitoring a DBF Mathias <mathias.hakansson@consultec.se> - 2011-10-03 02:57 -0700
      Re: Monitoring a DBF Martin <spam@spam.spam> - 2011-10-03 15:28 +0100

#2126 — Monitoring a DBF

FromMartin <spam@spam.spam>
Date2011-10-03 10:14 +0100
SubjectMonitoring a DBF
Message-ID<22fiq.2241$S22.1137@newsfe13.ams2>
OK I now have the following issue, I need to monitor a DBF for new 
records, I would poll it every 10 seconds to 2 minutes or so.

What is the most sensible way of doing this.

Reason is we are installing a big barcode system and I need to drive a 
VO executable from the main barcode system which is doing the monitoring 
(1 route in for barcodes). This will write into a log which the VO 
program will monitor.

[toc] | [next] | [standalone]


#2128

FromMartin <spam@spam.spam>
Date2011-10-03 10:43 +0100
Message-ID<ftfiq.1305$KQ5.636@newsfe04.ams2>
In reply to#2126
I am so stupid sometimes. Do not need a thread for this but how about 
Timer() callback?

On 03/10/2011 10:14, Martin wrote:
> OK I now have the following issue, I need to monitor a DBF for new
> records, I would poll it every 10 seconds to 2 minutes or so.
>
> What is the most sensible way of doing this.
>
> Reason is we are installing a big barcode system and I need to drive a
> VO executable from the main barcode system which is doing the monitoring
> (1 route in for barcodes). This will write into a log which the VO
> program will monitor.

[toc] | [prev] | [next] | [standalone]


#2131

From"Willie Moore" <williem@wmconsulting.com>
Date2011-10-03 08:12 -0500
Message-ID<j6ccbl$4v8$1@speranza.aioe.org>
In reply to#2128
Martin,

I have used timers to handle things like this. The code below is the 
framework I used for my batch monitoring job. The main window was a modeless 
dialog window. In it's postint you would start the timer. I hope that this 
helps.

Regards,
Willie

METHOD Dispatch(oE) CLASS gr8MO

    IF oE:Message == WM_TIMER
        // If we get a timer message, call our timer event
        SELF:runproc()
    ELSEIF oE:Message == WM_DESTROY
        // If a timer is still active
        IF SELF:nTimerHandle > 0
            // Kill it
            KillTimer(SELF:handle(),1)
        ENDIF
    ENDIF
    // Now continue with deafult processing
    RETURN SUPER:dispatch(oE)

METHOD StartTimer() AS VOID PASCAL CLASS gr8MO
      // If there is no timer active
    IF SELF:nTimerHandle == 0
          // Create a new times
          SELF:nTimerHandle := 
SetTimer(SELF:handle(),1,DWORD(SELF:nTimeOut),NULL_PTR)
          // Call the timer Method
          SELF:timer()
          SELF:lTimerInit    := TRUE
    ENDIF
    RETURN

METHOD StopTimer() AS VOID PASCAL CLASS GR8MO
    // If a timer is active
    IF SELF:nTimerHandle > 0
        // Kill the timer
        KillTimer(SELF:handle(),1)
        // Reset the timer handle
        SELF:nTimerHandle := 0
        SELF:lTimerInit    := FALSE
    ENDIF
    RETURN

METHOD RunProc() AS VOID PASCAL CLASS GR8MO
    LOCAL oError        AS USUAL
    LOCAL bErrBlock     AS CODEBLOCK
    LOCAL cReturnText    AS STRING
    LOCAL lLeave        AS LOGIC
    LOCAL nNewMemCount    AS LONG
    LOCAL hResult        AS LONG

    bErrBlock := ErrorBlock({|oErr| _Break(oErr)})
    BEGIN SEQUENCE
        lLeave := FALSE
        SELF:StopTimer()

// put your code here


    RECOVER USING oError
        // your error handling goes here
    END SEQUENCE
    ErrorBlock(bErrBlock)

     SELF:StartTimer()         // go back to sleep till we are needed again

    RETURN


[toc] | [prev] | [next] | [standalone]


#2129

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-10-03 20:50 +1100
Message-ID<9yfiq.3462$7r4.2397@viwinnwfe02.internal.bigpond.com>
In reply to#2126
Martin

> What is the most sensible way of doing this.

If your not recycling deleted records in the DBF then all you need do is 
track the file size of the DBF - it'll only change when a record is added 
(at least in theory<g>).

Why don't you set something up as a service which signals the 'barcode' app 
that somethings changed in the DBF.

No idea what you mean by '(1 route in for barcodes)'.

CYA
Steve 

[toc] | [prev] | [next] | [standalone]


#2132

FromMartin <spam@spam.spam>
Date2011-10-03 15:28 +0100
Message-ID<%Djiq.1348$155.1117@newsfe09.ams2>
In reply to#2129
Timer was what I needed - used it before but I had forgotten

One route in is loads of guns but only one monitoring station.

On 03/10/2011 10:50, Stephen Quinn wrote:
> Martin
>
>> What is the most sensible way of doing this.
>
> If your not recycling deleted records in the DBF then all you need do is
> track the file size of the DBF - it'll only change when a record is added
> (at least in theory<g>).
>
> Why don't you set something up as a service which signals the 'barcode' app
> that somethings changed in the DBF.
>
> No idea what you mean by '(1 route in for barcodes)'.
>
> CYA
> Steve
>
>

[toc] | [prev] | [next] | [standalone]


#2130

FromMathias <mathias.hakansson@consultec.se>
Date2011-10-03 02:57 -0700
Message-ID<29892709.2319.1317635874855.JavaMail.geo-discussion-forums@yqbr29>
In reply to#2126
An alternative way of doing it is to save the date and time så that you can seek out the new records since the last execution. Then you either blank the time and date or set a status to yet another field to tell the system that the record has been processed.

/Mathias

[toc] | [prev] | [next] | [standalone]


#2133

FromMartin <spam@spam.spam>
Date2011-10-03 15:28 +0100
Message-ID<uEjiq.1349$155.134@newsfe09.ams2>
In reply to#2130
Code is easy - I had just forgotten  METHOD Timer()

On 03/10/2011 10:57, Mathias wrote:
> An alternative way of doing it is to save the date and time så that you can seek out the new records since the last execution. Then you either blank the time and date or set a status to yet another field to tell the system that the record has been processed.
>
> /Mathias

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web