Author Topic: MySQL DDL generation  (Read 4253 times)

psides

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
MySQL DDL generation
« on: December 15, 2004, 10:39:38 pm »
I'm generating MySQL DDL files from tables I've defined in EA.  The problem is that the .sql files use a 'COMMENT' keyword for the column and table comments, which is not valid in MySQL.  Comments must be setoff by "--", "/* */", or '#'.  If I change the option in the "Generate DDL" window, it only changes the .sql file header, which is correct with "--" already.  Nothing seems to change the column and table comments.

I'm I missing something here?

Also, I seem to be doing something wrong as far as configuring the "View" option.  I went to "local paths" and setup and "Applied" a path to "EditPadPro" directory, the editor I use, but I still can't get the "View" button to function.

Thanks,

Pete

Molto Mike

  • EA User
  • **
  • Posts: 66
  • Karma: +0/-0
    • View Profile
Re: MySQL DDL generation
« Reply #1 on: December 16, 2004, 03:42:49 am »
Hi Pete,

I am using this, and also for me the COMMENT tag is part of the generated DDL.

In my MySQL version this works w/o problems though!

What is your version of EA and which version of MySQL are you using?

Can you post part of the offending DDL?

I am sure we'll find the problem, I am processing the generated DDL w/o any post-patching...  :D

TTYS,
Mike

psides

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: MySQL DDL generation
« Reply #2 on: December 16, 2004, 09:40:47 am »
Molto Mike -

Thanks for your response.  I'm using MySQL 4.1.7 and EA Build 744.

Here is a sample .sql file generated by EA.

--  -------------------------------------------
--  Generated by Enterprise Architect Ver. 4.01
--  Created On : Monday, 13 December, 2004
--  DBMS       : MySql
--  -------------------------------------------

CREATE TABLE Areas11
(
RecID INTEGER NOT NULL COMMENT 'Record ID generated by system.',
AreaID CHAR(5) NOT NULL,
Desc VARCHAR(50) NOT NULL COMMENT 'Descriptio of Area.',
Nickname CHAR(15) NOT NULL,
SortField CHAR(15) NOT NULL,
GpsData TEXT,
AreaManagerID CHAR(6),
AreaOfficeLocClRecID INTEGER,
Comments78RecID INTEGER COMMENT 'Comments for all Tables are stored in Comments78.  Comments can be up to 500 characters long and are stored as 2 250 variable character fields (Comment, Comment2).',
PRIMARY KEY (AreaID),
UNIQUE (RecID),
KEY (Comments78RecID)
) Type=InnoDB COMMENT='Master Table of defined Areas to be used by Client.'
;

It is very clear in the MySQL documentation that comments can only be structured in one of three ways.  The above is not one of them.  Appreciate any help.

Molto Mike

  • EA User
  • **
  • Posts: 66
  • Karma: +0/-0
    • View Profile
Re: MySQL DDL generation
« Reply #3 on: December 16, 2004, 10:01:21 am »
Hi Pete,

I am still not in front of the right machine and I will try your DDL hopefully tonight.

But with respect to the COMMENT keyword, this *is* correct syntax. See

http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html

It says:

Quote
column_definition:
    col_name type [NOT NULL | NULL] [DEFAULT default_value]
        [AUTO_INCREMENT] [[PRIMARY] KEY] [COMMENT 'string']
        [reference_definition]


Here you find the COMMENT keyword documented.

Anyway, I'll give your file a try later tonight.

Mike

psides

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: MySQL DDL generation
« Reply #4 on: December 16, 2004, 11:31:15 am »
Mike -

You're right on.  I was looking at command structure, not statement structure.  I will investigate further myself also.  I'll let you know if I find anything and look for your response.

Thanks

psides

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: MySQL DDL generation
« Reply #5 on: December 16, 2004, 12:42:25 pm »
Mike -

Problem resolved.  Once you got me in the right direction, it's a simple error; I'm using a reserved word, "Desc".

Thanks again for your help.

Pete

Molto Mike

  • EA User
  • **
  • Posts: 66
  • Karma: +0/-0
    • View Profile
Re: MySQL DDL generation
« Reply #6 on: December 16, 2004, 10:50:54 pm »
You're welcome, glad it got you back on track.

Mike