commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder MckoiSqlBuilder.java SqlBuilder.java
Date Mon, 16 Sep 2002 14:50:19 GMT
jstrachan    2002/09/16 07:50:19

  Modified:    sql/src/java/org/apache/commons/sql/builder
                        MckoiSqlBuilder.java SqlBuilder.java
  Log:
  Added a new SqlBuilder for the GPL'd Mckoi JDBC database.
  
  Added missing licences to classes in the model package.
  
  Added support for Column.getSQLTypeCode() so that columns can be associated with JDBC java.sql.Types
enumerations.
  
  Also used this new getSQLTypeCode() support so that DynaSql can properly set nulls in a
typesafe manner when insert/updating DynaBean instances
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/MckoiSqlBuilder.java
  
  Index: MckoiSqlBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/MckoiSqlBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MckoiSqlBuilder.java	13 Sep 2002 14:43:35 -0000	1.1
  +++ MckoiSqlBuilder.java	16 Sep 2002 14:50:19 -0000	1.2
  @@ -90,6 +90,6 @@
       }
       
       protected void printAutoIncrementColumn() throws IOException { 
  -        //print( "AUTO_INCREMENT" );
  +        print( "DEFAULT UNIQUEKEY('" + getTable().getName() + "')");
       }
   }
  
  
  
  1.7       +25 -3     jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java
  
  Index: SqlBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SqlBuilder.java	12 Sep 2002 17:56:49 -0000	1.6
  +++ SqlBuilder.java	16 Sep 2002 14:50:19 -0000	1.7
  @@ -111,7 +111,13 @@
   
       /** Should foreign key constraints be explicitly named */
       private boolean foreignKeyConstraintsNamed;
  +
  +    /** The current Table we're working on */
  +    private Table table;
       
  +    /** The current Column we're working on */
  +    private Column column;
  +        
       public SqlBuilder() {
       }
   
  @@ -133,13 +139,13 @@
           if (dropTable) {
               List tables = database.getTables();
               for (int i = tables.size() - 1; i >= 0; i-- ) {
  -                Table table = (Table) tables.get(i);
  +                table = (Table) tables.get(i);
                   dropTable(table);
               }
           }
               
           for (Iterator iter = database.getTables().iterator(); iter.hasNext(); ) {
  -            Table table = (Table) iter.next();
  +            table = (Table) iter.next();
               tableComment(table);
               createTable(table);
           }
  @@ -153,7 +159,7 @@
           // lets drop the tables in reverse order
           List tables = database.getTables();
           for (int i = tables.size() - 1; i >= 0; i-- ) {
  -            Table table = (Table) tables.get(i);
  +            table = (Table) tables.get(i);
               tableComment(table);
               dropTable(table);
           }
  @@ -182,6 +188,7 @@
        * Outputs the DDL to create the table along with any constraints
        */
       public void createTable(Table table) throws IOException {
  +        this.table = table;
           print("create table ");
           println(table.getName());
           println("(");
  @@ -210,6 +217,7 @@
        * Outputs the DDL to add a column to a table.
        */
       public void createColumn(Column column) throws IOException {
  +        this.column = column;
           print(column.getName());
           print(" ");
           print(getSqlType(column));
  @@ -318,6 +326,20 @@
       // Implementation methods
       //-------------------------------------------------------------------------       
        
   
  +    /**
  +     * @return the current Table we're working on
  +     */
  +    protected Table getTable() {
  +        return table;
  +    }
  +    
  +    /**
  +     * @return the current Column we're working on
  +     */
  +    protected Column getColumn() {
  +        return column;
  +    }
  +    
       /**
        * @return true if we should generate a primary key constraint for the given
        *  primary key columns. By default if there are no primary keys or the column(s) are

  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message