https://bugs.kde.org/show_bug.cgi?id=363697

Richard Mortimer <richm+...@oldelvet.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richm+...@oldelvet.org.uk

--- Comment #14 from Richard Mortimer <richm+...@oldelvet.org.uk> ---
Disabling foreign key checks is pretty much the same as not using referential
integrity. It allows the database to get into "illegal" states. It is also
highly non-portable between database engines.

I just tried a quick test with MySQL 5.5 and simulated a crash halfway through
deleting an album. That left the database with an albumRoot set to a
non-existant value in the database.

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

mysql> update Albums set albumRoot = 0 where id = 1;
Query OK, 1 row affected (0.19 sec)
Rows matched: 1  Changed: 1  Warnings: 0

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

mysql> select * from Albums;
+----+-----------+--------------+------------+---------+------------+------+
| id | albumRoot | relativePath | date       | caption | collection | icon |
+----+-----------+--------------+------------+---------+------------+------+
|  1 |         0 | /            | 2015-11-25 | NULL    | NULL       | NULL |
|  2 |         1 | /Capture     | 2015-11-25 | NULL    | NULL       | NULL |
|  3 |         1 | /Test        | 2015-11-25 | NULL    | NULL       | NULL |
|  4 |         1 | /Webcam      | 2015-11-03 | NULL    | NULL       | NULL |
+----+-----------+--------------+------------+---------+------------+------+
4 rows in set (0.00 sec)

I really do think that the fake, placeholder, album route is the correct way to
go. It is similar to dropping foreign key checks but it does not leave the
database in an inconsistent state.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to