www.webdeveloper.com
Results 1 to 4 of 4

Thread: MySQL rollback

  1. #1
    Join Date
    Jun 2009
    Location
    Chi town. IL68 ICAO code home airport, literally.
    Posts
    153

    Unhappy MySQL rollback

    Hi there,

    I have this issue. Ive been learning SQL for a while now and I am testing out the rollback feature and so i created a simple table and populated it with fake data and created a "savepoint" and then try to rollback to it. My compiler shows it creates the "savepoint" and then when i try to rollback to it, it says it doesnt exsit yet it clearly just created the savepoint with no issue. Im pretty sure i didnt write anything wrong so i am not sure whats going on. Here is the code. If you can take a look and tell me whats wrong that would be greatly appricated!

    Code:
    use learnsql;
    insert into customer_tbl values
    (
    '615', 'FRED WOLF', '109 MEMORY LANE', 'PLAINFEILD', 'IN', '46113', '3175555555', NULL
    );
    
    insert into customer_tbl values
    (
    '559', 'RITA THOMPSON', '125 PEACHTREE', 'INDIANAPOLIS', 'IN', 46248, 3171111111, NULL
    );
    
    insert into customer_tbl values
    (
    '715', 'BOB DIGGLER', '1102 HUNTINGTON ST', 'SHELBY', 'IN', 41234, 3172222222, NULL
    );
    savepoint SAVEPOINT1;
    
    update customer_tbl
    set CUST_NAME ='FRED WOLF'
    where CUST_ID = '559';
    
    update customer_tbl
    set CUST_ADDRESS = 'APT C 4556 WATERWAY'
    where CUST_ID = '615';
    
    update customer_tbl
    set CUST_CITY = 'CHICAGO'
    where CUST_ID = '715';
    
    rollback to SAVEPOINT1;
    
    select*from learnsql.customer_tbl;
    For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,923
    I'll start with the obvious (to me ) first question: does the table in question use the InnoDB storage engine (the only one that supports this feature, I believe)?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2009
    Location
    Chi town. IL68 ICAO code home airport, literally.
    Posts
    153

    resolved

    Yes it does, I figured it out; looks like autocommit was turned on therefore after every action it wiped the saves clean. Thanks though!
    For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.

  4. #4
    Join Date
    Oct 2009
    Posts
    658
    Workbench
    Good Luck

    Santos Systems

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles