summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-13 08:28:59 (EDT)
committerEike Stepper2007-09-13 08:28:59 (EDT)
commit559bf5a3b70d01e97aecff250507684e6011c40c (patch)
tree4a96f12b5a59ee4135ec191e0f920c7e0602ced2
parentdd653833294379580e896a8da93926f2d342bc83 (diff)
downloadcdo-559bf5a3b70d01e97aecff250507684e6011c40c.zip
cdo-559bf5a3b70d01e97aecff250507684e6011c40c.tar.gz
cdo-559bf5a3b70d01e97aecff250507684e6011c40c.tar.bz2
[202833] Horizontal Mapping Strategy
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202833
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java2
2 files changed, 12 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
index 399870b..c8fdd8f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
@@ -189,14 +189,15 @@ public abstract class ClassMapping implements IClassMapping
protected IDBField addField(CDOFeature cdoFeature, IDBTable table) throws DBException
{
- DBType fieldType = getDBType(cdoFeature.getType());
+ DBType fieldType = getDBType(cdoFeature);
+ int fieldLength = getDBLength(cdoFeature);
for (int attempt = 0;; ++attempt)
{
String fieldName = mangleFieldName(cdoFeature.getName(), attempt);
try
{
- IDBField field = table.addField(fieldName, fieldType);
+ IDBField field = table.addField(fieldName, fieldType, fieldLength);
affectedTables.add(table);
return field;
}
@@ -210,9 +211,15 @@ public abstract class ClassMapping implements IClassMapping
}
}
- protected DBType getDBType(CDOType type)
+ protected DBType getDBType(CDOFeature cdoFeature)
{
- return DBStore.getDBType(type);
+ return DBStore.getDBType(cdoFeature.getType());
+ }
+
+ protected int getDBLength(CDOFeature cdoFeature)
+ {
+ // Derby: The maximum length for a VARCHAR string is 32,672 characters.
+ return cdoFeature.getType() == CDOType.STRING ? 32672 : IDBField.DEFAULT;
}
protected IDBAdapter getDBAdapter()
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index 08e522d..8816a3f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -204,7 +204,7 @@ public class DBStore extends Store implements IDBStore
}
else if (type == CDOType.STRING)
{
- return DBType.LONGVARCHAR;
+ return DBType.VARCHAR;
}
throw new ImplementationError("Unrecognized CDOType: " + type);