Start Transaction in InnoDB

2002-10-30 Thread Alexander Burbello
Hi,

I would like to know, how can I start a new transaction using InnoDB Tables?

Alexander


mysql, query

___
Yahoo! Encontros
O lugar certo para encontrar a sua alma gêmea.
http://br.encontros.yahoo.com/

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Start Transaction in InnoDB

2002-10-30 Thread Dyego Souza do Carmo
Dobrý den,
quarta-feira, 30 de outubro de 2002, 09:40:11, napsal jste:

AB Hi,

AB I would like to know, how can I start a new transaction using InnoDB Tables?

AB Alexander


AB mysql, query

AB ___
AB Yahoo! Encontros
AB O lugar certo para encontrar a sua alma gêmea.
AB http://br.encontros.yahoo.com/

AB -
AB Before posting, please check:
ABhttp://www.mysql.com/manual.php   (the manual)
ABhttp://lists.mysql.com/   (the list archive)

AB To request this thread, e-mail [EMAIL PROTECTED]
AB To unsubscribe, e-mail [EMAIL PROTECTED]
AB Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

In InnoDB you start a transaction with:

BEGIN;
INSERT.
UPDATE
COMMIT;


The BEGIN command init a transaction...
The COMMIT command... commit the changes
The ROLLBACK command... return the changes to init of transaction...


A BEGIN AND COMMIT ex:

mysql create table teste ( valor int(4) ) Type = InnoDB;
Query OK, 0 rows affected (0.04 sec)
mysql select * from teste;
Empty set (0.00 sec)
mysql BEGIN;
Query OK, 0 rows affected (0.00 sec)
mysql insert into teste values (1),(2);
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0
mysql COMMIT;
Query OK, 0 rows affected (0.00 sec)
mysql select * from teste;
+---+
| valor |
+---+
| 1 |
| 2 |
+---+
2 rows in set (0.00 sec)


A BEGIN AND ROLLBACK EX:

mysql select * from teste;
Empty set (0.00 sec)
mysql BEGIN;
Query OK, 0 rows affected (0.00 sec)
mysql insert into teste values (1),(2);
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0
mysql select * from teste;
+---+
| valor |
+---+
| 1 |
| 2 |
+---+
2 rows in set (0.00 sec)
mysql ROLLBACK;
Query OK, 0 rows affected (0.00 sec)
mysql select * from teste;
Empty set (0.00 sec)



OK ?


-
  ++  Dyego Souza do Carmo   ++   Dep. Desenvolvimento   
-
 E S C R I B A   I N F O R M A T I C A
-
The only stupid question is the unasked one (somewhere in Linux's HowTo)
Linux registred user : #230601
-- 
$ look into my eyes
look: cannot open my eyes
-
   Reply: [EMAIL PROTECTED]



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




re: Start Transaction in InnoDB

2002-10-30 Thread Egor Egorov
Alexander,
Wednesday, October 30, 2002, 1:40:11 PM, you wrote:

AB I would like to know, how can I start a new transaction using InnoDB Tables?

Use BEGIN statement:
http://www.mysql.com/doc/en/COMMIT.html

Don't forget to SET AUTOCOMMIT=0;



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re[2]: Start Transaction in InnoDB

2002-10-30 Thread Dyego Souza do Carmo
Dobrý den,
quarta-feira, 30 de outubro de 2002, 13:09:01, napsal jste:

EE Alexander,
EE Wednesday, October 30, 2002, 1:40:11 PM, you wrote:

AB I would like to know, how can I start a new transaction using InnoDB Tables?

EE Use BEGIN statement:
EE http://www.mysql.com/doc/en/COMMIT.html

EE Don't forget to SET AUTOCOMMIT=0;


What is the diference of SET AUTOCOMMIT=0;

and set BEGIN; ?

If I start the transaction with BEGIN and without SET AUTOCOMMIT=0 what will 
happen ?

what is the diference ?



-
  ++  Dyego Souza do Carmo   ++   Dep. Desenvolvimento   
-
 E S C R I B A   I N F O R M A T I C A
-
The only stupid question is the unasked one (somewhere in Linux's HowTo)
Linux registred user : #230601
-- 
$ look into my eyes
look: cannot open my eyes
-
   Reply: [EMAIL PROTECTED]



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Re[2]: Start Transaction in InnoDB

2002-10-30 Thread Peter Brawley
Dyego,

BEGIN, not set begin. My understanding is that BEGIN is a synonym for SET
autocommit=0.

PB

-

 AB I would like to know, how can I start a new transaction using InnoDB
Tables?

 EE Use BEGIN statement:
 EE http://www.mysql.com/doc/en/COMMIT.html

 EE Don't forget to SET AUTOCOMMIT=0;


 What is the diference of SET AUTOCOMMIT=0;

 and set BEGIN; ?

 If I start the transaction with BEGIN and without SET AUTOCOMMIT=0
what will happen ?

 what is the diference ?




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Re[2]: Start Transaction in InnoDB

2002-10-30 Thread Fernando Grijalba
This is what I think.

When Autocommit is set you DO NOT have to enter COMMIT after you update your
DB (Update, Insert Delete), but you will be changing the DB after every
statement, therefore you cannot change your mind after the command is
execute.

Now as for BEGIN, it will begin a Transaction regardless of the Autocommit
value.  Therefore if you have Autocommit set, but you do:
BEGIN;
SQLCOMMANDS;
COMMIT OR ROLLBACK;

The changes will be save only at the COMMIT or if you do not want the
changes to take effect you can ROLLBACK.

When Autocommit is not set you MUST COMMIT after your SQL statement in order
for the changes to be written into the DB regardless as to you start or not
with BEGIN.

HTH

JFernando
*** sql ***

-Original Message-
From: Peter Brawley [mailto:peter.brawley;artfulsoftware.com]
Sent: October 30, 2002 12:38
To: Dyego Souza do Carmo; Egor Egorov
Cc: [EMAIL PROTECTED]
Subject: Re: Re[2]: Start Transaction in InnoDB


Dyego,

BEGIN, not set begin. My understanding is that BEGIN is a synonym for SET
autocommit=0.

PB

-

 AB I would like to know, how can I start a new transaction using InnoDB
Tables?

 EE Use BEGIN statement:
 EE http://www.mysql.com/doc/en/COMMIT.html

 EE Don't forget to SET AUTOCOMMIT=0;


 What is the diference of SET AUTOCOMMIT=0;

 and set BEGIN; ?

 If I start the transaction with BEGIN and without SET AUTOCOMMIT=0
what will happen ?

 what is the diference ?




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php