Dyslexic Fingers

Like I told Jeff and Amy earlier:

I ran UPDATE phpbb_posts SET poster_id = 861 WHERE poster_id =701; when I should have run UPDATE phpbb_posts SET poster_id = 861 WHERE poster_id =710;

The only problem is that user 701 is kinda prolific … when I saw “2206 Rows Affected”, I groaned. This should have been, oh, five rows.

By the end of the week, I’m going to have a script to do the two-phpBB-accounts-into-one merge for me. This is the first time I’ve really screwed it up, and I don’t want to do this again!

Posted December 27th, 2004 in Geekery, [rocksmyfaceoff.net] by Geof F. Morris.

5 comments:

  1. Gary:

    You might want to do something like this in the future..

    SET AUTOCOMMIT=0;–diables automatic updates to disk..

    START TRANSACTION;
    UPDATE phpbb_posts
    SET poster_id = 861
    WHERE poster_id = 701

    –if everything is OK
    COMMIT;
    –else
    ROLLBACK;

  2. Reilly:

    That’s what I was going to say. Always set autocommit off before you do updates, then you can review the changes and rollback if you screwed up.

  3. Geof F. Morris:

    Last I checked, though, MySQL doesn’t support transactions.

    I could be totally full of crap, though.

  4. Gary:

    http://dev.mysql.com/doc/mysql/en/Transactional_Commands.html

  5. Geof F. Morris:

    Ahhhh, nice. Thanks, Gary.

Leave a response:

Note: This post is over 5 years old. You may want to check later in this blog to see if there is new information relevant to your comment.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.