Recent

Author Topic: Database trigger/monitor without polling  (Read 2773 times)

LittleBritaly

  • New Member
  • *
  • Posts: 24
Database trigger/monitor without polling
« on: March 17, 2014, 09:08:57 am »
I'm looking for a way to monitor a mysql table for changes without polling every second or so.

At the moment I'm using Lnet to send a message to a (local network) server, which then polls the database and prints off an order (it's the only machine on the local network with a printer).

The database is not stored locally (it's at our web url) and I'm unhappy with relying on a communication connection between the two machines on the  local network.

I'd much rather have the 'print server' be able to monitor a table / receive a push notification, is there a cleaner way to do this with Lazarus (even changing the database engine if required).


BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Database trigger/monitor without polling
« Reply #1 on: March 17, 2014, 09:21:06 am »
Not a Mysql guy... perhaps MySQL provides some kind of trigger mechanism which can call an external executable/connect to a port and send data/etc.

Both Firebird and PostgreSQL support events and Lazarus/FPC's sqldb (as well as Zeos, I think) offer support for that mechanism:

http://wiki.lazarus.freepascal.org/Firebird_in_action#Monitoring_Events

http://wiki.lazarus.freepascal.org/postgresql#Event_monitoring
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018