db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1872378 - in /db/torque/torque4/trunk/torque-templates/src: main/java/org/apache/torque/templates/platform/PlatformOracleImpl.java test/resources/org/apache/torque/templates/expected-schema-oracle.sql
Date Mon, 06 Jan 2020 13:31:04 GMT
Author: tv
Date: Mon Jan  6 13:31:04 2020
New Revision: 1872378

URL: http://svn.apache.org/viewvc?rev=1872378&view=rev
Log:
Fix scale handling (caused syntax error in generated Oracle SQL), fix type mapping

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformOracleImpl.java
    db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-oracle.sql

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformOracleImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformOracleImpl.java?rev=1872378&r1=1872377&r2=1872378&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformOracleImpl.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformOracleImpl.java
Mon Jan  6 13:31:04 2020
@@ -81,7 +81,7 @@ public class PlatformOracleImpl extends
                 new SqlType("NUMBER"));
         setSchemaTypeToSqlTypeMapping(
                 SchemaType.DOUBLE,
-                new SqlType("FLOAT"));
+                new SqlType("NUMBER"));
         setSchemaTypeToSqlTypeMapping(
                 SchemaType.DECIMAL,
                 new SqlType("NUMBER"));
@@ -185,4 +185,13 @@ public class PlatformOracleImpl extends
     {
         return !("BLOB".equals(sqlType) || "CLOB".equals(sqlType));
     }
+
+    /**
+     * @see Platform#hasScale(String)
+     */
+    @Override
+    public boolean hasScale(String sqlType)
+    {
+        return "TIMESTAMP".equals(sqlType) || "NUMBER".equals(sqlType);
+    }
 }

