Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 70603 invoked from network); 5 Dec 2003 18:35:55 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Dec 2003 18:35:55 -0000 Received: (qmail 95157 invoked by uid 500); 5 Dec 2003 18:35:46 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 94994 invoked by uid 500); 5 Dec 2003 18:35:45 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 94981 invoked by uid 500); 5 Dec 2003 18:35:45 -0000 Received: (qmail 94957 invoked from network); 5 Dec 2003 18:35:45 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 5 Dec 2003 18:35:45 -0000 Received: (qmail 70583 invoked by uid 1280); 5 Dec 2003 18:35:53 -0000 Date: 5 Dec 2003 18:35:53 -0000 Message-ID: <20031205183553.70582.qmail@minotaur.apache.org> From: mpoeschl@apache.org To: db-torque-cvs@apache.org Subject: cvs commit: db-torque/src/generator/src/test/org/apache/torque/engine/database/model PostgresqlDomainTest.java OracleDomainTest.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N mpoeschl 2003/12/05 10:35:53 Modified: src/generator/src/java/org/apache/torque/engine/platform PlatformPostgresqlImpl.java PlatformDefaultImpl.java Platform.java PlatformOracleImpl.java Added: src/generator/src/test/org/apache/torque/engine/database/model PostgresqlDomainTest.java OracleDomainTest.java Log: add hasSize() and hasScale() to Platform (not implemented yet) more tests Revision Changes Path 1.4 +14 -14 db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformPostgresqlImpl.java Index: PlatformPostgresqlImpl.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformPostgresqlImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PlatformPostgresqlImpl.java 4 Dec 2003 09:39:38 -0000 1.3 +++ PlatformPostgresqlImpl.java 5 Dec 2003 18:35:52 -0000 1.4 @@ -79,21 +79,21 @@ */ private void initialize() { - setSchemaDomainMapping(new Domain(SchemaType.BIT, "boolean")); - setSchemaDomainMapping(new Domain(SchemaType.TINYINT, "int2")); - setSchemaDomainMapping(new Domain(SchemaType.SMALLINT, "int2")); - setSchemaDomainMapping(new Domain(SchemaType.BIGINT, "int8")); - setSchemaDomainMapping(new Domain(SchemaType.REAL, "float")); + setSchemaDomainMapping(new Domain(SchemaType.BIT, "BOOLEAN")); + setSchemaDomainMapping(new Domain(SchemaType.TINYINT, "INT2")); + setSchemaDomainMapping(new Domain(SchemaType.SMALLINT, "INT2")); + setSchemaDomainMapping(new Domain(SchemaType.BIGINT, "INT8")); + setSchemaDomainMapping(new Domain(SchemaType.REAL, "FLOAT")); // TODO check this .. just copied from db.props - setSchemaDomainMapping(new Domain(SchemaType.BOOLEANCHAR, "char")); + setSchemaDomainMapping(new Domain(SchemaType.BOOLEANCHAR, "CHAR")); // TODO check this .. just copied from db.props - setSchemaDomainMapping(new Domain(SchemaType.BOOLEANINT, "int2")); - setSchemaDomainMapping(new Domain(SchemaType.DOUBLE, "double precision")); - setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "text")); - setSchemaDomainMapping(new Domain(SchemaType.BINARY, "bytea")); - setSchemaDomainMapping(new Domain(SchemaType.VARBINARY, "bytea")); - setSchemaDomainMapping(new Domain(SchemaType.LONGVARBINARY, "bytea")); - setSchemaDomainMapping(new Domain(SchemaType.CLOB, "text")); + setSchemaDomainMapping(new Domain(SchemaType.BOOLEANINT, "INT2")); + setSchemaDomainMapping(new Domain(SchemaType.DOUBLE, "DOUBLE PRECISION")); + setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "TEXT")); + setSchemaDomainMapping(new Domain(SchemaType.BINARY, "BYTEA")); + setSchemaDomainMapping(new Domain(SchemaType.VARBINARY, "BYTEA")); + setSchemaDomainMapping(new Domain(SchemaType.LONGVARBINARY, "BYTEA")); + setSchemaDomainMapping(new Domain(SchemaType.CLOB, "TEXT")); } /** 1.7 +19 -2 db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformDefaultImpl.java Index: PlatformDefaultImpl.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformDefaultImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- PlatformDefaultImpl.java 5 Dec 2003 14:28:27 -0000 1.6 +++ PlatformDefaultImpl.java 5 Dec 2003 18:35:52 -0000 1.7 @@ -62,7 +62,6 @@ import org.apache.torque.engine.database.model.SchemaType; - /** * Default implementation for the Platform interface. * @@ -143,6 +142,24 @@ public String getAutoIncrement() { return "IDENTITY"; + } + + /** + * @see Platform#hasScale(String) + * TODO collect info for all platforms + */ + public boolean hasScale(SchemaType type) + { + return true; + } + + /** + * @see Platform#hasSize(String) + * TODO collect info for all platforms + */ + public boolean hasSize(SchemaType type) + { + return true; } } 1.6 +16 -1 db-torque/src/generator/src/java/org/apache/torque/engine/platform/Platform.java Index: Platform.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/platform/Platform.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Platform.java 4 Dec 2003 09:39:38 -0000 1.5 +++ Platform.java 5 Dec 2003 18:35:52 -0000 1.6 @@ -103,4 +103,19 @@ */ String getAutoIncrement(); + /** + * Returns if the RDBMS-specific SQL type has a size attribute. + * + * @param type the SchemaType + * @return true if the type has a size attribute + */ + boolean hasSize(SchemaType type); + + /** + * Returns if the RDBMS-specific SQL type has a scale attribute. + * + * @param type the SchemaType + * @return true if the type has a scale attribute + */ + boolean hasScale(SchemaType type); } 1.5 +9 -1 db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformOracleImpl.java Index: PlatformOracleImpl.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformOracleImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PlatformOracleImpl.java 5 Dec 2003 14:28:27 -0000 1.4 +++ PlatformOracleImpl.java 5 Dec 2003 18:35:52 -0000 1.5 @@ -88,6 +88,7 @@ setSchemaDomainMapping(new Domain(SchemaType.REAL, "NUMBER")); setSchemaDomainMapping(new Domain(SchemaType.DOUBLE, "FLOAT")); setSchemaDomainMapping(new Domain(SchemaType.DECIMAL, "NUMBER")); + setSchemaDomainMapping(new Domain(SchemaType.NUMERIC, "NUMBER")); setSchemaDomainMapping(new Domain(SchemaType.VARCHAR, "VARCHAR2")); setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "VARCHAR2", "2000")); setSchemaDomainMapping(new Domain(SchemaType.TIME, "DATE")); @@ -113,4 +114,11 @@ return Platform.SEQUENCE; } + /** + * @see Platform#getAutoIncrement() + */ + public String getAutoIncrement() + { + return ""; + } } 1.1 db-torque/src/generator/src/test/org/apache/torque/engine/database/model/PostgresqlDomainTest.java Index: PostgresqlDomainTest.java =================================================================== package org.apache.torque.engine.database.model; /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Torque" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * "Apache Torque", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ import junit.framework.TestCase; import org.apache.torque.engine.database.transform.XmlToAppData; /** * Tests for domain handling (for Postgresql). * * @author . */ import junit.framework.TestCase; import org.apache.torque.engine.database.transform.XmlToAppData; /** * Tests for domain handling (for Oracle). * * @author