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:
AB>    http://www.mysql.com/manual.php   (the manual)
AB>    http://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

Reply via email to