I have attatched a file that includes the patches that add support for
Postgres and indexes along with unit tests for the commons-sql package. 

James Strachan or Jason van Zyl, 

Could one of you please apply these? 

Thanks, 
John 
-- 
********************************
** John Thorhauer
** [EMAIL PROTECTED]
** take a look at:
**  http://tambora.zenplex.org
**  http://www.zenplex.org
**  http://www.zenplex.com
********************************

Index: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/PostgreSqlBuilder.java
===================================================================
RCS file: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/PostgreSqlBuilder.java
diff -N jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/PostgreSqlBuilder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/PostgreSqlBuilder.java	20 Sep 2002 18:32:19 -0000
@@ -0,0 +1,79 @@
+/*
+ * ====================================================================
+ *
+ * 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 acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements 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 Group.
+ *
+ * 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/>.
+ * 
+ * $Id$
+ */
+
+package org.apache.commons.sql.builder;
+
+import java.io.IOException;
+
+/**
+ * An SQL Builder for PostgresSqlL
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]";>John Thorhauer</a>
+ * @version $Revision: 1.14 $
+ */
+public class PostgreSqlBuilder extends SqlBuilder{
+
+    public PostgreSqlBuilder() 
+    {
+
+    } 
+
+    protected void printAutoIncrementColumn() throws IOException { 
+        print( "DEFAULT NEXTVAL('serial')" );
+    }
+}
Index: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java,v
retrieving revision 1.7
diff -u -r1.7 SqlBuilder.java
--- jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java	16 Sep 2002 14:50:19 -0000	1.7
+++ jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java	20 Sep 2002 18:32:23 -0000
@@ -69,6 +69,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.commons.sql.model.Index;
+import org.apache.commons.sql.model.IndexColumn;
 import org.apache.commons.sql.model.Column;
 import org.apache.commons.sql.model.Database;
 import org.apache.commons.sql.model.ForeignKey;
@@ -109,6 +111,9 @@
     /** Whether or not foreign key constraints are embedded inside the create table statement */
     private boolean foreignKeysEmbedded;
 
+    /** Whether or not indexes are embedded inside the create table statement */
+    private boolean indexesEmbedded;
+
     /** Should foreign key constraints be explicitly named */
     private boolean foreignKeyConstraintsNamed;
 
@@ -201,6 +206,9 @@
         if (isForeignKeysEmbedded()) {
             writeForeignKeys(table);
         }
+        if (isIndexesEmbedded()) {
+            writeEmbeddedIndexes(table);
+        }
         println();
         print(")");
         printEndOfStatement();
@@ -211,6 +219,9 @@
         if (!isForeignKeysEmbedded()) {
             writeForeignKeysAlterTable(table);
         }
+        if (!isIndexesEmbedded()) {
+            writeIndexes(table);
+        }
     }
 
     /** 
@@ -302,7 +313,23 @@
         this.foreignKeysEmbedded = foreignKeysEmbedded;
     }
 
+    /**
+     * @return whether the indexes are embedded in the create 
+     * table clause or as seperate statements.
+     * The default is false.
+     */
+    public boolean isIndexesEmbedded() {
+        return indexesEmbedded;
+    }
 
