"Fossies" - the Fresh Open Source Software Archive

Member "drizzle-7.1.36-stable/tests/suite/regression/t/654219.test" (6 May 2012, 1627 Bytes) of package /linux/misc/old/drizzle-7.1.36-stable.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 CREATE TABLE `prim_key` (
    2   `id` INT NOT NULL,
    3   `val` VARCHAR(20) COLLATE utf8_general_ci DEFAULT NULL,
    4   PRIMARY KEY (`id`)
    5 );
    6 
    7 CREATE TABLE `fore_key0` (
    8   `id` INT NOT NULL,
    9   `id_ref0` INT DEFAULT NULL,
   10   PRIMARY KEY (`id`),
   11   KEY `id_ref0` (`id_ref0`),
   12   CONSTRAINT `fore_key0_ibfk_1` FOREIGN KEY (`id_ref0`) REFERENCES
   13   `prim_key` (`id`)
   14 );
   15 
   16 CREATE TABLE `fore_key1` (
   17   `id` INT NOT NULL,
   18   `id_ref1` INT DEFAULT NULL,
   19   PRIMARY KEY (`id`),
   20   KEY `id_ref1` (`id_ref1`),
   21   CONSTRAINT `fore_key1_ibfk_1` FOREIGN KEY (`id_ref1`) REFERENCES
   22   `prim_key` (`id`) ON UPDATE CASCADE
   23 );
   24 
   25 --sorted_result
   26 SELECT CONSTRAINT_NAME,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
   27 
   28 DROP TABLE fore_key1;
   29 DROP TABLE fore_key0;
   30 DROP TABLE prim_key;
   31 
   32 # Taken from MySQL example
   33 CREATE TABLE t1
   34 (
   35   s1 INT,
   36   s2 INT,
   37   s3 INT,
   38   PRIMARY KEY(s3)
   39 );
   40 
   41 CREATE TABLE t3
   42 (
   43   s1 INT,
   44   s2 INT,
   45   s3 INT,
   46   KEY(s1),
   47   CONSTRAINT CO FOREIGN KEY (s2)
   48   REFERENCES t1(s3)
   49 );
   50 
   51 --sorted_result
   52 SELECT CONSTRAINT_NAME,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
   53 
   54 DROP TABLE t3;
   55 DROP TABLE t1;
   56 
   57 # Taken from SQL Server example
   58 CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 CHAR(5), c4 INT, c5 INT, constraint pk_t1 PRIMARY KEY (c5,c4));
   59 
   60 CREATE TABLE T2 (tc1 INT NOT NULL, c1 INT NOT NULL, c2 INT NOT NULL, c5 CHAR(5), constraint fk_t2 FOREIGN KEY (c1,c2) REFERENCES t1 (c5,c4));
   61 
   62 --sorted_result
   63 SELECT CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME IN ('t1', 't2');
   64 
   65 DROP TABLE t2;
   66 DROP TABLE t1;
   67