Delphi XE7/XE8 - Refresh in database (real-time update)

Asked

Viewed 1,384 times

2

I have two interconnected systems, one saves a record in the database and another reads the saved record, currently I use a timer to refresh the database in the system it reads, so it takes every 5 seconds what was saved by the other, but I believe it is not the best way. Delphi already has some functionality that allows this type of reading in the database in a "persistent" way or has real time?

Database is Mysql or Firebird (with firedac)

1 answer

4


In general, one can use the events/notifications of the database, the exact term and the implementation depends on the DBMS, as each one uses a mechanism different. Firebird for example, implements this using the instruction POST_EVENT, the Postgresql uses NOTIFY, etc..

With Firedac, you can get alerts using the component TFDEventAlerter, the page Database Alerts (Firedac) of Embarcadero mentions:

The DBMS alert refers to a database notification or alert sent by a database trigger or stored Procedure for the purpose of notifying a database client about some events on the database side.

An alert is identified by name and may include arguments additional. Customers are registering with alerts. Multiple customers can register with a single alert, and a customer can register with multiple alerts. When an alert is flagged in a data, all registered customers will be notified of this. When an alert is no longer used, the application cancels the registration to that warning.

  • 1

    Perfect, that’s what it is!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.