matth 2004/01/06 11:27:18 Modified: sql project.xml sql/src/java/org/apache/commons/sql/ddl DDLBuilder.java sql/src/java/org/apache/commons/sql/task DDLTask.java sql/src/java/org/apache/commons/sql/util DDL.java sql/xdocs index.xml Removed: sql/xdocs/howto mssql-howto.xml oracle-howto.xml postgres-howto.xml sybase-howto.xml Log: Added "dropTables" flag to ddl task so that the initial DROP statements can be left out. Postgres 7.4 seems to be quite strict about errors encountered during a transaction. Added some license headers and removed some author tags. Added a small test for the ddl task which isn't very good. Removed howto xdocs since they're really Torque docs -- I'm not sure why they were here. Revision Changes Path 1.16 +8 -7 jakarta-commons-sandbox/sql/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/sql/project.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- project.xml 16 Dec 2003 15:09:50 -0000 1.15 +++ project.xml 6 Jan 2004 19:27:18 -0000 1.16 @@ -129,13 +129,6 @@ <version>1.0-beta-2</version> </dependency> - <!-- - <dependency> - <id>jdbc</id> - <version>2.0</version> - </dependency> - -->f - <dependency> <id>ant</id> <version>1.5</version> @@ -185,6 +178,12 @@ <includes> <include>**/Test*.java</include> </includes> + + <resources> + <resource> + <directory>src/test-input</directory> + </resource> + </resources> </unitTest> @@ -194,11 +193,13 @@ <!-- J A R R E S O U R C E S --> <!-- Resources that are packaged up inside the JAR file --> <resources> + <resource> <directory>src/java</directory> <includes> <include>**/*.properties</include> <include>**/*.betwixt</include> </includes> + </resource> </resources> </build> </project> 1.3 +61 -2 jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/ddl/DDLBuilder.java Index: DDLBuilder.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/ddl/DDLBuilder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DDLBuilder.java 30 Apr 2003 11:27:26 -0000 1.2 +++ DDLBuilder.java 6 Jan 2004 19:27:18 -0000 1.3 @@ -1,3 +1,63 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 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 acknowledgement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgement may appear in the software itself, + * if and wherever such third-party acknowledgements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names 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 + * <http://www.apache.org/>. + * + */ package org.apache.commons.sql.ddl; import java.io.IOException; @@ -17,8 +77,7 @@ /** * Generates the DDL required to create and drop databases and tables. * - * @author <a href="mailto:[EMAIL PROTECTED]">Tim Anderson</a> - * @version 1.1 + * @version $Id$ */ public class DDLBuilder { 1.3 +24 -7 jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/task/DDLTask.java Index: DDLTask.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/task/DDLTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DDLTask.java 30 Apr 2003 11:27:28 -0000 1.2 +++ DDLTask.java 6 Jan 2004 19:27:18 -0000 1.3 @@ -1,9 +1,7 @@ -package org.apache.commons.sql.task; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,6 +51,7 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ +package org.apache.commons.sql.task; import java.io.File; import java.io.FileWriter; @@ -71,9 +70,7 @@ * a data model contains tables for a <strong>single</strong> * database. * - * @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a> - * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> - * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a> + * @version $Id$ */ public class DDLTask extends Task { @@ -94,6 +91,10 @@ */ private String targetDatabase; + /** + * Flag indicates whether SQL drop statements should be generated. + */ + private boolean dropTables = true; /** * Get the xml schema describing the application model. @@ -154,6 +155,20 @@ } /** + * @return Returns the dropTables. + */ + public boolean isDropTables() { + return dropTables; + } + + /** + * @param dropTables The dropTables to set. + */ + public void setDropTables(boolean dropTables) { + this.dropTables = dropTables; + } + + /** * Create the SQL DDL for the given database. */ public void execute() throws BuildException @@ -208,7 +223,7 @@ // OK we're ready now, lets try create the DDL try { - builder.createDatabase(database); + builder.createDatabase(database, dropTables); writer.close(); } catch (Exception e) @@ -235,4 +250,6 @@ builder.setWriter(writer); return builder; } + + } 1.3 +60 -0 jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/util/DDL.java Index: DDL.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/util/DDL.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DDL.java 30 Apr 2003 11:27:27 -0000 1.2 +++ DDL.java 6 Jan 2004 19:27:18 -0000 1.3 @@ -1,3 +1,63 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2004 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 acknowledgement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgement may appear in the software itself, + * if and wherever such third-party acknowledgements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names 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 + * <http://www.apache.org/>. + * + */ package org.apache.commons.sql.util; import java.io.FileInputStream; 1.9 +17 -1 jakarta-commons-sandbox/sql/xdocs/index.xml Index: index.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/sql/xdocs/index.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- index.xml 18 Nov 2003 23:19:50 -0000 1.8 +++ index.xml 6 Jan 2004 19:27:18 -0000 1.9 @@ -61,8 +61,24 @@ </source> <p> + The currently supported values for targetDatabase are: + </p> + + <ul> + <li>axion</li> + <li>db2</li> + <li>hsqldb</li> + <li>mckoi</li> + <li>mssql</li> + <li>mysql</li> + <li>oracle</li> + <li>postgresql</li> + <li>sybase</li> + </ul> + + <p> It is hoped that Commons SQL can be used to create a - <a href="http://jakarta.apache.org/turbine/maven/">Maven</a> + <a href="http://maven.apache.org">Maven</a> plugin for projects wishing to create beans or OJB files from some logical relational schema. </p> </section>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]