+    /**
+     * Sets whether the indexes are embedded in the create 
+     * table clause or as seperate statements.
+     * The default is false.
+     */
+    public void setIndexesEmbedded(boolean indexesEmbedded) {
+        this.indexesEmbedded = indexesEmbedded;
+    }
 
     /**
      * Returns whether foreign key constraints should be named when they are embedded inside
@@ -504,6 +531,55 @@
                 printEndOfStatement();
             }
         }
+    }
+
+    /**
+     * Writes the indexes.
+     */
+    protected void writeIndexes(Table table) throws IOException{
+        for (Iterator indexIter = table.getIndexes().iterator();
+            indexIter.hasNext();
+            ) {
+            Index index = (Index) indexIter.next();
+            if (index.getName() == null) {
+                log.warn( "Index Name is null for index: " + index);
+            }
+            else {
+                print("CREATE INDEX ");
+                print(index.getName());
+                print(" ON ");
+                print(table.getName());
+
+                print(" (");
+                
+                for (Iterator idxColumnIter = index.getIndexColumns().iterator();
+                    idxColumnIter.hasNext();
+                    ) 
+                {
+                    IndexColumn idxColumn = (IndexColumn)idxColumnIter.next();
+                    if (idxColumnIter.hasNext())
+                    {
+                        print(idxColumn.getName() + ", ");             
+                    }
+                    else
+                    {
+                        print(idxColumn.getName());
+                    }
+                }
+
+                print(")");
+                printEndOfStatement();
+            }
+        }
+    }
+
+
+    /**
+     * Writes the indexes embedded within the create table statement. not
+     * yet implemented
+     */
+    protected void writeEmbeddedIndexes(Table table) throws IOException 
+    {
     }
 
     /**
Index: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Index.java
===================================================================
RCS file: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Index.java
diff -N jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Index.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Index.java	20 Sep 2002 18:32:23 -0000
@@ -0,0 +1,91 @@
+/*
+ * ====================================================================
+ *
+ * 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 acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements 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 Group.
+ *
+ * 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/>.
+ * 
+ * $Id$
+ */
+package org.apache.commons.sql.model;
+
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Index
+{
+    private String name;
+        
+    private List indexColumns = new ArrayList();
+    
+    public Index() {}
+    
+    public String getName()
+    {
+        return name;
+    }
+    
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    
+    public void addIndexColumn(IndexColumn indexColumn)
+    {
+        indexColumns.add(indexColumn);
+    }
+    
+    public List getIndexColumns()
+    {
+        return indexColumns;
+    }
+}
Index: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/IndexColumn.java
===================================================================
RCS file: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/IndexColumn.java
diff -N jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/IndexColumn.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/IndexColumn.java	20 Sep 2002 18:32:23 -0000
@@ -0,0 +1,76 @@
+/*
+ * ====================================================================
+ *
+ * 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 acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements 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 Group.
+ *
+ * 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/>.
+ * 
+ * $Id$
+ */
+package org.apache.commons.sql.model;
+
+public class IndexColumn
+{
+    private String name;
+    private String size;
+    
+    public IndexColumn() {}
+    
+    public String getName()
+    {
+        return name;
+    }
+    
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+}
Index: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Table.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Table.java,v
retrieving revision 1.4
diff -u -r1.4 Table.java
--- jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Table.java	16 Sep 2002 15:18:29 -0000	1.4
+++ jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/Table.java	20 Sep 2002 18:32:23 -0000
@@ -72,6 +72,8 @@
     private List columns = new ArrayList();
     
     private List foreignKeys = new ArrayList();
+
+    private List indexes = new ArrayList();
     
     public Table() 
     {
@@ -117,6 +119,21 @@
         return (ForeignKey) foreignKeys.get(index);
     }        
     
+    public void addIndex(Index index)
+    {
+        indexes.add(index);
+    }
+    
+    public List getIndexes()
+    {
+        return indexes;
+    }
+
+    public Index getIndex(int index)
+    {
+        return (Index) indexes.get(index);
+    }
+
     
     // Helper methods
     //-------------------------------------------------------------------------                
Index: jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/TestDataModelRoundTrip.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/TestDataModelRoundTrip.java,v
retrieving revision 1.3
diff -u -r1.3 TestDataModelRoundTrip.java
--- jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/TestDataModelRoundTrip.java	12 Sep 2002 17:56:50 -0000	1.3
+++ jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/TestDataModelRoundTrip.java	20 Sep 2002 18:32:23 -0000
@@ -86,37 +86,64 @@
             assertTrue("Parsed a Database object", database != null);
             assertEquals("bookstore", database.getName());
             
-            assertTrue("more than one table found", database.getTables().size() > 0 );
+            assertTrue("More that one table should be found", 
+                        database.getTables().size() > 1 );
             
             // Test our first table which is the 'book' table
             Table t1 = database.getTable(1);
             assertEquals("book", t1.getName());
             
+            assertTrue("book table does not have primary", t1.hasPrimaryKey());
+
+            Index idx1 = (Index)t1.getIndex(0);
+            assertTrue("Did not find an index", idx1 != null);
+
+            ForeignKey key = (ForeignKey) t1.getForeignKey(0);
+            assertTrue("Did not find a foreign key", key != null);
+
             Column c0 = t1.getColumn(0);
             assertEquals("book_id", c0.getName());
-            assertTrue("book_id is required", c0.isRequired());
-            assertTrue("book_id is primary key", c0.isPrimaryKey());
+            assertTrue("book_id should be required", c0.isRequired());
+            assertTrue("book_id should be primary key", c0.isPrimaryKey());
             
             Column c1 = t1.getColumn(1);
             assertEquals("isbn", c1.getName());
