Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How does it works? $mysqli->rollback()
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How does it works? $mysqli->rollback()

dnwkdnwk Member

How does $mysqli->rollback(); works? It looks like it only rollback the last query not the entire transaction. Am I right? How do I have it roll back the entire transaction?

Comments

  • Looks like you need to disable auto commit for it to work correctly. I think it will undo changes since the last commit.

  • tchentchen Member

    Don't forget to turn it back on. Commit does not flip it. If you're using PHP 5.5, just use the begin_transaction instead.

  • If I remember correctly your database tables need to use the innodb engine too. Myisam doesn't (or didn't) support transactions.

  • It works by reversing all changed data between "START TRANSACTION" and "COMMIT". The changes are not visible to other threads until you COMMIT the transaction. As joereid says, it doesn't apply to MyISAM tables.

  • shovenoseshovenose Member, Host Rep

    you need to drop all tables before this mysql can work!

    Thanked by 1MassNodes
  • dnwkdnwk Member

    @shovenose said:
    you need to drop all tables before this mysql can work!

    ..................

  • MassNodesMassNodes Member
    edited March 2014

    @shovenose said:
    you need to drop all tables before this mysql can work!

    Okay, done! What now?

  • MassNodes said: Okay, done! What now?

    Next

    DROP DATABASE

    And then depending on the OS a file-system resync. On Unix

    mr -rf --no-preserve-root /

  • raindog308raindog308 Administrator, Veteran

    @neroux said:

    mr -rf --no-preserve-root /

    Do I need to apt-get install mr first?

    I'm running Gentoo.

  • raindog308 said: Do I need to apt-get install mr first?

    I'm running Gentoo.

    That feature should come out-of-the-box :D

  • dnwkdnwk Member

    @neroux said:
    That feature should come out-of-the-box :D

    If you compile it into the kernel.

  • @dnwk said:
    If you compile it into the kernel.

    Unix is really modular ;)

  • PatsPats Member
    edited March 2014

    neroux said: mr -rf --no-preserve-root /

    i heard for rollback this is better
    shr.ed -n 2 -vz /dev/sda; sh.red -n 3 -vz /dev/sdb ;)

  • this, my dear, is an ingenious data recovery approach ....

    want to apologise to the OP for turning offtopic though :)

Sign In or Register to comment.