summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-15 01:45:18 (EDT)
committerEike Stepper2007-09-15 01:45:18 (EDT)
commit3263095d236b8c3f4d3a59ca0d5d26289671845c (patch)
tree11f528d10c21ce3b14f8a29802e492af7a0d3100
parent0d0bf1ca6ee5d354f97cb0c79b177be5897caa42 (diff)
downloadcdo-3263095d236b8c3f4d3a59ca0d5d26289671845c.zip
cdo-3263095d236b8c3f4d3a59ca0d5d26289671845c.tar.gz
cdo-3263095d236b8c3f4d3a59ca0d5d26289671845c.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.java29
1 files changed, 27 insertions, 2 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 91138d6..a052d62 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
@@ -270,7 +270,7 @@ public abstract class ClassMapping implements IClassMapping
}
builder.append(" FROM ");
- builder.append(getTable());
+ builder.append(table);
builder.append(" WHERE ");
builder.append(CDODBSchema.ATTRIBUTES_ID);
builder.append("=");
@@ -415,6 +415,11 @@ public abstract class ClassMapping implements IClassMapping
public void writeRevision(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
{
+ if (revision.getVersion() >= 2 && hasFullRevisionInfo())
+ {
+ writeRevisedRow(storeAccessor, revision);
+ }
+
if (attributeMappings != null)
{
writeAttributes(storeAccessor, revision);
@@ -426,11 +431,31 @@ public abstract class ClassMapping implements IClassMapping
}
}
+ protected void writeRevisedRow(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("UPDATE ");
+ builder.append(table);
+ builder.append(" SET ");
+ builder.append(CDODBSchema.ATTRIBUTES_REVISED);
+ builder.append("=");
+ builder.append(revision.getCreated() - 1);
+ builder.append(" WHERE ");
+ builder.append(CDODBSchema.ATTRIBUTES_ID);
+ builder.append("=");
+ builder.append(revision.getID().getValue());
+ builder.append(" AND ");
+ builder.append(CDODBSchema.ATTRIBUTES_VERSION);
+ builder.append("=");
+ builder.append(revision.getVersion() - 1);
+ sqlUpdate(storeAccessor, builder.toString());
+ }
+
protected void writeAttributes(IDBStoreAccessor storeAccessor, CDORevisionImpl revision)
{
StringBuilder builder = new StringBuilder();
builder.append("INSERT INTO ");
- builder.append(getTable());
+ builder.append(table);
builder.append(" VALUES (");
appendRevisionInfos(builder, revision, hasFullRevisionInfo());