empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1609104 - in /empire-db/trunk: empire-db-codegen/ empire-db-codegen/src/main/java/org/apache/empire/db/codegen/ empire-db-codegen/src/main/resources/templates/ empire-db-examples/empire-db-example-advanced/ empire-db-examples/empire-db-exa...
Date Wed, 09 Jul 2014 11:20:49 GMT
Author: doebele
Date: Wed Jul  9 11:20:48 2014
New Revision: 1609104

URL: http://svn.apache.org/r1609104
Log:
EMPIREDB-127
fix codegen template

Modified:
    empire-db/trunk/empire-db-codegen/pom.xml
    empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
    empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm
    empire-db/trunk/empire-db-examples/empire-db-example-advanced/pom.xml
    empire-db/trunk/empire-db-examples/empire-db-example-basic/pom.xml
    empire-db/trunk/empire-db-examples/empire-db-example-codegen/   (props changed)
    empire-db/trunk/empire-db-examples/empire-db-example-spring/pom.xml

Modified: empire-db/trunk/empire-db-codegen/pom.xml
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-codegen/pom.xml?rev=1609104&r1=1609103&r2=1609104&view=diff
==============================================================================
--- empire-db/trunk/empire-db-codegen/pom.xml (original)
+++ empire-db/trunk/empire-db-codegen/pom.xml Wed Jul  9 11:20:48 2014
@@ -60,21 +60,21 @@
 		    <version>5.1.1</version>
 		</dependency>-->
 		
-		<!-- ojdbc  
+		<!-- ojdbc   
 		<dependency>
 		    <groupId>com.oracle</groupId>
-		    <artifactId>ojdbc</artifactId>
-		    <version>14</version>
+			<artifactId>ojdbc5</artifactId>
+			<version>11.2.0.3</version>
 		</dependency>
 		-->
 
 		<!-- msssql 
 		<dependency>
-		    <groupId>microsoft</groupId>
+		    <groupId>com.microsoft</groupId>
 		    <artifactId>sqljdbc</artifactId>
 		    <version>1.0</version>
 		</dependency>
-		-->
+		--> 
 		
 	</dependencies>
 </project>
\ No newline at end of file

