Bug 162373 - export to sql (postgresql, mysql) generates empty tables (with no fields)
Summary: export to sql (postgresql, mysql) generates empty tables (with no fields)
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
: 167704 208200 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-05-20 20:21 UTC by Liwiusz Ociepa
Modified: 2015-04-17 21:05 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.15.80 (KDE Applications 15.03.80)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Liwiusz Ociepa 2008-05-20 20:21:18 UTC
Version:           4.0.2, 4.0.74 (using Devel)
Installed from:    Compiled sources
OS:                Linux

export to sql (postgresql, mysql) generates empty tables (with no fields).
Files (foo.xmi, generated foo.sql and foo.java) can be found http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=471979 
Bug does not exist in umbrello 1.5.8 (kde 3.5.9)
How to reproduce:
- create new class (eg. foo)
- add attribute (+ bar : int)
- code generation wizard - select MySQL or PostgreSQL
- exported SQL looks like:
CREATE TABLE foo (

);
Java version (correct):
public class foo {

  //
  // Fields
  //

  public int bar;
[...MORE...]

Version 1.5.8 (KDE 3.5.9) generates:

CREATE TABLE foo (

  bar int

);


Bug exist also with more than one attribute.
Comment 1 Liwiusz Ociepa 2008-05-28 21:31:55 UTC
The same with version 2.0.72 (KDE 4.00.80 - Debian experimental packages).
Comment 2 Samir Costa 2011-04-30 03:17:36 UTC
This bug also affects version 2.5.5

Is it really a bug or have not been implemented?
Comment 3 Andreas Plank 2013-01-25 13:40:00 UTC
still empty sql blocks in 4.7.2 "release 5". Seems not yet implemented
Comment 4 Ralf Habacker 2015-02-27 17:19:07 UTC
Recent implementation  of sql writer *only* support generating sql code from entity relation diagrams and not from class diagrams. 
Because of an implementation error in class SQLWriter (usage of static_cast instead of dynamic_cast) classes without attributes are selected to write sql code for.
Comment 5 Ralf Habacker 2015-02-27 17:45:53 UTC
Git commit 56de3f4b94f1513c9c8bc42bd4494e79465de7e4 by Ralf Habacker.
Committed on 27/02/2015 at 17:31.
Pushed by habacker into branch 'Applications/14.12'.

Fix of 'Export to sql (postgresql, mysql) generates empty tables (with no fields)'.

Sql writer only supports generating code from an entity relation diagram. The
wrong usage of static_cast let classes be written too.
FIXED-IN:2.15.3 (KDE 14.12.3)

M  +2    -2    umbrello/codegenerators/sql/sqlwriter.cpp

http://commits.kde.org/umbrello/56de3f4b94f1513c9c8bc42bd4494e79465de7e4
Comment 6 Ralf Habacker 2015-02-27 18:20:48 UTC
Git commit 28f1b540534afafe1169c9d26fbd94b33bea32ac by Ralf Habacker.
Committed on 27/02/2015 at 17:46.
Pushed by habacker into branch 'master'.

Fix additional possible invalid static_cast usages.

M  +15   -5    umbrello/codegenerators/sql/sqlwriter.cpp

http://commits.kde.org/umbrello/28f1b540534afafe1169c9d26fbd94b33bea32ac
Comment 7 Ralf Habacker 2015-02-27 18:21:59 UTC
*** Bug 167704 has been marked as a duplicate of this bug. ***
Comment 8 Ralf Habacker 2015-02-27 18:22:27 UTC
*** Bug 208200 has been marked as a duplicate of this bug. ***