You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2007/01/02 00:56:55 UTC

svn commit: r491711 - in /db/ddlutils/trunk: ./ src/java/org/apache/ddlutils/io/ src/java/org/apache/ddlutils/platform/ src/java/org/apache/ddlutils/platform/firebird/ src/java/org/apache/ddlutils/platform/interbase/ src/java/org/apache/ddlutils/task/

Author: tomdz
Date: Mon Jan  1 15:56:53 2007
New Revision: 491711

URL: http://svn.apache.org/viewvc?view=rev&rev=491711
Log:
Added support for determining the schema of a table when reading data from a database
Minor checkstyle fixes

Modified:
    db/ddlutils/trunk/build-sample.xml
    db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseDataIO.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Parameter.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToFileCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaSqlToFileCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToDatabaseCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java

Modified: db/ddlutils/trunk/build-sample.xml
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/build-sample.xml?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/build-sample.xml (original)
+++ db/ddlutils/trunk/build-sample.xml Mon Jan  1 15:56:53 2007
@@ -130,4 +130,18 @@
                            usebatchmode="false"/>
     </ddlToDatabase> 
   </target>
+
+  <target name="readDataFromDb">
+    <databaseToDdl usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
+                   catalogpattern="${catalogpattern}"
+                   schemapattern="${schemapattern}"
+                   databasetype="${platform}"
+                   verbosity="${verbosity}">
+      <database driverclassname="${datasource.driverClassName}"
+                url="${datasource.url}"
+                username="${datasource.username}"
+                password="${datasource.password}"/> 
+      <writedatatofile outputfile="${datafile}"/>
+    </databaseToDdl> 
+  </target>
 </project>

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseDataIO.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseDataIO.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseDataIO.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseDataIO.java Mon Jan  1 15:56:53 2007
@@ -25,6 +25,8 @@
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Iterator;
 
@@ -52,6 +54,11 @@
     /** The maximum number of objects to insert in one batch. */
     private Integer _batchSize;
 
