Author: tfischer
Date: Sun Nov 27 04:18:43 2005
New Revision: 349222
URL: http://svn.apache.org/viewcvs?rev=349222&view=rev
Log:
Extended support for derby (Part 2).
- IdMethod native is now supported
- Added mappings for Torque types LONGVARCHAR, BINARY and VARBINARY
- Implemented the methods getMaxColumnNameLength(), hasScale() and hasSize() in
PlatformDerbyImpl
- Foreign keys are now declared outside the CREATE TABLE statement, allowing to
create foreign references independent of the order of tables in the schema.xml
- The SQL for the creation of Indices is now generated correctly (a CRLF was
missing at the end)
Thanks to Johnny Macchione for the patches.
Added Johnny Macchione as a contributor
Updated information about derby in list of supported databases
Added:
db/torque/generator/trunk/src/java/org/apache/torque/engine/platform/PlatformDerbyImpl.java
Modified:
db/torque/runtime/trunk/xdocs/changes.xml
Added:
db/torque/generator/trunk/src/java/org/apache/torque/engine/platform/PlatformDerbyImpl.java
URL:
http://svn.apache.org/viewcvs/db/torque/generator/trunk/src/java/org/apache/torque/engine/platform/PlatformDerbyImpl.java?rev=349222&view=auto
==============================================================================
---
db/torque/generator/trunk/src/java/org/apache/torque/engine/platform/PlatformDerbyImpl.java
(added)
+++
db/torque/generator/trunk/src/java/org/apache/torque/engine/platform/PlatformDerbyImpl.java
Sun Nov 27 04:18:43 2005
@@ -0,0 +1,103 @@
+package org.apache.torque.engine.platform;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.torque.engine.database.model.Domain;
+import org.apache.torque.engine.database.model.SchemaType;
+
+/**
+ * Derby Platform implementation.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Johnny Macchione</a>
+ * @version $Id$
+ */
+public class PlatformDerbyImpl extends PlatformDefaultImpl
+{
+
+ /**
+ * Default constructor.
+ */
+ public PlatformDerbyImpl()
+ {
+ super();
+ initialize();
+ }
+
+ /**
+ * Initializes db specific domain mapping.
+ */
+ private void initialize()
+ {
+ setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "LONG
VARCHAR"));
+
+ // PENDING: Support CHAR(n) FOR BIT DATA: n [1;254]
+ // The size is always appended to the type in the templates => CHAR
FOR BIT DATA()!
+ //setSchemaDomainMapping(new Domain(SchemaType.BINARY, "CHAR(2048) FOR
BIT DATA"));
+
+ // PENDING: Support VARCHAR(n) FOR BIT DATA: n [1;32672]
+ // The size is always appended to the type in the templates => VARCHAR
FOR BIT DATA()!
+ //setSchemaDomainMapping(new Domain(SchemaType.VARBINARY,
"VARCHAR(2048) FOR BIT DATA"));
+
+ // Mapped to VARBINARY, because LONG VARCHAR FOR BIT DATA doesn't
require a size;
+ // turbine-schema.xml declares TURBINE_USER.OBJECT_DATA as VARBINARY
without size
+ setSchemaDomainMapping(new Domain(SchemaType.VARBINARY, "LONG VARCHAR
FOR BIT DATA"));
+ setSchemaDomainMapping(new Domain(SchemaType.LONGVARBINARY, "LONG
VARCHAR FOR BIT DATA"));
+ }
+
+ /**
+ * @see Platform#getMaxColumnNameLength()
+ */
+ public int getMaxColumnNameLength()
+ {
+ return 128;
+ }
+
+ /**
+ * @see Platform#getAutoIncrement()
+ */
+ public String getAutoIncrement()
+ {
+ return "GENERATED BY DEFAULT AS IDENTITY";
+ }
+
+ /**
+ * @see Platform#getNativeIdMethod()
+ */
+ public String getNativeIdMethod()
+ {
+ return Platform.IDENTITY;
+ }
+
+ /**
+ * @see Platform#hasScale(String)
+ */
+ public boolean hasScale(String sqlType)
+ {
+ return "NUMERIC".equals(sqlType) || "DECIMAL".equals(sqlType);
+ }
+
+ /**
+ * @see Platform#hasSize(String)
+ */
+ public boolean hasSize(String sqlType)
+ {
+ return "NUMERIC".equals(sqlType) || "DECIMAL".equals(sqlType)
+ || "VARCHAR".equals(sqlType) || "CHAR".equals(sqlType)
+ || "BINARY".equals(sqlType)
+ || "BLOB".equals(sqlType) || "CLOB".equals(sqlType);
+ }
+}
Modified: db/torque/runtime/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewcvs/db/torque/runtime/trunk/xdocs/changes.xml?rev=349222&r1=349221&r2=349222&view=diff
==============================================================================
--- db/torque/runtime/trunk/xdocs/changes.xml (original)
+++ db/torque/runtime/trunk/xdocs/changes.xml Sun Nov 27 04:18:43 2005
@@ -37,7 +37,7 @@
LONGVARCHAR, BINARY and VARBINARY
</li>
<li>
- Implemented the fuctions getMaxColumnNameLength(),
+ Implemented the methods getMaxColumnNameLength(),
hasScale() and hasSize() in PlatformDerbyImpl
</li>
<li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]