-            assertTrue("isbn is required", c1.isRequired());
-            assertTrue("isbn is not primary key", ! c1.isPrimaryKey());
+            assertTrue("isbn should be required", c1.isRequired());
+            assertTrue("isbn should not be primary key but is", 
+                        ! c1.isPrimaryKey());
 
             List keyList1 = t1.getForeignKeys();
             assertEquals( "Foreign key count", 1, keyList1.size() );
             
             ForeignKey key0 = (ForeignKey) keyList1.get(0);
-            assertEquals("foreignTable is correct", "author", key0.getForeignTable());
+            assertEquals("foreignTable value correct", "author", 
+                        key0.getForeignTable());
             
             List refList1 = key0.getReferences();
-            assertEquals( "Reference count", 1, refList1.size() );
+            assertEquals( "Reference count not correct", 1, refList1.size() );
             
             Reference r1 = (Reference) refList1.get(0);
-            assertTrue("Found a reference", r1 != null);
+            assertTrue("Could not find a reference", r1 != null);
                         
-            assertEquals("local is correct", "author_id", r1.getLocal());
-            assertEquals("foreign is correct", "author_id", r1.getForeign());
+            assertEquals("local reference is incorrect", "author_id", 
+                         r1.getLocal());
+            assertEquals("foreign reference is incorrect", "author_id", 
+                         r1.getForeign());
             
+            List idxList = t1.getIndexes();
+            assertEquals( "Index count", 1, idxList.size() );
+
+
+            Index idx2 = (Index)idxList.get(0);
+            assertTrue("Did not find an index", idx2 != null);
+            assertEquals("Index name is incorrect", "book_isbn", idx2.getName());
+
+            List idxColumns = idx2.getIndexColumns();
+            IndexColumn idxColumn = (IndexColumn) idxColumns.get(0);
+            assertTrue("Did not find an index column", idxColumn != null);
+            assertEquals("Index column name is incorrect", "isbn", 
+                          idxColumn.getName());
+
             // Write out the bean
             //writeBean(database);
         }
Index: jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/builder/TestBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/builder/TestBuilder.java,v
retrieving revision 1.4
diff -u -r1.4 TestBuilder.java
--- jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/builder/TestBuilder.java	12 Sep 2002 17:56:49 -0000	1.4
+++ jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/builder/TestBuilder.java	20 Sep 2002 18:32:23 -0000
@@ -13,6 +13,8 @@
 import java.io.IOException;
 import java.io.FileInputStream;
 import java.io.FileWriter;
+import java.io.StringWriter;
+import java.io.Writer;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -68,8 +70,8 @@
         
         DatabaseReader reader = new DatabaseReader ();
         database = (Database) reader.parse(new FileInputStream(uri));
-        
         assertTrue("Loaded a valid database", database != null);
+
     }
 
     /**
@@ -78,22 +80,57 @@
     public void testBuilders()
         throws Exception
     {
+
         testBuilder( new AxionBuilder(), "axion.sql" );
         testBuilder( new HsqlDbBuilder(), "hsqldb.sql" );
         testBuilder( new MSSqlBuilder(), "mssql.sql" );        
         testBuilder( new MySqlBuilder(), "mysql.sql" );
         testBuilder( new OracleBuilder(), "oracle.sql" );
+        testBuilder( new PostgreSqlBuilder(), "postgres.sql" );
         testBuilder( new SybaseBuilder(), "sybase.sql" );
+
     }
     
+    /**
+     * A unit test for JUnit
+     */
+    public void testBaseBuilder()
+        throws Exception
+    {
+    
+        SqlBuilder builder = new SqlBuilder();
+        StringWriter sw = new StringWriter();
+        builder.setWriter(sw);
+        builder.dropDatabase(database);       
+
+        String drop = sw.toString();
+        int bookIdx = drop.indexOf("drop table book");
+        int authIdx = drop.indexOf("drop table author");
+
+        assertTrue("dropDatabase Failed to create proper drop statement for " +
+                    "book table. Here is the statment created:\n" + drop, 
+                    bookIdx > 0);
+        
+        assertTrue("dropDatabase Failed to create proper drop statement for " +
+                    "author table. Here is the statment created:\n" + drop,
+                     authIdx > 0);
+
+        Writer wr = builder.getWriter();
+        assertTrue("Couldnt find writer", wr != null);  
+
+
+    }
+
     protected void testBuilder(SqlBuilder builder, String fileName) throws Exception 
     {
+
         String name = baseDir + "/target/" + fileName;
         
         FileWriter writer = new FileWriter( name );
         builder.setWriter( writer );
         builder.createDatabase( database );
         writer.close();
+
     }
 }
 
