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 2006/03/11 16:37:16 UTC
svn commit: r385095 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils:
platform/PlatformImplBase.java task/DatabaseToDdlTask.java
Author: tomdz
Date: Sat Mar 11 07:37:15 2006
New Revision: 385095
URL: http://svn.apache.org/viewcvs?rev=385095&view=rev
Log:
Added attribute to the DatabaseToDdlTask that allows to specify the name of the model read from the database
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?rev=385095&r1=385094&r2=385095&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Sat Mar 11 07:37:15 2006
@@ -66,6 +66,9 @@
*/
public abstract class PlatformImplBase extends JdbcSupport implements Platform
{
+ /** The default name for models read from the database, if no name as given.*/
+ protected static final String MODEL_DEFAULT_NAME = "default";
+
/** The log for this platform. */
private final Log _log = LogFactory.getLog(getClass());
@@ -1635,6 +1638,10 @@
Database model = reader.getDatabase(connection, name, catalog, schema, tableTypes);
postprocessModelFromDatabase(model);
+ if ((model.getName() == null) || (model.getName().length() == 0))
+ {
+ model.setName(MODEL_DEFAULT_NAME);
+ }
return model;
}
catch (SQLException ex)
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java?rev=385095&r1=385094&r2=385095&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseToDdlTask.java Sat Mar 11 07:37:15 2006
@@ -37,6 +37,8 @@
private String _catalog;
/** 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;
/**
* Sets the database schema to access.
@@ -69,6 +71,17 @@
}
/**
+ * Sets the name that the model read from the database shall have.
+ * Use <code>null</code> or an empty string for the default name.
+ *
+ * @param modelName The model name
+ */
+ public void setModelName(String modelName)
+ {
+ _modelName = modelName;
+ }
+
+ /**
* Adds the "create dtd"-command.
*
* @param command The command
@@ -157,7 +170,7 @@
try
{
- return getPlatform().readModelFromDatabase(null, _catalog, _schema, getTableTypes());
+ return getPlatform().readModelFromDatabase(_modelName, _catalog, _schema, getTableTypes());
}
catch (Exception ex)
{