Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
9
Erster Beitrag:
vor 4 Jahren, 6 Monaten
Letzter Beitrag:
vor 4 Jahren, 6 Monaten
Beteiligte Autoren:
Tor-Bjarne, Fabrice Harari, Paulo Oliveira, Yogi Yang

Events from database

Startbeitrag von Tor-Bjarne am 08.10.2013 09:05

Hi,

I recently got som VS projects running against Sybase that I`m working with.

The guys writing this projects has managed to get events into VS from the database, cind of, like a trigger - but - all the different apps that are connected get`s a event when tables are changed.

The way they solved this was greating an Insert/update/delete trigger on every table - then - the trigger code sends a message via the connection to all connected apps. (Event-Message is someting like: Insert,tablename,recordid)

This way allication A will notify application B that a change was performed on table X (If application B care or are started).
If application B need to react on a table insert from application A it gets an envent that trigger App B to do something.
(and if app B has some action perhaps app A need to be notifyed (if it care or are started)
If I like to write Application C at a later stage I only need to listen to for an event if I need to react on a table-insert.

I solved similar functionality in WinDev agains MS-SQL where I create a table and let the trigger insert a record into a sync table (synctable is Tablename,action,recordid) - then I can check this table to see if another app/user has added or modified a record - But I need to check, the first approach I only write an On-event - do something, in my second solution I need to check the sync table at a regular time(r).

Now I like to use same functionallity in an Hyperfile C/S solution and my question is: Is there a way to send events/messages via the connection in Hyperfile C/S ?

Cheers
Tor-Bjarne

Antworten:

never done it but maybe HSendMessageToClient, HOnServerCall functions and server triggers can help you.

von Paulo Oliveira - am 08.10.2013 11:35
I think this is possible in PostgreSQL. So if you can change you database then try to adopt pgSQL :)

von Yogi Yang - am 08.10.2013 14:24
Hi,

Thank you for your reply Yogi and Paulo :)

Yogi - PosgreSQL is not an option on this project since I want server sync., easy server install etc. already in the box from PCSoft.

Paulo - This might do the trick, since HOnServerCall actually can run a procedure, this procedure can check a synctable and produce events :)

I Get back to you when class is written and tested ;)

cheers
Tor-Bjarne

von Tor-Bjarne - am 08.10.2013 14:45
Nope - HSendMessageToClient, HOnServerCall functions can not be used in a server-side stored procedure. :(

Cheers
Tor-Bjarne

von Tor-Bjarne - am 08.10.2013 14:53
Hi

as a workaround, instead of having all the apps checking a sync file, you could have a small app running on the server (or a service, even) always checking that file and sending the messages to each client...

Best regards

von Fabrice Harari - am 08.10.2013 15:27
Hi,

Thank you Fabrice - Yes, this would be possible.

Not shure however, how I could send an event from the server to the different PC`s (that I dont know the IP addres to), but I guess there is a way? :)

Cheers
Tor-Bjarne

von Tor-Bjarne - am 09.10.2013 14:42
Hi again

yes, with hsendmesagetoclient and all the associated hxxx functions allowing you to list the clients

ie exactly as described in the previous answer, just NOT from a stored procedure

Best regards

von Fabrice Harari - am 09.10.2013 14:47
Again Fabrice, Thank you :)

Cheers
Tor-Bjarne

von Tor-Bjarne - am 09.10.2013 17:09
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.