Bug 398082 - Endless loop on importing mysql schema
Summary: Endless loop on importing mysql schema
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: importer (show other bugs)
Version: 2.26.0 (KDE Applications 18.08.0)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-30 21:26 UTC by Ralf Habacker
Modified: 2020-01-10 15:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.30.2 (KDE Applications 19.12.2)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2018-08-30 21:26:22 UTC
On importing the mysql schema from https://cgit.kde.org/ocs-apiserver.git/tree/scripts/sql/init_schema.sql umbrello does not finish the import and stays in an endless loop on a 'COMMENT' token in SQLImport::parseColumnConstraints().
Comment 1 Ralf Habacker 2018-11-19 22:53:34 UTC
Git commit 67d006cab83ff53aa3088ada99df0c1ed5b24c79 by Ralf Habacker.
Committed on 19/11/2018 at 22:45:18
Pushed by habacker into branch 'Applications/18.12'.

Fix 'Endless loop on importing mysql schema'

FIXED-IN:2.26.90 (KDE Applications 18.11.90)

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

https://commits.kde.org/umbrello/67d006cab83ff53aa3088ada99df0c1ed5b24c79
Comment 2 Oliver Kellogg 2020-01-09 14:46:34 UTC
(In reply to Ralf Habacker from comment #1)
> Git commit 67d006cab83ff53aa3088ada99df0c1ed5b24c79 by Ralf Habacker.
> [...]
> M  +1    -1    umbrello/codeimport/sqlimport.cpp
> 
> https://commits.kde.org/umbrello/67d006cab83ff53aa3088ada99df0c1ed5b24c79

Hi Ralf,

@@ -313,7 +313,7 @@ SQLImport::ColumnConstraints SQLImport::parseColumnConstraints(QString &token)
     ColumnConstraints constraints;
     int index = m_srcIndex;
 
-    while(token != QLatin1String(",") && token != QLatin1String(")")) {
+    while(token != QLatin1String(",") && token != QLatin1String(")") && token.toLower() != QLatin1String("COMMENT")) {

Shouldn't that be token.toUpper() ?
Comment 3 Oliver Kellogg 2020-01-10 06:01:52 UTC
I am preparing a merge request to address this.
Comment 4 Oliver Kellogg 2020-01-10 06:04:37 UTC
(In reply to Oliver Kellogg from comment #3)
> I am preparing a merge request to address this.

Should this go to master or release/19.12 ?
Comment 5 Ralf Habacker 2020-01-10 07:55:00 UTC
release/19.12 please, so that this fix can be included in the next version 2.30.2.
Comment 6 Oliver Kellogg 2020-01-10 09:11:31 UTC
See https://invent.kde.org/kde/umbrello/merge_requests/2
Okay to merge?
Comment 7 Oliver Kellogg 2020-01-10 15:00:14 UTC
Git commit cd594e1bc3db4e5272ce8712de6ba98398c2f21a by Oliver Kellogg.
Committed on 10/01/2020 at 14:52.
Pushed by okellogg into branch 'release/19.12'.

Fix endless loop on importing mysql schema:

umbrello/codeimport/sqlimport.cpp
- Replace variable `index' by constant `origIndex' located inside the
  while-loop.
- In loop condition replace QLatin1String("COMMENT") by
  QLatin1String("comment").
- After end of while-loop, if token contains COMMENT then advance until
  it contains "," or ")".
FIXED-IN:2.30.2 (KDE Applications 19.12.2)

M  +13   -7    umbrello/codeimport/sqlimport.cpp

https://invent.kde.org/kde/umbrello/commit/cd594e1bc3db4e5272ce8712de6ba98398c2f21a