Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r310 - trunk/src/org/argouml/language/sql/reveng

argouml-sql
Discussion topic

Back to topic list

svn commit: r310 - trunk/src/org/argouml/language/sql/reveng

Author elbedd
Full name Laurent BRAUD
Date 2013-06-03 11:48:01 PDT
Message Author: elbedd Date: 2013-06-03 11:48:00-0700 New Revision: 310 Modified: trunk/src/org/argouml/language/sql/reveng/Modeller.java trunk/src/org/argouml/language/sql/reveng/ModellerC.java trunk/src/org/argouml/language/sql/reveng/MySql.g trunk/src/org/argouml/language/sql/reveng/SqlImport.java Log: Change done with example put in web site Modified: trunk/src/org/argouml/language/sql/reveng/Modeller.java Url: http://argouml-sql.tigris.org/source/browse/argouml-sql/trunk/src/org/argouml/language/sql/reveng/Modeller.java?view=diff&pathrev=310&r1=309&r2=310 ============================================================================== --- trunk/src/org/argouml/language/sql/reveng/Modeller.java (original) +++ trunk/src/org/argouml/language/sql/reveng/Modeller.java 2013-06-03 11:48:00-0700 @@ -83,7 +83,7 @@ } - public String getMappingDataTypeSQLToUML(String typeSQL) { + public String getMappingDataTypeSQLToUML(final String typeSQL) { String typeUML = "String"; if (typeSQL.toLowerCase().indexOf("char") > 0) { // char, varchar, nvarchar [oracle], ... @@ -178,11 +178,11 @@ * Call by the SqlParser * Must be call before the end of pasring a table (so, only when then name is known), because a FK can reference himself. */ - public void addTable(TableDefinition table) { + public void addTable(final TableDefinition table) { tablesByName.put(table.getName(), table); } - public TableDefinition getTableFromName(String nameTable) { + public TableDefinition getTableFromName(final String nameTable) { TableDefinition ret = tablesByName.get(nameTable); if (ret == null) { ret = new TableDefinition(); @@ -197,7 +197,7 @@ return tablesByName; } - public Object addClass(TableDefinition table) { + public Object addClass(final TableDefinition table) { Object mClass = addClassifier(Model.getCoreFactory().createClass(), table.getName(), table.getComment(), null); @@ -388,7 +388,7 @@ return mAttribute; } - public void setLevel(String level) { + public void setLevel(final String level) { this.settingLevel = level; } Modified: trunk/src/org/argouml/language/sql/reveng/ModellerC.java Url: http://argouml-sql.tigris.org/source/browse/argouml-sql/trunk/src/org/argouml/language/sql/reveng/ModellerC.java?view=diff&pathrev=310&r1=309&r2=310 ============================================================================== --- trunk/src/org/argouml/language/sql/reveng/ModellerC.java (original) +++ trunk/src/org/argouml/language/sql/reveng/ModellerC.java 2013-06-03 11:48:00-0700 @@ -40,7 +40,10 @@ for(TableDefinition table : modellerSource.getTablesByName().values()) { // boolean writeClass = true; - + + // Set to false if all attribute in PK are keys. + // + if (writeClass) { Object curClass = modellerSource.addClass(table); classes.put(table.getName(), curClass); Modified: trunk/src/org/argouml/language/sql/reveng/MySql.g Url: http://argouml-sql.tigris.org/source/browse/argouml-sql/trunk/src/org/argouml/language/sql/reveng/MySql.g?view=diff&pathrev=310&r1=309&r2=310 ============================================================================== --- trunk/src/org/argouml/language/sql/reveng/MySql.g (original) +++ trunk/src/org/argouml/language/sql/reveng/MySql.g 2013-06-03 11:48:00-0700 @@ -62,6 +62,7 @@ ( dumpComment | drop_table_statement | create_table_statement + | set_statement )* { getModeller().generateModele(); @@ -73,7 +74,11 @@ SL_COMMENT | ML_COMMENT (';')? ; - + +set_statement: + 'SET' (VAR_MYSQL | ID) '=' (VAR_MYSQL | ID) +; + drop_table_statement : 'DROP' 'TABLE' 'IF' 'EXISTS' (PROTECT_CHAR)? table_name (PROTECT_CHAR)? SEMICOLON ; @@ -192,12 +197,13 @@ } } - ('MATCH' ('FULL' | 'PARTIAL'))? - ('ON' ('DELETE' | 'UPDATE') reference_option )? + ('MATCH' ('FULL' | 'PARTIAL') )? + ('ON' ('DELETE' | 'UPDATE') reference_option )* + ; reference_option : - 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'NO ACTION' | 'SET DEFAULT' + 'RESTRICT' | 'CASCADE' | 'SET' 'NULL' | 'NO ACTION' | 'SET DEFAULT' ; columns_list_name returns [List listColumn]: @@ -228,6 +234,9 @@ $col.setLength($data_length.len); $col.setNbDecimal($data_length.decimal);//can be null } + ( 'UNSIGNED' {})? + + ( 'ZEROFILL' {} )? ( 'NOT' 'NULL' { $col.setNullable(false); } @@ -290,6 +299,8 @@ NUMBER : (DIGIT)+; ID : (( LETTER | '_') ((DIGIT)*))+ ; +VAR_MYSQL : '@' ('@')? ID; + PROTECT_CHAR : '`'; WS : ( '\t' | ' ' | '\r' | '\n' | '\u000C' )+ {$channel = HIDDEN;} ; Modified: trunk/src/org/argouml/language/sql/reveng/SqlImport.java Url: http://argouml-sql.tigris.org/source/browse/argouml-sql/trunk/src/org/argouml/language/sql/reveng/SqlImport.java?view=diff&pathrev=310&r1=309&r2=310 ============================================================================== --- trunk/src/org/argouml/language/sql/reveng/SqlImport.java (original) +++ trunk/src/org/argouml/language/sql/reveng/SqlImport.java 2013-06-03 11:48:00-0700 @@ -246,7 +246,7 @@ * TODO : like in java module. */ @Override - public String getInfo(int type) { + public String getInfo(final int type) { switch (type) { case DESCRIPTION: return "SQL import from dump files.";

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r310 - trunk/src/org/argouml/language/sql/reveng elbedd Laurent BRAUD 2013-06-03 11:48:01 PDT
Messages per page: