Author: ppoddar
Date: Wed Aug 13 14:34:52 2008
New Revision: 685683
URL:
http://svn.apache.org/viewvc?rev=685683&view=revLog:
OPENJPA-664: Rollback revision 679442 name length constraint checks
Modified:
openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java
openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL:
http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=685683&r1=685682&r2=685683&view=diff==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Wed Aug 13 14:34:52 2008
@@ -3065,9 +3065,7 @@
*/
public String[] getCreateTableSQL(Table table) {
StringBuffer buf = new StringBuffer();
- String tableName = checkNameLength(getFullName(table, false),
- maxTableNameLength, "long-table-name");
- buf.append("CREATE TABLE ").append(tableName);
+ buf.append("CREATE TABLE ").append(getFullName(table, false));
if (supportsComments && table.hasComment()) {
buf.append(" ");
comment(buf, table.getComment());
@@ -3140,9 +3138,7 @@
StringBuffer buf = new StringBuffer();
buf.append("CREATE SEQUENCE ");
- String seqName = checkNameLength(getFullName(seq), maxTableNameLength,
- "long-seq-name");
- buf.append(seqName);
+ buf.append(getFullName(seq));
if (seq.getInitialValue() != 0)
buf.append(" START WITH ").append(seq.getInitialValue());
if (seq.getIncrement() > 1)
@@ -3168,9 +3164,8 @@
buf.append("CREATE ");
if (index.isUnique())
buf.append("UNIQUE ");
- String indexName = checkNameLength(index.getName(), maxIndexNameLength,
- "long-index-name");
- buf.append("INDEX ").append(indexName);
+ buf.append("INDEX ").append(index.getName());
+
buf.append(" ON ").append(getFullName(index.getTable(), false));
buf.append(" (").append(Strings.join(index.getColumns(), ", ")).
append(")");
@@ -3280,9 +3275,7 @@
*/
protected String getDeclareColumnSQL(Column col, boolean alter) {
StringBuffer buf = new StringBuffer();
- String columnName = checkNameLength(col.getName(), maxColumnNameLength,
- "long-column-name");
- buf.append(columnName).append(" ");
+ buf.append(col).append(" ");
buf.append(getTypeName(col));
// can't add constraints to a column we're adding after table
@@ -3469,11 +3462,11 @@
if (!supportsUniqueConstraints
|| (unq.isDeferred() && !supportsDeferredUniqueConstraints()))
return null;
+
StringBuffer buf = new StringBuffer();
if (unq.getName() != null
&& CONS_NAME_BEFORE.equals(constraintNameMode))
- buf.append("CONSTRAINT ").append(checkNameLength(unq.getName(),
- maxConstraintNameLength, "long-constraint-name")).append(" ");
+ buf.append("CONSTRAINT ").append(unq.getName()).append(" ");
buf.append("UNIQUE ");
if (unq.getName() != null && CONS_NAME_MID.equals(constraintNameMode))
buf.append(unq.getName()).append(" ");
@@ -4546,16 +4539,4 @@
public void deleteStream(JDBCStore store, Select sel) throws SQLException {
// Do nothing
}
-
- /**
- * Validate that the given name is no longer than given maximum length.
- * If the given name is indeed longer then raises an UserException with the
- * given message key otherwise returns the same name.
- */
- final String checkNameLength(String name, int length, String msgKey) {
- if (name.length() > length)
- throw new UserException(_loc.get(msgKey, name, name.length(),
- length));
- return name;
- }
}
Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java
URL:
http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java?rev=685683&r1=685682&r2=685683&view=diff==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java Wed Aug 13 14:34:52 2008
@@ -46,11 +46,9 @@
stringLengthFunction = "LENGTH({0})";
substringFunctionName = "SUBSTR";
- // Derby name length restriction has been relaxed
- //
http://www.archivum.info/derby-dev@.../2004-12/msg00270.html- maxConstraintNameLength = 128;
+ maxConstraintNameLength = 18;
maxIndexNameLength = 128;
- maxColumnNameLength = 128;
+ maxColumnNameLength = 30;
maxTableNameLength = 128;
useGetBytesForBlobs = true;
Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL:
http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=685683&r1=685682&r2=685683&view=diff==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties Wed Aug 13 14:34:52 2008
@@ -175,14 +175,3 @@
batch-update-success-count: ExecuteBatch command returns update success count {0}
connection-defaults: Initial connection autoCommit: {0}, holdability: {1}, \
TransactionIsolation: {2}
-long-table-name: Table name "{0}" is {1}-character long. The database allows \
- maximum {2}-character for a table name.
-long-column-name: Column name "{0}" is {1}-character long. The database allows \
- maximum {2}-character for a column name.
-long-index-name: Index name "{0}" is {1}-character long. The database allows \
- maximum {2}-character for an index name.
-long-constraint-name: Constraint name "{0}" is {1}-character long. The \
- database allows maximum {2}-character for a constraint name.
-long-seq-name: Sequence name "{0}" is {1}-character long. The database allows \
- maximum {2}-character for a sequence name.
-
\ No newline at end of file