empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benni...@apache.org
Subject svn commit: r1164940 - in /incubator/empire-db/trunk/empire-db-codegen/src: main/java/org/apache/empire/db/codegen/CodeGenParser.java test/java/org/apache/empire/db/codegen/CodeGenParserTest.java
Date Sat, 03 Sep 2011 22:01:29 GMT
Author: benniven
Date: Sat Sep  3 22:01:28 2011
New Revision: 1164940

URL: http://svn.apache.org/viewvc?rev=1164940&view=rev
Log:
This commit is for EMPIREDB-113:
- integrated and tested the patch supplied by "Matt DeHoust"

Modified:
    incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
    incubator/empire-db/trunk/empire-db-codegen/src/test/java/org/apache/empire/db/codegen/CodeGenParserTest.java

Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java?rev=1164940&r1=1164939&r2=1164940&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
Sat Sep  3 22:01:28 2011
@@ -344,7 +344,7 @@ public class CodeGenParser {
 			throws SQLException {
 		String name = rs.getString("COLUMN_NAME");
 		DataType empireType = getEmpireDataType(rs.getInt("DATA_TYPE"));
-		int colSize = rs.getInt("COLUMN_SIZE");
+		double colSize = rs.getInt("COLUMN_SIZE") + (rs.getInt("DECIMAL_DIGITS") / 10.0);
 		boolean required = false;
 		String defaultValue = rs.getString("COLUMN_DEF");
 		if (rs.getString("IS_NULLABLE").equalsIgnoreCase("NO"))

Modified: incubator/empire-db/trunk/empire-db-codegen/src/test/java/org/apache/empire/db/codegen/CodeGenParserTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/test/java/org/apache/empire/db/codegen/CodeGenParserTest.java?rev=1164940&r1=1164939&r2=1164940&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/test/java/org/apache/empire/db/codegen/CodeGenParserTest.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/test/java/org/apache/empire/db/codegen/CodeGenParserTest.java
Sat Sep  3 22:01:28 2011
@@ -18,11 +18,15 @@
  */
 package org.apache.empire.db.codegen;
 
+import static org.apache.empire.data.DataType.DECIMAL;
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
 
 import java.util.List;
 
+import org.apache.empire.db.DBColumn;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBRelation;
 import org.apache.empire.db.DBTable;
@@ -40,6 +44,7 @@ public class CodeGenParserTest {
         config.init("src/test/resources/testconfig.xml");
         config.setDbSchema(null);
         parser = new CodeGenParser(config);
+        parser.loadDbModel();
     }
 
     @Test
@@ -64,5 +69,10 @@ public class CodeGenParserTest {
         final DBReference dbReference = references[0];
 		assertEquals(dbReference.getSourceColumn(), employees.getColumn("DEPARTMENT_ID"));
         assertEquals(dbReference.getTargetColumn(), departments.getColumn("DEPARTMENT_ID"));
+        
+        final DBColumn salary = employees.getColumn("SALARY");
+
+        assertThat(salary.getDataType(), is(DECIMAL));
+        assertThat(salary.getSize(), is(10.2));
     }
 }



Mime
View raw message