Modified: db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-oracle.sql
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-oracle.sql?rev=1872378&r1=1872377&r2=1872378&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-oracle.sql
(original)
+++ db/torque/torque4/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-oracle.sql
Mon Jan  6 13:31:04 2020
@@ -88,7 +88,7 @@ DROP SEQUENCE torque.qualified_name_SEQ;
 -- -----------------------------------------------------------------------
 CREATE TABLE a
 (
-    a_id NUMBER(10,0)(0) NOT NULL,
+    a_id NUMBER(10,0) NOT NULL,
     name VARCHAR2(50 CHAR) default 'a_name' NOT NULL,
     contactdata VARCHAR2(500 CHAR) NOT NULL,
     created_at TIMESTAMP(6) default CURRENT_TIMESTAMP NOT NULL,
@@ -110,7 +110,7 @@ CREATE SEQUENCE a_SEQ INCREMENT BY 1 STA
 -- -----------------------------------------------------------------------
 CREATE TABLE b
 (
-    b_id NUMBER(10,0)(0) NOT NULL,
+    b_id NUMBER(10,0) NOT NULL,
     name VARCHAR2(50 CHAR) NOT NULL,
     CONSTRAINT NAME_UNQ UNIQUE (name)
 );
@@ -128,8 +128,8 @@ CREATE SEQUENCE b_SEQ INCREMENT BY 1 STA
 -- -----------------------------------------------------------------------
 CREATE TABLE b2
 (
-    b2_id NUMBER(10,0)(0) NOT NULL,
-    b2_id_2 NUMBER(10,0)(0),
+    b2_id NUMBER(10,0) NOT NULL,
+    b2_id_2 NUMBER(10,0),
     b2_name_1 VARCHAR2(50 CHAR) NOT NULL,
     b2_name_2 VARCHAR2(20 CHAR) NOT NULL,
     b2_name_3 VARCHAR2(10 CHAR) NOT NULL,
@@ -150,8 +150,8 @@ CREATE SEQUENCE b2_SEQ INCREMENT BY 1 ST
 -- -----------------------------------------------------------------------
 CREATE TABLE r_ab
 (
-    a_id NUMBER(10,0)(0) NOT NULL,
-    b_id NUMBER(10,0)(0) NOT NULL,
+    a_id NUMBER(10,0) NOT NULL,
+    b_id NUMBER(10,0) NOT NULL,
     name VARCHAR2(50 CHAR) NOT NULL
 );
 
@@ -167,9 +167,9 @@ ALTER TABLE r_ab
 -- -----------------------------------------------------------------------
 CREATE TABLE c
 (
-    c_id NUMBER(10,0)(0) NOT NULL,
-    a_id NUMBER(10,0)(0) NOT NULL,
-    b_id NUMBER(10,0)(0) NOT NULL,
+    c_id NUMBER(10,0) NOT NULL,
+    a_id NUMBER(10,0) NOT NULL,
+    b_id NUMBER(10,0) NOT NULL,
     name VARCHAR2(50 CHAR) NOT NULL
 );
 
@@ -186,10 +186,10 @@ CREATE SEQUENCE c_SEQ INCREMENT BY 1 STA
 -- -----------------------------------------------------------------------
 CREATE TABLE d
 (
-    d_id NUMBER(10,0)(0) NOT NULL,
+    d_id NUMBER(10,0) NOT NULL,
     name VARCHAR2(255 CHAR) NOT NULL,
-    b_id NUMBER(10,0)(0) NOT NULL,
-    a_id NUMBER(10,0)(0) NOT NULL
+    b_id NUMBER(10,0) NOT NULL,
+    a_id NUMBER(10,0) NOT NULL
 );
 
 ALTER TABLE d
@@ -204,7 +204,7 @@ ALTER TABLE d
 -- -----------------------------------------------------------------------
 CREATE TABLE nopk
 (
-    intcol NUMBER(10,0)(0),
+    intcol NUMBER(10,0),
     name VARCHAR2(50 CHAR)
 );
 
@@ -235,7 +235,7 @@ ALTER TABLE MULTIPK_SELF_REFTABLE
 -- -----------------------------------------------------------------------
 CREATE TABLE ifc_table
 (
-    id NUMBER(10,0)(0) NOT NULL,
+    id NUMBER(10,0) NOT NULL,
     name VARCHAR2(50 CHAR)
 );
 
@@ -251,7 +251,7 @@ ALTER TABLE ifc_table
 -- -----------------------------------------------------------------------
 CREATE TABLE ifc_table2
 (
-    id NUMBER(10,0)(0) NOT NULL,
+    id NUMBER(10,0) NOT NULL,
     name VARCHAR2(50 CHAR)
 );
 
@@ -267,7 +267,7 @@ ALTER TABLE ifc_table2
 -- -----------------------------------------------------------------------
 CREATE TABLE INHERITANCE_TEST
 (
-    INHERITANCE_TEST NUMBER(10,0)(0) NOT NULL,
+    INHERITANCE_TEST NUMBER(10,0) NOT NULL,
     CLASS_NAME CHAR(1),
     PAYLOAD_PARENT VARCHAR2(100 CHAR) NOT NULL,
     PAYLOAD_B VARCHAR2(100 CHAR),
@@ -288,9 +288,9 @@ CREATE SEQUENCE INHERITANCE_TEST_SEQ INC
 -- -----------------------------------------------------------------------
 CREATE TABLE ext_schema
 (
-    ext_schema_id NUMBER(10,0)(0) NOT NULL,
-    ext_id NUMBER(10,0)(0),
-    test NUMBER(10,0)(0) NOT NULL
+    ext_schema_id NUMBER(10,0) NOT NULL,
+    ext_id NUMBER(10,0),
+    test NUMBER(10,0) NOT NULL
 );
 
 ALTER TABLE ext_schema
@@ -307,9 +307,9 @@ CREATE SEQUENCE ext_schema_SEQ INCREMENT
 -- -----------------------------------------------------------------------
 CREATE TABLE extext_schema
 (
-    extext_schema_id NUMBER(10,0)(0) NOT NULL,
-    extext_id NUMBER(10,0)(0),
-    test NUMBER(10,0)(0) NOT NULL
+    extext_schema_id NUMBER(10,0) NOT NULL,
+    extext_id NUMBER(10,0),
+    test NUMBER(10,0) NOT NULL
 );
 
 ALTER TABLE extext_schema
@@ -325,7 +325,7 @@ CREATE SEQUENCE extext_schema_SEQ INCREM
 -- -----------------------------------------------------------------------
 CREATE TABLE torque.qualified_name
 (
-    id NUMBER(10,0)(0),
+    id NUMBER(10,0),
     payload VARCHAR2(100 CHAR)
 );
 



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message