Bug 353668

Summary: Hangs on MySQL script import when a column has a character set
Product: [Applications] umbrello Reporter: rk80kk5e2yjivh1
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: minor    
Priority: NOR    
Version: 2.17.0 (KDE Applications 15.08.0)   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
URL: https://dev.mysql.com/doc/refman/5.7/en/charset-column.html
Latest Commit: Version Fixed In: 2.17.2 (KDE Applications 15.08.2)
Sentry Crash Report:

Description rk80kk5e2yjivh1 2015-10-07 20:21:45 UTC
Umbrello hangs (unresponsive and 100% CPU) when using [Code/Code Importing Wizard/] with a simple MySQL script containing the following table definition :
CREATE TABLE `mytable` (`myvarchar` text CHARACTER SET utf8);

The last debug lines are :
umbrello: 1 "TABLE"
umbrello: 2 "`"
umbrello: 3 "mytable"
umbrello: 4 "`"
umbrello: 5 "("
umbrello: parsing create table "mytable"
umbrello: scene= "class diagram"  / object= "mytable"
umbrello: 6 "`"
umbrello: 7 "myvarchar"
umbrello: 8 "`"
umbrello: 9 "text"
umbrello: 10 "CHARACTER"
umbrello: 11 "SET"


Reproducible: Always

Steps to Reproduce:
1. Create an SQL script as follow : CREATE TABLE `mytable` (`myvarchar` text CHARACTER SET utf8);
2. Try importing it using Code Importing Wizard with "MySQL" as a language


Actual Results:  
Umbrello hangs : unresponsive + 100% CPU

Expected Results:  
Entities created
or
A parsing error message without application crash/hang

The new SQL parser doesn't seem to implement character set yet : https://dev.mysql.com/doc/refman/5.7/en/charset-column.html
Workaround : remove the character set definition in the script as they are useless to the code import.
Comment 1 Ralf Habacker 2015-10-07 22:10:17 UTC
Git commit 6aabd97ea7a75ca6ddf17af89bc60b62a656a1cc by Ralf Habacker.
Committed on 07/10/2015 at 22:01.
Pushed by habacker into branch 'Applications/15.08'.

Fix 'Hangs on MySQL script import when a column has a character set'.

FIXED-IN:2.17.2 (KDE Applications 15.08.2)

M  +1    -0    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/6aabd97ea7a75ca6ddf17af89bc60b62a656a1cc
Comment 2 Ralf Habacker 2015-10-07 22:10:17 UTC
Git commit 658de93df88e901f4adc6161db67864ea842fe29 by Ralf Habacker.
Committed on 07/10/2015 at 22:10.
Pushed by habacker into branch 'Applications/15.08'.

Add parse support for mysql 'CHARACTER SET <format>'.

Currently we ignore the parsed character set because
class UMLEntityAttribute, UMLEntityAttributeDialog
and MySQLWriter do not support it.

M  +13   -0    umbrello/codeimport/sqlimport.cpp
M  +1    -0    umbrello/codeimport/sqlimport.h

http://commits.kde.org/umbrello/658de93df88e901f4adc6161db67864ea842fe29
Comment 3 Ralf Habacker 2015-11-02 12:03:26 UTC
Git commit 51804eeefc58033e7cf97d92856d56af0dd765b1 by Ralf Habacker.
Committed on 02/11/2015 at 11:48.
Pushed by habacker into branch 'Applications/15.08'.

Fix doc of SQLImport::parseColumnConstraints() in relation of 'character set' and 'collate' attribute.

M  +4    -2    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/51804eeefc58033e7cf97d92856d56af0dd765b1
Comment 4 Ralf Habacker 2015-11-03 20:18:35 UTC
Git commit 818ebe4c1619f83bb6d58de83f443a270970b59d by Ralf Habacker.
Committed on 03/11/2015 at 20:18.
Pushed by habacker into branch 'master'.

