MySQLでロールバックしなかった件

MariaDB(MySQL)でトランザクションを設定して意図的にロールバックさせたつもりがコミットされていた。。。。
原因は、対象のテーブルがトランザクションセーフテーブル (InnoDB または NDB のテーブルなど) ではなかったから。
参照:MySQLリファレンスマニュアル
MariaDB [(table name)]> begin;
Query OK, 0 rows affected (0.00 sec)
MariaDB [price]> update (table name) set ean='9784798148816' where asin='B073J82NQX';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [price]> \q
Bye
$ mysql -u (user name) -p (table name)
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is (ID sequence)
Server version: (version name)-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [price]> select ean from (table name) where asin='B073J82NQX';
+---------------+
| ean |
+---------------+
| 9784798148816 |
+---------------+
1 row in set (0.00 sec)

テーブルのエンジンを調べる方法は、MySQLサーバのストレージエンジン確認方法を参照するとよい。
> use information_schema
Database changed
MariaDB [information_schema]> select table_schema, table_name, engine from tables where table_name='(table name)';
+--------------+------------+--------+
| table_schema | table_name | engine |
+--------------+------------+--------+
| (schema name)| (table name)| MyISAM |
+--------------+------------+--------+
1 row in set (0.02 sec)

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です