==============================================================================
set autocommit=0;
==============================================================================

mysql> select * from T01;
+————+————–+———————+
| company_id | company_name | create_date |
+————+————–+———————+
| 1 | FRONTIER | 2009-02-04 00:00:00 |
| 2 | Frontier0 | 2009-02-04 00:00:00 |
| 3 | Frontier1 | 2009-02-04 00:00:00 |
+————+————–+———————+
3 rows in set (0.00 sec)

mysql> set autocommit=0;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into T01(company_name,create_date) values(‘transac’,current_date);
Query OK, 1 row affected (0.00 sec)

mysql> select * from T01;
+————+————–+———————+
| company_id | company_name | create_date |
+————+————–+———————+
| 1 | FRONTIER | 2009-02-04 00:00:00 |
| 2 | Frontier0 | 2009-02-04 00:00:00 |
| 3 | Frontier1 | 2009-02-04 00:00:00 |
| 4 | transac | 2009-02-06 00:00:00 |
+————+————–+———————+
4 rows in set (0.00 sec)

mysql> rollback;
Query OK, 0 rows affected (0.02 sec)

mysql> select * from T01;
+————+————–+———————+
| company_id | company_name | create_date |
+————+————–+———————+
| 1 | FRONTIER | 2009-02-04 00:00:00 |
| 2 | Frontier0 | 2009-02-04 00:00:00 |
| 3 | Frontier1 | 2009-02-04 00:00:00 |
+————+————–+———————+
3 rows in set (0.00 sec)

mysql>

==============================================================================
set autocommit=1;
==============================================================================

mysql> set autocommit=1;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into T01(company_name,create_date) values(‘transac’,current_date);
Query OK, 1 row affected (0.00 sec)

mysql> select * from T01;
+————+————–+———————+
| company_id | company_name | create_date |
+————+————–+———————+
| 1 | FRONTIER | 2009-02-04 00:00:00 |
| 2 | Frontier0 | 2009-02-04 00:00:00 |
| 3 | Frontier1 | 2009-02-04 00:00:00 |
| 5 | transac | 2009-02-06 00:00:00 |
+————+————–+———————+
4 rows in set (0.00 sec)

mysql> rollback;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from T01;
+————+————–+———————+
| company_id | company_name | create_date |
+————+————–+———————+
| 1 | FRONTIER | 2009-02-04 00:00:00 |
| 2 | Frontier0 | 2009-02-04 00:00:00 |
| 3 | Frontier1 | 2009-02-04 00:00:00 |
| 5 | transac | 2009-02-06 00:00:00 |
+————+————–+———————+
4 rows in set (0.00 sec)

mysql>

Comments are closed.

Post Navigation