On Thursday 12 December 2002 01:45, Jing Dai wrote:
> I tried on delete cascade, it didn't work either.

First of all , if you create table as you described in your previous mail, 
foreign key will not be created. You can check it with SHOW TABLE STATUS.
Why? Because you specify 
        .. FOREIGN KEY index_name(column_name)
it's not a correct definition.
According of the manual:

[CONSTRAINT symbol] FOREIGN KEY (index_col_name, ...)
                  REFERENCES table_name (index_col_name, ...)
                  [ON DELETE CASCADE | ON DELETE SET NULL]

Besides, MATCH FULL is also not supported yet and MySQL ignores ON DELETE 
clause in CREATE TABLE statement. If you remove it, it works perfectly well 
for me:

mysql> create table license_data(
    ->  licenseID integer(5), index licID_index (licenseID), foreign key 
(licenseID) REFERENCES license_info (licenseID) on delete cascade on update 
cascade,
    -> logDate DATE NOT NULL,
    -> totalLic integer(5) NOT NULL,
    ->  requestLic integer(5) NOT NULL,
    ->  issuedLic integer(5) NOT NULL,
    ->  queuedLic integer(5) NOT NULL,
    -> deniedLic integer(5) NOT NULL) TYPE=INNODB;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into license_data values (LAST_INSERT_ID(),
    -> "2002-01-11",1,1,1,1,1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from license_data;
+-----------+------------+----------+------------+-----------+-----------+-----------+
| licenseID | logDate    | totalLic | requestLic | issuedLic | queuedLic | 
deniedLic |
+-----------+------------+----------+------------+-----------+-----------+-----------+
|         1 | 2002-01-11 |        1 |          1 |         1 |         1 |         
1 |
+-----------+------------+----------+------------+-----------+-----------+-----------+
1 row in set (0.01 sec)

mysql> delete from license_info where LicenseID=1;
Query OK, 1 row affected (0.00 sec)

mysql> select * from license_data;
Empty set (0.00 sec)
 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





---------------------------------------------------------------------
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