+    /** Whether DdlUtils should search for the schema of the tables. @deprecated */
+    private boolean _determineSchema;
+    /** The schema pattern for finding tables when reading data from a live database. @deprecated */
+    private String _schemaPattern;
+    
     /**
      * Registers a converter.
      * 
@@ -141,7 +148,7 @@
      * result in beans not inserted at all. The sink will then throw an appropriate exception at the end
      * of the insertion process (method {@link #end()}).
      *
-     * @param ensureFkOrder <code>true</code> if beans shall be inserted after its foreignkey-references
+     * @param ensureFKOrder <code>true</code> if beans shall be inserted after its foreignkey-references
      */
     public void setEnsureFKOrder(boolean ensureFKOrder)
     {
@@ -149,6 +156,29 @@
     }
 
     /**
+     * Specifies whether DdlUtils should try to find the schema of the tables when reading data
+     * from a live database.
+     * 
+     * @param determineSchema Whether to try to find the table's schemas
+     * @deprecated Will be removed once proper schema support is in place
+     */
+    public void setDetermineSchema(boolean determineSchema)
+    {
+        _determineSchema = determineSchema;
+    }
+
+    /**
+     * Sets the schema pattern to find the schemas of tables when reading data from a live database.
+     * 
+     * @param schemaPattern The schema pattern
+     * @deprecated Will be removed once proper schema support is in place
+     */
+    public void setSchemaPattern(String schemaPattern)
+    {
+        _schemaPattern = schemaPattern;
+    }
+
+    /**
      * Registers the converters at the given configuration.
      * 
      * @param converterConf The converter configuration
@@ -350,6 +380,37 @@
             query.setLength(0);
             query.append("SELECT ");
 
+            Connection connection = null;
+            String     schema     = null;
+
+            if (_determineSchema)
+            {
+                try
+                {
+                    // TODO: Remove this once we have full support for schemas
+                    connection = platform.borrowConnection();
+                    schema     = platform.getModelReader().determineSchemaOf(connection, _schemaPattern, tables[0]);
+                }
+                catch (SQLException ex)
+                {
+                    // ignored
+                }
+                finally
+                {
+                    if (connection != null)
+                    {
+                        try
+                        {
+                            connection.close();
+                        }
+                        catch (SQLException ex)
+                        {
+                            // ignored
+                        }
+                    }
+                }
+            }
+
             Column[] columns = tables[0].getColumns();
 
             for (int columnIdx = 0; columnIdx < columns.length; columnIdx++)
@@ -373,6 +434,11 @@
             {
                 query.append(platform.getPlatformInfo().getDelimiterToken());
             }
+            if (schema != null)
+            {
+                query.append(schema);
+                query.append(".");
+            }
             query.append(tables[0].getName());
             if (platform.isDelimitedIdentifierModeOn())
             {
@@ -428,7 +494,7 @@
      * platform is connected.
      * 
      * @param platform The platform, must be connected to a live database
-     * @param input    The input streams for the XML data
+     * @param inputs   The input streams for the XML data
      */
     public void writeDataToDatabase(Platform platform, InputStream[] inputs) throws DdlUtilsException
     {
@@ -440,7 +506,7 @@
      * platform is connected.
      * 
      * @param platform The platform, must be connected to a live database
-     * @param input    The input readers for the XML data
+     * @param inputs   The input readers for the XML data
      */
     public void writeDataToDatabase(Platform platform, Reader[] inputs) throws DdlUtilsException
     {
@@ -473,7 +539,7 @@
      * 
      * @param platform The platform, must be connected to a live database
      * @param model    The model to which to constrain the written data
-     * @param input    The input streams for the XML data
+     * @param inputs   The input streams for the XML data
      */
     public void writeDataToDatabase(Platform platform, Database model, InputStream[] inputs) throws DdlUtilsException
     {
@@ -493,7 +559,7 @@
      * 
      * @param platform The platform, must be connected to a live database
      * @param model    The model to which to constrain the written data
-     * @param input    The input readers for the XML data
+     * @param inputs   The input readers for the XML data
      */
     public void writeDataToDatabase(Platform platform, Database model, Reader[] inputs) throws DdlUtilsException
     {
@@ -530,7 +596,7 @@
      * code using this method.
      * 
      * @param dataReader The data reader
-     * @param input      The input streams for the XML data
+     * @param inputs     The input streams for the XML data
      */
     public void writeDataToDatabase(DataReader dataReader, InputStream[] inputs) throws DdlUtilsException
     {
@@ -547,7 +613,7 @@
      * code using this method.
      * 
      * @param dataReader The data reader
-     * @param input      The input readers for the XML data
+     * @param inputs     The input readers for the XML data
      */
     public void writeDataToDatabase(DataReader dataReader, Reader[] inputs) throws DdlUtilsException
     {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java Mon Jan  1 15:56:53 2007
@@ -457,9 +457,9 @@
                     catalog = db.getName();
                 }
             } 
-            catch(Exception e) 
+            catch (Exception ex) 
             {
-                _log.info("Cannot determine the catalog name from connection.");
+                _log.info("Cannot determine the catalog name from connection.", ex);
             }
         }
         else
@@ -1111,5 +1111,81 @@
             }
         }
         return result;
+    }
+
+    /**
+     * Tries to find the schema to which the given table belongs.
+     * 
+     * @param connection    The database connection
+     * @param schemaPattern The schema pattern to limit the schemas to search in
+     * @param table         The table to search for
+     * @return The schema name or <code>null</code> if the schema of the table
+     *         could not be found
+     * @deprecated Will be removed once full schema support is in place
+     */
+    public String determineSchemaOf(Connection connection, String schemaPattern, Table table) throws SQLException
+    {
+        ResultSet tableData  = null;
+        ResultSet columnData = null;
+
+        try
+        {
+            DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
+
+            metaData.setMetaData(connection.getMetaData());
+            metaData.setCatalog(getDefaultCatalogPattern());
+            metaData.setSchemaPattern(schemaPattern == null ? getDefaultSchemaPattern() : schemaPattern);
+            metaData.setTableTypes(getDefaultTableTypes());
+
+            String tablePattern = table.getName();
+
+            if (getPlatform().isDelimitedIdentifierModeOn())
+            {
+                tablePattern = tablePattern.toUpperCase();
+            }
+
+            tableData = metaData.getTables(tablePattern);
+
+            boolean found  = false;
+            String  schema = null;
+
+            while (!found && tableData.next())
+            {
+                Map    values    = readColumns(tableData, getColumnsForTable());
+                String tableName = (String)values.get("TABLE_NAME");
+
+                if ((tableName != null) && (tableName.length() > 0))
+                {
+                    schema     = (String)values.get("TABLE_SCHEM");
+                    columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
+                    found      = true;
+
+                    while (found && columnData.next())
+                    {
+                        values = readColumns(columnData, getColumnsForColumn());
+
+                        if (table.findColumn((String)values.get("COLUMN_NAME"),
+                                             getPlatform().isDelimitedIdentifierModeOn()) == null)
+                        {
+                            found = false;
+                        }
+                    }
+                    columnData.close();
+                    columnData = null;
+                }
+            }
+            return found ? schema : null;
+        }
+        finally
+        {
+            if (columnData != null)
+            {
+                columnData.close();
+            }
+            if (tableData != null)
+            {
+                tableData.close();
+            }
+        }
     }
 }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java Mon Jan  1 15:56:53 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -394,6 +395,92 @@
             if (stmt != null)
             {
                 stmt.close();
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String determineSchemaOf(Connection connection, String schemaPattern, Table table) throws SQLException
+    {
+        ResultSet tableData  = null;
+        ResultSet columnData = null;
+
+        try
+        {
+            DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
+
+            metaData.setMetaData(connection.getMetaData());
+            metaData.setCatalog(getDefaultCatalogPattern());
+            metaData.setSchemaPattern(schemaPattern == null ? getDefaultSchemaPattern() : schemaPattern);
+            metaData.setTableTypes(getDefaultTableTypes());
+
+            String tablePattern = table.getName();
+
+            if (getPlatform().isDelimitedIdentifierModeOn())
+            {
+                tablePattern = tablePattern.toUpperCase();
+            }
+
+            tableData = metaData.getTables(tablePattern);
+
+            boolean found  = false;
+            String  schema = null;
+
+            while (!found && tableData.next())
+            {
+                Map    values    = readColumns(tableData, getColumnsForTable());
+                String tableName = (String)values.get("TABLE_NAME");
+
+                if ((tableName != null) && (tableName.length() > 0))
+                {
+                    schema = (String)values.get("TABLE_SCHEM");
+                    found  = true;
+
+                    if (getPlatform().isDelimitedIdentifierModeOn())
+                    {
+                        // Jaybird has a problem when delimited identifiers are used as
+                        // it is not able to find the columns for the table
+                        // So we have to filter manually below
+                        columnData = metaData.getColumns(getDefaultTablePattern(), getDefaultColumnPattern());
+                    }
+                    else
+                    {
+                        columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
+                    }
+
+                    while (found && columnData.next())
+                    {
+                        values = readColumns(columnData, getColumnsForColumn());
+
+                        if (getPlatform().isDelimitedIdentifierModeOn() &&
+                            !tableName.equals(values.get("TABLE_NAME")))
+                        {
+                            continue;
+                        }
+
+                        if (table.findColumn((String)values.get("COLUMN_NAME"),
+                                             getPlatform().isDelimitedIdentifierModeOn()) == null)
+                        {
+                            found = false;
+                        }
+                    }
+                    columnData.close();
+                    columnData = null;
+                }
+            }
+            return found ? schema : null;
+        }
+        finally
+        {
+            if (columnData != null)
+            {
+                columnData.close();
+            }
+            if (tableData != null)
+            {
+                tableData.close();
             }
         }
     }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java Mon Jan  1 15:56:53 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -383,6 +384,92 @@
             if (stmt != null)
             {
                 stmt.close();
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String determineSchemaOf(Connection connection, String schemaPattern, Table table) throws SQLException
+    {
+        ResultSet tableData  = null;
+        ResultSet columnData = null;
+
+        try
+        {
+            DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
+
+            metaData.setMetaData(connection.getMetaData());
+            metaData.setCatalog(getDefaultCatalogPattern());
+            metaData.setSchemaPattern(schemaPattern == null ? getDefaultSchemaPattern() : schemaPattern);
+            metaData.setTableTypes(getDefaultTableTypes());
+
+            String tablePattern = table.getName();
+
+            if (getPlatform().isDelimitedIdentifierModeOn())
+            {
+                tablePattern = tablePattern.toUpperCase();
+            }
+
+            tableData = metaData.getTables(tablePattern);
+
+            boolean found  = false;
+            String  schema = null;
+
+            while (!found && tableData.next())
+            {
+                Map    values    = readColumns(tableData, getColumnsForTable());
+                String tableName = (String)values.get("TABLE_NAME");
+
+                if ((tableName != null) && (tableName.length() > 0))
+                {
+                    schema = (String)values.get("TABLE_SCHEM");
+                    found  = true;
+
+                    if (getPlatform().isDelimitedIdentifierModeOn())
+                    {
+                        // Jaybird has a problem when delimited identifiers are used as
+                        // it is not able to find the columns for the table
+                        // So we have to filter manually below
+                        columnData = metaData.getColumns(getDefaultTablePattern(), getDefaultColumnPattern());
+                    }
+                    else
+                    {
+                        columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
+                    }
+
+                    while (found && columnData.next())
+                    {
+                        values = readColumns(columnData, getColumnsForColumn());
+
+                        if (getPlatform().isDelimitedIdentifierModeOn() &&
+                            !tableName.equals(values.get("TABLE_NAME")))
+                        {
+                            continue;
+                        }
+
+                        if (table.findColumn((String)values.get("COLUMN_NAME"),
+                                             getPlatform().isDelimitedIdentifierModeOn()) == null)
+                        {
+                            found = false;
+                        }
+                    }
+                    columnData.close();
+                    columnData = null;
+                }
+            }
+            return found ? schema : null;
+        }
+        finally
+        {
+            if (columnData != null)
+            {
+                columnData.close();
+            }
+            if (tableData != null)
+            {
+                tableData.close();
             }
         }
     }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java Mon Jan  1 15:56:53 2007
@@ -21,7 +21,6 @@
 
 import org.apache.ddlutils.model.Database;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Base interface for commands that work with a model.
@@ -45,5 +44,5 @@
      * @param task  The executing task
      * @param model The database model
      */
-    public void execute(Task task, Database model) throws BuildException;
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException;
 }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java Mon Jan  1 15:56:53 2007
@@ -28,7 +28,6 @@
 import org.apache.ddlutils.Platform;
 import org.apache.ddlutils.model.Database;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * The sub task for creating the target database. Note that this is only supported on some database
@@ -65,7 +64,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         BasicDataSource dataSource = getDataSource();
 

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java Mon Jan  1 15:56:53 2007
@@ -110,7 +110,7 @@
     /**
      * Specifies the verbosity of the task's debug output. Default is <code>WARN</code>.
      * 
-     * @param verbosity The verbosity level
+     * @param level The verbosity level
      */
     public void setVerbosity(VerbosityLevel level)
     {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java Mon Jan  1 15:56:53 2007
@@ -59,7 +59,7 @@
     /** The table types to recognize when reading the model from the database. */
     private String _tableTypes;
     /** The name of the model read from the database. */
-    private String _modelName;
+    private String _modelName = "unnamed";
 
     /**
      * Specifies the table types to be processed. More precisely, all tables that are of a

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java Mon Jan  1 15:56:53 2007
@@ -23,7 +23,6 @@
 import org.apache.ddlutils.Platform;
 import org.apache.ddlutils.model.Database;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Sub task for dropping the target database. Note that this is only supported on some database
@@ -47,7 +46,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         BasicDataSource dataSource = getDataSource();
 

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java Mon Jan  1 15:56:53 2007
@@ -173,7 +173,7 @@
      * Specifies the table types to be processed. For details and typical table types see
      * <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String[])">java.sql.DatabaseMetaData#getTables</a>.
      *
-     * @param tablePattern The table pattern
+     * @param tableTypes The table types to read
      * @ant.not-required By default, all types of tables are read.
      */
     public void setTableTypes(String tableTypes)

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Parameter.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Parameter.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Parameter.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Parameter.java Mon Jan  1 15:56:53 2007
@@ -53,7 +53,7 @@
 
     /**
      * Specifies the name of the parameter. See the database support documentation
-     * for details on the parameters supported by the individual platforms.</td>
+     * for details on the parameters supported by the individual platforms.
      *
      * @param name The name
      * @ant.required

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java Mon Jan  1 15:56:53 2007
@@ -140,7 +140,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         if ((_singleDataFile != null) && !_fileSets.isEmpty())
         {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToFileCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToFileCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToFileCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToFileCommand.java Mon Jan  1 15:56:53 2007
@@ -24,7 +24,6 @@
 
 import org.apache.ddlutils.model.Database;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Reads the data currently in the table in the live database (as specified by the
@@ -40,6 +39,9 @@
     /** The character encoding to use. */
     private String _encoding;
 
+    /** Whether DdlUtils should search for the schema of the tables. @deprecated */
+    private boolean _determineSchema;
+
     /**
      * Specifies the file to write the data XML to.
      * 
@@ -63,12 +65,26 @@
     }
 
     /**
+     * Specifies whether DdlUtils should try to find the schema of the tables when reading data
+     * from a live database.
+     * 
+     * @param determineSchema Whether to try to find the table's schemas
+     * @deprecated Will be removed once proper schema support is in place
+     */
+    public void setDetermineSchema(boolean determineSchema)
+    {
+        _determineSchema = determineSchema;
+    }
+
+    /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         try
         {
+            getDataIO().setDetermineSchema(_determineSchema);
+            getDataIO().setSchemaPattern(task.getPlatformConfiguration().getSchemaPattern());
             getDataIO().writeDataToXML(getPlatform(),
                                        new FileOutputStream(_outputFile), _encoding);
             _log.info("Written data XML to file" + _outputFile.getAbsolutePath());

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java Mon Jan  1 15:56:53 2007
@@ -27,7 +27,6 @@
 import org.apache.ddlutils.io.DataDtdWriter;
 import org.apache.ddlutils.model.Database;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Creates a DTD that specifies the layout for data XML files.<br/>
@@ -67,7 +66,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         if (_outputFile == null)
         {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaSqlToFileCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaSqlToFileCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaSqlToFileCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaSqlToFileCommand.java Mon Jan  1 15:56:53 2007
@@ -28,7 +28,6 @@
 import org.apache.ddlutils.model.Database;
 import org.apache.ddlutils.platform.CreationParameters;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Parses the schema XML files specified in the enclosing task, and writes the SQL statements
@@ -108,7 +107,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         if (_outputFile == null)
         {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToDatabaseCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToDatabaseCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToDatabaseCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToDatabaseCommand.java Mon Jan  1 15:56:53 2007
@@ -23,7 +23,6 @@
 import org.apache.ddlutils.model.Database;
 import org.apache.ddlutils.platform.CreationParameters;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Parses the schema XML files specified for the enclosing task, and creates the corresponding
@@ -86,7 +85,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         if (getDataSource() == null)
         {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java?view=diff&rev=491711&r1=491710&r2=491711
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java Mon Jan  1 15:56:53 2007
@@ -27,7 +27,6 @@
 import org.apache.ddlutils.io.DatabaseIO;
 import org.apache.ddlutils.model.Database;
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
 
 /**
  * Reads the schema of the live database (as specified in the enclosing task), and writes
@@ -66,7 +65,7 @@
     /**
      * {@inheritDoc}
      */
-    public void execute(Task task, Database model) throws BuildException
+    public void execute(DatabaseTaskBase task, Database model) throws BuildException
     {
         if (_outputFile == null)
         {