OK IT WORKED FINE :)) !!!
I am finally going to be able to work correctly :))
Here is a log of what i did to test :
mysql create database fam2
- ;
Query OK, 1 row affected (0.00 sec)
mysql use fam2
Database changed
mysql create table CREATE TABLE parent (id INT NOT NULL, nom CHAR(10),
PRIMARY KEY (id)) TYPE=INNODB;
ERROR 1064: You have an error in your SQL syntax near 'CREATE TABLE parent
(id INT NOT NULL, nom CHAR(10), PRIMARY KEY (id))
TYPE=INNOD' at line 1
mysql CREATE TABLE parent (id INT NOT NULL, nom CHAR(10), PRIMARY KEY (id))
TYPE=INNODB;
Query OK, 0 rows affected (0.08 sec)
mysql CREATE TABLE enfant (id INT, parent_id INT, INDEX par_id (parent_id),
FOREIGN KEY (parent_id) REFERENCES parent(id) ON
- DELETE CASCADE) TYPE=INNODB;
Query OK, 0 rows affected (0.03 sec)
mysql INSERT INTO parent (id , nom) VALUES (1, 'alex');
Query OK, 1 row affected (0.03 sec)
mysql INSERT INTO parent (id , nom) VALUES (3, 'tonio');
Query OK, 1 row affected (0.03 sec)
mysql INSERT INTO parent (id , nom) VALUES (24, 'poulaga');
Query OK, 1 row affected (0.02 sec)
mysql INSERT INTO parent (id , nom) VALUES (22, 'hellscream');
Query OK, 1 row affected (0.03 sec)
mysql select * from parent;
+++
| id | nom|
+++
| 1 | alex |
| 3 | tonio |
| 22 | hellscream |
| 24 | poulaga|
+++
4 rows in set (0.02 sec)
mysql insert into enfant ( id, parent_id) VALUES (14, 3);
Query OK, 1 row affected (0.01 sec)
mysql insert into enfant ( id, parent_id) VALUES (14, 546);
ERROR 1216: Cannot add a child row: a foreign key constraint fails
mysql insert into enfant ( id, parent_id) VALUES (234,22);
Query OK, 1 row affected (0.03 sec)
mysql insert into enfant ( id, parent_id) VALUES (24,22);
Query OK, 1 row affected (0.40 sec)
mysql insert into enfant ( id, parent_id) VALUES (25,22);
Query OK, 1 row affected (0.01 sec)
mysql insert into enfant ( id, parent_id) VALUES (1234,22);
Query OK, 1 row affected (0.02 sec)
mysql insert into enfant ( id, parent_id) VALUES (1234,24);
Query OK, 1 row affected (0.02 sec)
mysql insert into enfant ( id, parent_id) VALUES (123444,24);
Query OK, 1 row affected (0.02 sec)
mysql insert into enfant ( id, parent_id) VALUES (1232323,24);
Query OK, 1 row affected (0.03 sec)
mysql insert into enfant ( id, parent_id) VALUES (122,24);
Query OK, 1 row affected (0.02 sec)
mysql SELECT * FROM ENFANT;
+-+---+
| id | parent_id |
+-+---+
| 14 | 3 |
| 234 |22 |
| 24 |22 |
| 25 |22 |
|1234 |22 |
|1234 |24 |
| 123444 |24 |
| 1232323 |24 |
| 122 |24 |
+-+---+
9 rows in set (0.01 sec)
mysql DELETE FROM PARENT WHERE id=22;
Query OK, 1 row affected (0.07 sec)
mysql SELECT * FROM ENFANT;
+-+---+
| id | parent_id |
+-+---+
| 14 | 3 |
|1234 |24 |
| 123444 |24 |
| 1232323 |24 |
| 122 |24 |
+-+---+
5 rows in set (0.00 sec)
mysql
On cascade delete was processed correctly .
Thats perfect.
Thanks again !
-Message d'origine-
De : Alexandre Zglav [mailto:[EMAIL PROTECTED]]
Envoyé : vendredi, 9. août 2002 19:53
À : Heikki Tuuri; [EMAIL PROTECTED]
Objet : RE: Foreign keys vont delete on cascade
OK thanks a lot for your help ! :)
I just downloaded the latest version ( 4.0.2) and installed it .
I hoped I could keep the settings of my ini file ( my.ini) but I got the
following error when trying to start in standalone console :
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:\cd mysql
C:\mysqlcd bin
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_buffer_pool_size = 150M'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_buffer_pool_size = 150M'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_additional_mem_pool_size = 25M'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_log_files_in_group = 3'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_log_file_size = 20M'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_log_buffer_size = 15M'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_file_io_threads = 4'
C:\mysql\binmysqld-max --standalone --console
mysqld-max: ERROR: unknown variable 'innodb_lock_wait_timeout = 50'
C:\mysql\binmysqld-max --standalone --console
InnoDB: Error: log file c:\mysql\ibdata\iblogs\ib_logfile0 is of different
size
InnoDB: than specified in the .cnf file!
020809 19:46:16 Can't init databases
C:\mysql\binmysqld-max --standalone --console
InnoDB: The first specified data file C:\mysql\ibdata\ibdata1 did