Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337420 - Execute All in SQL - Editor does not work on mySQL mixed create tabel, alter table statements
Summary: Execute All in SQL - Editor does not work on mySQL mixed create tabel, alter ...
Status: NEW
Alias: None
Product: Data Tools
Classification: Tools
Component: SQL Query Parser (show other bugs)
Version: unspecified   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: dtp.sqldevtools-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 330568
Blocks:
  Show dependency tree
 
Reported: 2011-02-17 07:13 EST by Missing name Mising name CLA
Modified: 2012-07-23 05:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name Mising name CLA 2011-02-17 07:13:24 EST
Build Identifier:  20100917-0705

Hallo all

The following mySQL Code cannot be executed by "Execute All" but will execute
with Selction from first drop till last create statement and "Execute selected Text". 

There seems to be a problem with the statement parser when it encounters  the alter table statement.

I file a new bug because it seems to be an old problem never solved correctly.( https://bugs.eclipse.org/bugs/show_bug.cgi?id=191721 )

Eclipse galileo under windows has the same problem 

Nevertheless: Thank you all for your great work

Ari

---------------------------------------------------------------------------
/* Drop Tables */


DROP TABLE if exists cd_hat_medien;
DROP TABLE if exists medien;
DROP TABLE if exists autoren;
DROP TABLE if exists cds;





/* Create Tables */

CREATE TABLE autoren
(
	-- Primär Schlüssel von Autoren
	a_id int NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'Primär Schlüssel von Autoren',
	-- Name des Autors oder Interpreten
	a_name varchar(100) COMMENT 'Name des Autors oder Interpreten',
	PRIMARY KEY (a_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8;


CREATE TABLE cds
(
	-- Primär Schlüssel
	cd_id int NOT NULL AUTO_INCREMENT COMMENT 'Primär Schlüssel',
	-- Name der CD
	cd_name varchar(100) NOT NULL UNIQUE COMMENT 'Name der CD',
	-- Erscheinungs bzw. Brenndatum 
	cd_date date COMMENT 'Erscheinungs bzw. Brenndatum ',
	PRIMARY KEY (cd_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8;


CREATE TABLE cd_hat_medien
(
	m_id int NOT NULL,
	-- Primär Schlüssel
	cd_id int NOT NULL COMMENT 'Primär Schlüssel'
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8;


CREATE TABLE medien
(
	m_id int NOT NULL AUTO_INCREMENT,
	-- Name des Titels, des Songs o. des Programms
	m_name varchar(100) NOT NULL UNIQUE COMMENT 'Name des Titels, des Songs o. des Programms',
	-- Primär Schlüssel von Autoren
	a_id int COMMENT 'Primär Schlüssel von Autoren',
	PRIMARY KEY (m_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8;

/* Create Foreign Keys */

ALTER TABLE medien
	ADD FOREIGN KEY (a_id)
	REFERENCES autoren (a_id)
	ON UPDATE CASCADE
	ON DELETE NO ACTION;


ALTER TABLE cd_hat_medien
	ADD CONSTRAINT cd_hat_medien_fk_cds_constraimt FOREIGN KEY (cd_id)
	REFERENCES cds (cd_id)
	ON UPDATE CASCADE
	ON DELETE CASCADE;


ALTER TABLE cd_hat_medien
	ADD CONSTRAINT cd_hat_medien_fk_medien_constraint FOREIGN KEY (m_id)
	REFERENCES medien (m_id)
	ON UPDATE CASCADE
	ON DELETE CASCADE;



Reproducible: Always

Steps to Reproduce:
1. Insert above Code into script editor 
2. Create a mysql connection and connect to database server
3. Select the created Connection profile in SQL Editor
4. Execute all does not succeed.
Comment 1 Pierre Queinnec CLA 2012-05-18 14:26:17 EDT
Hi Ari!

I can reproduce. Actually it's strange but the script works fine with my fix for Bug #330568... As my patch is supposed to be idempotent but just a lot faster, it might be a timeout somewhere.

I'm adding a Depends On Bug #330568. We'll see if it's true or not.
Thank you for your report!
Comment 2 Pierre Queinnec CLA 2012-07-23 05:13:39 EDT
Could you try this again with Juno? This now works fine for me.