You can cook up a completely general solution for this, but it takes application and database changes. Put most simply, you need to maintain a last-modified-time column in any table that you want to mirror. Any code that updates or inserts the table needs to update that column with a time of sufficient resolution for your application (usually down to seconds).

With that data available, you can retrieve all rows that are newer than the last time you looked at the table (presumably you're maintaining the last-lookup time in a separate table -- or even a flat file). The only trick is if that if the tables allow row deletion, you have to store at least the primary key of every deleted row in a counterpart table. You can also try to do "soft deletes", where you only mark a row as ready to be deleted, and don't actually delete it until some point in the future. But that gets even more complicated.

One client I work for has a system like this in place for about a hundred tables in dozens of applications. It takes work, but it's effective, and generalizes to all rdbms platforms.

HTH


In reply to Re: mirroring mySQL database by VSarkiss
in thread mirroring mySQL database by filmo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.