You've not said what the criteria are for determining that the two host names are the same. If they're all systems in your control, and you know they map to the same pages, that's much different than just assuming they are because they resolve to the same IP address (which may be virtual hosts, and not the same page). The only way I would think to do it reliably, without any outside knowledge would be to getting the two pages, and comparing them, if the filepath of the URL is the same. (and even then, you might have someone who has virtual hosts set up before HTTP/1.0, where they might have http://host.domain.tld/index.html be the same as http://www.domain.tld/host/index.html.)

If I had a requirement to do something like this, I'd probably just do all of my writes to a temporary table, and have a seperate process that reads from that table, processes the values, and moves them to the real table. ...or do it in a database trigger, but I've never used mySQL 5, so I have no idea what sorts of things you can do in them. (I've never tried doing HTTP requests in PL/SQL but I know it exists

I won't bother with the initial question, as it's already been answered


In reply to Re: INSERT or UPDATE, but only when unique by jhourcle
in thread INSERT or UPDATE, but only when unique by Anonymous Monk

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.