if anyone cares...

These are the patches from my email 2 days ago... new logging,
include/exclude tables, dbSchema and resource clean ups. my logging is just
some system.outs... that may not be so cool...

Index: build.properties
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/conf/build.properties,v
retrieving revision 1.2
diff -r1.2 build.properties
89a90
> databaseSchema = schema
93a95,104
> 
> # tell the JDBC task what tables to include (only these tables will be included)
> #       leave blank for all tables (to be included)
> # must be CSV (i.e. includeTables=my_table,my_table2,mytable3)
> includeTables=
> 
> # tell the JDBC task what tables to exclude (only these tables will be excluded)
> #       leave blank for all tables (to be included)
> # must be CSV (i.e. includeTables=my_table,my_table2,mytable3)
> excludeTables=
Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/conf/build.xml,v
retrieving revision 1.6
diff -r1.6 build.xml
110a111
>       dbSchema="${databaseSchema}"
112a114,115
>       includeTables="${includeTables}"
>       excludeTables="${excludeTables}"
Index: TorqueJDBCTransformTask.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 TorqueJDBCTransformTask.java
73a74,75
> import java.util.ArrayList;
> import java.util.StringTokenizer;
94a97
>  *  @author <a href="mailto:[EMAIL PROTECTED]";>Dan Bachelder</a>
113a117,119
>     /** JDBC schema. */
>     protected String dbSchema;
> 
116a123,128
>     /** list of tables to include (CSV) */
>     protected String includeTables = "";
> 
>     /** list of tables to exclude (CSV) */
>     protected String excludeTables = "";
>      
126a139,141
>     private ArrayList includeList = null;
>     private ArrayList excludeList = null;
> 
148a164,168
>     
>     public void setDbSchema(String v)
>     {
>         dbSchema = v;
>     }
158a179,190
>     
>     public void setIncludeTables(String v)
>     {
>         this.includeTables = v;
>     }
> 
>     public void setExcludeTables(String v)
>     {
>         this.excludeTables = v;
>     }
>     
>     
216a249
> System.out.println("Fetching DatabaseMetaData...");
219a253
> System.out.println("Generate table list...");
227a262,263
> System.out.println("Generate column lists...");
> 
241a278
> 
246a284
> System.out.println("Generate XML for table " + curTable + "...");
257d294
< 
345a383
>         try{con.close();}catch(Exception e){}
359c397
<         ResultSet tableNames = dbMeta.getTables(null,null, "%",null);
---
>         ResultSet tableNames = dbMeta.getTables(null,dbSchema, "%",null);
365c403,405
<             if (type.equals("TABLE"))
---
>             if ( (type.equals("TABLE") || type.equals("VIEW")) 
>                 && !excludeHasTable(name) 
>                 && !tables.contains(name))
367c407,411
<                 tables.addElement(name);
---
>                 if( (includeTables.trim().length() == 0) || 
>                     ((includeTables.trim().length() > 0) && includeHasTable(name)))
>                 {
>                     tables.addElement(name);
>                 }
369a414
>         try{tableNames.close();}catch(Exception e){}
372c417,446
< 
---
>     
>     private boolean excludeHasTable(String theTable)
>         {
>         if(excludeList == null)
>             {
>             excludeList = new ArrayList();
>             StringTokenizer st = new StringTokenizer(excludeTables, ",");
>             while(st.hasMoreElements())
>                 {
>                 String token = st.nextToken();
>                 excludeList.add(token.toLowerCase());
>                 }
>             }
>         return excludeList.contains(theTable.toLowerCase());    
>     }
>     
>     private boolean includeHasTable(String theTable)
>         {
>         if(includeList == null)
>             {
>             includeList = new ArrayList();
>             StringTokenizer st = new StringTokenizer(includeTables, ",");
>             while(st.hasMoreElements())
>                 {
>                 String token = st.nextToken();
>                 includeList.add(token.toLowerCase());
>                 }
>             }
>         return includeList.contains(theTable.toLowerCase());    
>         }
392c466
<         ResultSet columnSet = dbMeta.getColumns(null,null, tableName, null);
---
>         ResultSet columnSet = dbMeta.getColumns(null, dbSchema, tableName, null);
407a482
>         try{columnSet.close();}catch(Exception e){}
408a484
>         
422c498
<         ResultSet parts = dbMeta.getPrimaryKeys(null, null, tableName);
---
>         ResultSet parts = dbMeta.getPrimaryKeys(null, dbSchema, tableName);
427a504
>         try{parts.close();}catch(Exception e){}
441c518
<         ResultSet foreignKeys = dbMeta.getImportedKeys(null, null, tableName);
---
>         ResultSet foreignKeys = dbMeta.getImportedKeys(null, dbSchema, tableName);
469a547
>         try{foreignKeys.close();}catch(Exception e){}

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

Reply via email to