Loading ...
Sorry, an error occurred while loading the content.

Re: [extremeperl] shouldn't all datatables be timestamped?

Expand Messages
  • Ed Grimm
    ... Disclaimer: I code for an LDAP database, not a MySQL database. However, I think many principles still hold... Somehow, the natural thing to me would be to
    Message 1 of 5 , Feb 13, 2005
    • 0 Attachment
      On Thu, 10 Feb 2005, chromatic wrote:
      > On Tue, 2005-01-11 at 01:23 +0000, Terrence Brannon wrote:
      >
      >> During development, I often want to quickly see if a table just
      >> successfully inserted a new record.
      >>
      >> In MySQL, a field can be used this way. Are there any drawbacks to
      >> using such a field? Of course inserts will be a bit slower. But it is
      >> certainly useful in a dev environment.
      >
      > I prefer to count the number of rows before and after an operation
      > instead of relying on the side effect of a change to hint that the right
      > thing happened.

      Disclaimer: I code for an LDAP database, not a MySQL database. However,
      I think many principles still hold...

      Somehow, the natural thing to me would be to check for the data you're
      trying to add before you add it, verifying that it's not there, and then
      check for it after you add it, and verify that it's there. During a
      unit test of the database itself, I'd also check to make certain that
      the row counts have changed, and possibly, if I was being pedantic,
      checking the rest of the entries to make certain they've not vanished.

      But, if I'm not testing the database itself, and merely testing my code
      to work with the database, the fact that the new data is now in the
      database, and it wasn't before, is certainly sufficient for me to feel
      the data was, in fact, added.

      So far, this has only failed one time, when a coworker decided to have a
      process read the audit log, look for my additions, and delete them.
      (Given that my investigation technique was to check the logs, this
      didn't have quite the result he was looking for.)

      Ed
    Your message has been successfully submitted and would be delivered to recipients shortly.