Modified: empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java?rev=1609104&r1=1609103&r2=1609104&view=diff
==============================================================================
--- empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
(original)
+++ empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenParser.java
Wed Jul  9 11:20:48 2014
@@ -365,7 +365,28 @@ public class CodeGenParser {
 			throws SQLException {
 		String name = rs.getString("COLUMN_NAME");
 		DataType empireType = getEmpireDataType(rs.getInt("DATA_TYPE"));
-		double colSize = Double.parseDouble(""+rs.getInt("COLUMN_SIZE") + '.' +rs.getInt("DECIMAL_DIGITS"));
+		
+		double colSize = rs.getInt("COLUMN_SIZE");
+		if (empireType==DataType.DECIMAL || empireType==DataType.FLOAT)
+		{	// decimal digits
+			int decimalDig = rs.getInt("DECIMAL_DIGITS");
+			if (decimalDig>0)
+			{	// parse
+				try {
+					int intSize = rs.getInt("COLUMN_SIZE");
+					colSize = Double.parseDouble(String.valueOf(intSize)+'.'+decimalDig);
+				} catch(Exception e) {
+					log.error("Failed to parse decimal digits for column "+name);
+				}
+			}
+			// make integer?
+			if (colSize<1.0d)
+			{	// Turn into an integer
+				empireType=DataType.INTEGER;
+			}
+		}
+		
+		// mandatory field?
 		boolean required = false;
 		String defaultValue = rs.getString("COLUMN_DEF");
 		if (rs.getString("IS_NULLABLE").equalsIgnoreCase("NO"))

Modified: empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm?rev=1609104&r1=1609103&r2=1609104&view=diff
==============================================================================
--- empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm (original)
+++ empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm Wed Jul 
9 11:20:48 2014
@@ -27,7 +27,7 @@ public abstract class ${baseRecordClassN
 	private static final long serialVersionUID = 1L;
 
 	public ${baseRecordClassName}(T table) {
-		super.init(table, DBRecord.REC_EMTPY, null);
+		super(table);
 	}
 
 	/**

Modified: empire-db/trunk/empire-db-examples/empire-db-example-advanced/pom.xml
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-examples/empire-db-example-advanced/pom.xml?rev=1609104&r1=1609103&r2=1609104&view=diff
==============================================================================
--- empire-db/trunk/empire-db-examples/empire-db-example-advanced/pom.xml (original)
+++ empire-db/trunk/empire-db-examples/empire-db-example-advanced/pom.xml Wed Jul  9 11:20:48
2014
@@ -59,19 +59,19 @@
 
 		<!-- ojdbc 
 		<dependency>
-		    <groupId>ojdbc</groupId>
-		    <artifactId>ojdbc</artifactId>
-		    <version>14</version>
+		    <groupId>com.oracle</groupId>
+			<artifactId>ojdbc5</artifactId>
+			<version>11.2.0.3</version>
 		</dependency>
-		-->
+		-->  
 
 		<!-- msssql 
 		<dependency>
-		    <groupId>microsoft</groupId>
+		    <groupId>com.microsoft</groupId>
 		    <artifactId>sqljdbc</artifactId>
 		    <version>1.0</version>
 		</dependency>
-		-->
+		--> 
 		
 	</dependencies>
 	<build>

Modified: empire-db/trunk/empire-db-examples/empire-db-example-basic/pom.xml
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-examples/empire-db-example-basic/pom.xml?rev=1609104&r1=1609103&r2=1609104&view=diff
==============================================================================
--- empire-db/trunk/empire-db-examples/empire-db-example-basic/pom.xml (original)
+++ empire-db/trunk/empire-db-examples/empire-db-example-basic/pom.xml Wed Jul  9 11:20:48
2014
@@ -62,21 +62,21 @@
 		    <version>5.1.6</version>
 		</dependency>
 
-		<!-- ojdbc   
+		<!-- ojdbc 
 		<dependency>
 		    <groupId>com.oracle</groupId>
-		    <artifactId>ojdbc</artifactId>
-		    <version>14</version>
+			<artifactId>ojdbc5</artifactId>
+			<version>11.2.0.3</version>
 		</dependency>
-		-->
-		
-		<!-- msssql  
+		-->  
+
+		<!-- msssql 
 		<dependency>
-		    <groupId>microsoft</groupId>
+		    <groupId>com.microsoft</groupId>
 		    <artifactId>sqljdbc</artifactId>
 		    <version>1.0</version>
 		</dependency>
-		-->
+		--> 
 		
 	</dependencies>
 	<build>

Propchange: empire-db/trunk/empire-db-examples/empire-db-example-codegen/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jul  9 11:20:48 2014
@@ -1 +1,7 @@
 target
+
+.classpath
+
+.project
+
+.settings

Modified: empire-db/trunk/empire-db-examples/empire-db-example-spring/pom.xml
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-examples/empire-db-example-spring/pom.xml?rev=1609104&r1=1609103&r2=1609104&view=diff
==============================================================================
--- empire-db/trunk/empire-db-examples/empire-db-example-spring/pom.xml (original)
+++ empire-db/trunk/empire-db-examples/empire-db-example-spring/pom.xml Wed Jul  9 11:20:48
2014
@@ -92,17 +92,17 @@
 		    <!-- <scope>runtime</scope> -->
 		</dependency> 
 
-		<!-- ojdbc 
+		<!-- ojdbc   
 		<dependency>
-		    <groupId>ojdbc</groupId>
-		    <artifactId>ojdbc</artifactId>
-		    <version>14</version>
+		    <groupId>com.oracle</groupId>
+			<artifactId>ojdbc5</artifactId>
+			<version>11.2.0.3</version>
 		</dependency>
 		-->
 
-		<!-- msssql 
+		<!-- msssql  
 		<dependency>
-		    <groupId>microsoft</groupId>
+		    <groupId>com.microsoft</groupId>
 		    <artifactId>sqljdbc</artifactId>
 		    <version>1.0</version>
 		</dependency>



Mime
View raw message