in reply to Tailing a database table via DBI

Run a program from cron that selects the count(*) of rows from that table. If that differs from the number stored from the last run, use a LIMIT clause to choose the new rows.

Update: Yes, this idea does rely on insertion order. Instead of thinking it, I should have said that it is a fragile hack.

Replies are listed 'Best First'.
Re: Re: Tailing a database table via DBI
by talexb (Chancellor) on Apr 22, 2002 at 01:20 UTC
    I don't think a limit modifier will work to provide the 'most recently added' records in this instance since the location of the new rows is not guaranteed to be at the bottom of the table.

    I imagine (and may well be corrected on this) that MySQL adds new rows to any 'previously deleted' row locations, and if there are none, MySQL then adds them to the end of the table. If you're very lucky and rows are added to the table and never deleted, your method may work correctly, but I don't believe that it's a 'production ready' method.

    --t. alex

    "Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny