Subject Re: Send event to client after row edit ?
Author Raúl Alberto Valencia Najarro
Hi, Yossi.

You could do the following:

* Create a TIMESTAMP column in your table. set it to
CURRENT_TIMESTAMP when you create it and every time you change it.

* In the client application, when activating the event, query the
servers' date and time (using CURRENT_TIMESTAMP), and save it to a
variable, property or whatever.

* When you catch the event, query in the table all records in that
the timestamp column is major or equal to the saved timestamp value

* In the same code, update the variable to the server's date and
time. This assures that when the event is caught again, only the
records that changed since the last event catch.

This has the advantage that all the changed records are retrieved on
a single operation. It saves time and network bandwith.

Of course, you should be careful, keep the server's date and time
accurately at all times! (In the vast majority of cases, this isn't a
problem).

You can accelerate the queryes by creating an index on the column
that holds the timestamp value.

Cheers.

Raúl



> Hi.
>
> On the client side I run an application with customers list with
there
> balances,
> I want to notify all the clients when some client updates the
customer row
> in the Database, I only want to notify the clients that a specific
row was
> updated, when the client will get the event that one row was
updated it will
> query the database for this row only so I will not have to run the
all
> query again and fetch all the rows (That is what I do today, I Post
Event in
> the After Update trigger my clients gets the event and refresh the
all view,
> but this takes alot of time and network traffic)
>
> Thanks
> Yossi.