Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point a way to make a VFP app to continuously check if a MySQL table had received new data to provide some actions after?

Hi Experts


Could you point a way to make a VFP app to continuously check if a MySQL table had received new data to provide some actions after?

Just to clear:

My needs is to make an Android smartphone to actualize some MySQL tables (hosted at web) after a customer  request(not the scope of this question) and then the VFP app just need continuously to obtain the request and take some actions at it's own context.

Thanks in advance


Avatar of lcohan
lcohan
Flag of Canada image

I would rather add a MySQL AFTER INSERT trigger on that particular table to perform some action upon new rows addition however if that is not an option...does the table has a CreatedOn or some timestamp column?
Developing the trigger side option in particular if there's no timestamp column on that table...for instance the trigger could increment+write the number of newly inserted row(s) into a lets call it monitor or queue table which then could be queried periodically (not continuously) and if the number there is >0 then "...do something from VFP..." and reset the number to 0.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eduardo Fuerte

ASKER

Hi
Sorry the delay.

Pavel

The VFP app needs to actively check at ever 30 secs. if the MySQL tables (that remains at the web) received new lines and if so, then demands some actions at VFP context.

Like a temporizer that check it from time to time if new lines are added.
OK, then you may use my code and change the delay in the INKEY() function. And, of course with other necessary parts you need in the app.

The 30 secs delay is a good level in which you should connect every time and disconnect after the action is done. In such case you may also better detect a record all internet failures.
Hi

Initially I had thought of putting the functionality into an existing app. I understood from your code that another app should be developed just to check the additions of lines (and then capture the contents of these lines and feed the same VFP tables from the original application, then trigger the necessary actions in the original app)... . is this right?
Yes.
Theoretically you could add a timer to your app and execute the SQL command periodically in this timer.
It has some drawbacks, like lower app stability and additional place where errors can occur. And also this app must possibly be running continuously etc.
To have the SQL data checks outside the app is IMHO better solution.
Pavel

Thank you very much.  I'm going to follow your suggetion!