Index: jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestColumn.java
===================================================================
RCS file: jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestColumn.java
diff -N jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestColumn.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestColumn.java	20 Sep 2002 18:32:23 -0000
@@ -0,0 +1,74 @@
+package org.apache.commons.sql.model;
+
+/*
+ * Copyright (C) The Apache Software Foundation. All rights reserved.
+ *
+ * This software is published under the terms of the Apache Software License
+ * version 1.1, a copy of which has been included with this distribution in
+ * the LICENSE file.
+ *
+ * $Id$
+ */
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.impl.SimpleLog;
+
+import org.apache.commons.sql.model.Column;
+
+/**
+ * Test harness for Column Class
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]";>John Thorhauer</a>
+ * @version $Revision: 1.3 $
+ */
+public class TestColumn
+     extends TestCase
+{
+
+    /**
+     * A unit test suite for JUnit
+     */
+    public static Test suite()
+    {
+        return new TestSuite(TestColumn.class);
+    }
+
+    /**
+     * Constructor for the TestColumn
+     *
+     * @param testName
+     */
+    public TestColumn(String testName)
+    {
+        super(testName);
+    }
+
+    /**
+     * The JUnit setup method
+     */
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+    }
+
+    /**
+     * A unit test for JUnit
+     */
+    public void testColumn()
+        throws Exception
+    {
+        Column column = new Column("Test1","INTEGER",255,true,true,true);
+        assertTrue("Column is null", column != null);
+        assertTrue("Column toString does not end with [name=Test1;type=INTEGER]", 
+               ((String)column.toString()).endsWith("[name=Test1;type=INTEGER]"));
+    }
+
+}
+
Index: jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestTypeMap.java
===================================================================
RCS file: jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestTypeMap.java
diff -N jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestTypeMap.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jakarta-commons-sandbox/sql/src/test/org/apache/commons/sql/model/TestTypeMap.java	20 Sep 2002 18:32:23 -0000
@@ -0,0 +1,69 @@
+package org.apache.commons.sql.model;
+
+/*
+ * Copyright (C) The Apache Software Foundation. All rights reserved.
+ *
+ * This software is published under the terms of the Apache Software License
+ * version 1.1, a copy of which has been included with this distribution in
+ * the LICENSE file.
+ *
+ * $Id$
+ */
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.impl.SimpleLog;
+
+/**
+ * Test harness for TypeMap Class
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]";>John Thorhauer</a>
+ * @version $Revision: 1.3 $
+ */
+public class TestTypeMap
+     extends TestCase
+{
+
+    /**
+     * A unit test suite for JUnit
+     */
+    public static Test suite()
+    {
+        return new TestSuite(TestTypeMap.class);
+    }
+
+    /**
+     * Constructor for the TestTypeMap
+     *
+     * @param testName
+     */
+    public TestTypeMap(String testName)
+    {
+        super(testName);
+    }
+
+    /**
+     * The JUnit setup method
+     */
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+    }
+
+    /**
+     * A unit test for JUnit
+     */
+    public void testTextType()
+        throws Exception
+    {
+        assertTrue("VARCHAR should be a text type", TypeMap.isTextType("VARCHAR"));
+        assertTrue("FLOAT should not be a text type", !TypeMap.isTextType("FLOAT"));
+    }
+
+}
\ No newline at end of file
Index: jakarta-commons-sandbox/sql/src/test-input/datamodel.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/test-input/datamodel.xml,v
retrieving revision 1.3
diff -u -r1.3 datamodel.xml
--- jakarta-commons-sandbox/sql/src/test-input/datamodel.xml	12 Sep 2002 17:56:49 -0000	1.3
+++ jakarta-commons-sandbox/sql/src/test-input/datamodel.xml	20 Sep 2002 18:32:23 -0000
@@ -21,9 +21,14 @@
     <column name="author_id" type="INTEGER" required="true"/>
     <column name="title" type="VARCHAR" size="255" required="true"/>
 	    
-	  <foreign-key foreignTable="author">
-	    <reference local="author_id" foreign="author_id"/>
-	  </foreign-key>  
+    <foreign-key foreignTable="author">
+    <reference local="author_id" foreign="author_id"/>
+    </foreign-key>  
+
+    <index name="book_isbn">
+     <index-column name="isbn"/>
+    </index>
+              
   </table>
 
 </database>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to