Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-27 09:41:32 +0000
committerEike Stepper2008-10-27 09:41:32 +0000
commitc8f8ab691c0f8e04163cef9d79227318f0aa2faa (patch)
treedf7532b2d9457d16ac2cbd3a7c7f48ec259d0dde /plugins/org.eclipse.net4j.db
parentc5f2c8a83a218a63c2125f49fb10b3d10e73c76b (diff)
downloadcdo-c8f8ab691c0f8e04163cef9d79227318f0aa2faa.tar.gz
cdo-c8f8ab691c0f8e04163cef9d79227318f0aa2faa.tar.xz
cdo-c8f8ab691c0f8e04163cef9d79227318f0aa2faa.zip
[251530] Use of qualified names property makes it more likely to hit db table name limits
https://bugs.eclipse.org/bugs/show_bug.cgi?id=251530
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java12
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java48
2 files changed, 21 insertions, 39 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java
index 66466f16c0..753cdbd21d 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java
@@ -50,9 +50,15 @@ public interface IDBAdapter
public boolean isReservedWord(String word);
- public String mangleTableName(String name, int attempt);
-
- public String mangleFieldName(String name, int attempt);
+ /**
+ * @since 2.0
+ */
+ public int getMaxTableNameLength();
+
+ /**
+ * @since 2.0
+ */
+ public int getMaxFieldNameLength();
public void appendValue(StringBuilder builder, IDBField field, Object value);
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
index 56812fd9a0..40e6d2ab15 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
@@ -202,14 +202,22 @@ public abstract class DBAdapter implements IDBAdapter
return "DROP TABLE " + table;
}
- public String mangleTableName(String name, int attempt)
+ /**
+ * @since 2.0
+ */
+ public int getMaxTableNameLength()
{
- return mangleName(name, getMaximumTableNameLength(), attempt);
+ // Ansi SQL 92 default value
+ return 128;
}
- public String mangleFieldName(String name, int attempt)
+ /**
+ * @since 2.0
+ */
+ public int getMaxFieldNameLength()
{
- return mangleName(name, getMaximumFieldNameLength(), attempt);
+ // Ansi SQL 92 default value
+ return 128;
}
public void appendValue(StringBuilder builder, IDBField field, Object value)
@@ -371,38 +379,6 @@ public abstract class DBAdapter implements IDBAdapter
throw new IllegalArgumentException("Unknown type: " + type);
}
- protected int getMaximumTableNameLength()
- {
- return 128;
- }
-
- protected int getMaximumFieldNameLength()
- {
- return 128;
- }
-
- protected String mangleName(String name, int max, int attempt)
- {
- if (isReservedWord(name))
- {
- String suffix = "_" + String.valueOf(attempt);
- if (name.length() + suffix.length() > max)
- {
- name = name.substring(0, max - suffix.length()) + suffix;
- }
- else
- {
- name += suffix;
- }
- }
- else if (name.length() > max)
- {
- name = name.substring(0, max);
- }
-
- return name;
- }
-
public String[] getSQL92ReservedWords()
{
return SQL92_RESERVED_WORDS;

Back to the top