Add sql round trip support for sql column attributes 'character set'
(mysql) and 'collate' (postgresql, mysql).

UMLEntityAttribute provides custom attributes, which is used to
propagate the mentioned column attributes to the user and codegenerator.

M  +9    -0    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/818ebe4c1619f83bb6d58de83f443a270970b59d
Comment 5 Ralf Habacker 2015-12-16 18:48:37 UTC
Git commit 36f670d73e20d828a1d9c452ebbd97323e8983a0 by Ralf Habacker.
Committed on 16/12/2015 at 18:15.
Pushed by habacker into branch 'frameworks'.

Add parse support for mysql 'CHARACTER SET <format>'.

Currently we ignore the parsed character set because
class UMLEntityAttribute, UMLEntityAttributeDialog
and MySQLWriter do not support it.

M  +13   -0    umbrello/codeimport/sqlimport.cpp
M  +1    -0    umbrello/codeimport/sqlimport.h

http://commits.kde.org/umbrello/36f670d73e20d828a1d9c452ebbd97323e8983a0
Comment 6 Ralf Habacker 2015-12-16 18:49:06 UTC
Git commit cdc0d94406172f0192ffdf5c3874f4b5d2e83b83 by Ralf Habacker.
Committed on 16/12/2015 at 18:15.
Pushed by habacker into branch 'frameworks'.

Add sql round trip support for sql column attributes 'character set'
(mysql) and 'collate' (postgresql, mysql).

UMLEntityAttribute provides custom attributes, which is used to
propagate the mentioned column attributes to the user and codegenerator.

M  +9    -0    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/cdc0d94406172f0192ffdf5c3874f4b5d2e83b83
Comment 7 Ralf Habacker 2015-12-16 18:49:41 UTC
Git commit a60b76e77feb3c42535c212a57773c8ae46992a4 by Ralf Habacker.
Committed on 16/12/2015 at 18:15.
Pushed by habacker into branch 'frameworks'.

Fix 'Hangs on MySQL script import when a column has a character set'.

FIXED-IN:2.17.2 (KDE Applications 15.08.2)

M  +1    -0    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/a60b76e77feb3c42535c212a57773c8ae46992a4
Comment 8 Ralf Habacker 2015-12-16 18:49:52 UTC
Git commit b3352e0a6ea09c16f9ec71a5f014f5cbe77476a0 by Ralf Habacker.
Committed on 16/12/2015 at 18:15.
Pushed by habacker into branch 'frameworks'.

Fix doc of SQLImport::parseColumnConstraints() in relation of 'character set' and 'collate' attribute.

M  +4    -2    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/b3352e0a6ea09c16f9ec71a5f014f5cbe77476a0
Comment 9 Lays Rodrigues 2016-10-27 12:06:59 UTC
Git commit c5e3dd0687d6f5bce63dd2d587c1989e4cbbba4f by Lays Rodrigues, on behalf of Ralf Habacker.
Committed on 27/10/2016 at 11:44.
Pushed by laysrodrigues into branch 'frameworks'.

Fix doc of SQLImport::parseColumnConstraints() in relation of 'character set' and 'collate' attribute.

M  +0    -1    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/c5e3dd0687d6f5bce63dd2d587c1989e4cbbba4f
Comment 10 Lays Rodrigues 2016-10-27 12:09:02 UTC
Git commit 373900436e62f1395acaee9e6109266946d907db by Lays Rodrigues, on behalf of Ralf Habacker.
Committed on 27/10/2016 at 11:44.
Pushed by laysrodrigues into branch 'frameworks'.

Add parse support for mysql 'CHARACTER SET <format>'.

Currently we ignore the parsed character set because
class UMLEntityAttribute, UMLEntityAttributeDialog
and MySQLWriter do not support it.

M  +1    -0    umbrello/codeimport/sqlimport.cpp

http://commits.kde.org/umbrello/373900436e62f1395acaee9e6109266946d907db