Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    15

    Unanswered: transaction in mysql

    hallo, I am quite a newbe in mysql, so sorry for disturbing... I need to use transaction on mysql and I am confused by documentation - because i have found really few articles about it.

    1) I need to use transaction to be done once per month and I have decided to do so with windows schleduled task run every time I need calling mysql through command promnt - parameters will be name of txt file where transaction will be written - hope it is good idea??

    My question is - in this case I must use just clear SQL , neednt I? So, if I start transaction with BEGIN TRANSACTION , then write sequence of SQL statmens , how do I realize if all was succesfull or not to call properly ROLLBACK or COMMIT???? I am really confused by this.

    I need some example, but I was really unsuccessfull finding it.

    2) I am building DB model in CASESTUDIO - this is not too much mysql question, but - does anybody know how to make CASESTUDIO in mysql DB creating mode create mysql-innodb table to be able to use transaction?


    if anybody could help me, I would be really happy. If you want contact me on ICQ 52633915

    thanks a lot, Polp

  2. #2
    Join Date
    Jan 2003
    Location
    Paris, France
    Posts
    320
    You should use INNODB tables to use transactionnal model.
    With innodb table type you can use transaction mode and foreign key constraint

    Code:
    User1 
    Set autocommit = 0 ;
    
    Update users set age=25 where id = 1;
    
    commit
    
    delete from salles where idsale = 1;
    
    select * from salles where idsale = 1;
    
    Empty set
    
    Rollback;
    
    select * from salles where idsale = 1;
    
    idsalle   num    refuser
    
    1         AC3    Null
     User2
    Set autocommit = 0 ;
    
    Select age from users where id = 1;
    
    Age
    23
    
    Commit 
    
    Select age from users where id = 1;
    
    Age
    25
    
    select * from salles where idsale = 1;
    
    idsalle   num    refuser
    
    1         AC3    Null
    You can find more information on innodb configuration here
    http://www.lasso-developpeur.net/us/...tab=db&lang=us
    Olivier Miossec
    --
    http://www.lasso-developpeur.net/
    --

Posting Permissions

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