diff options
author | Stefan Winkler | 2012-05-04 06:40:59 +0000 |
---|---|---|
committer | Stefan Winkler | 2012-05-04 06:40:59 +0000 |
commit | a09f9d10aeeab79ed9c8cb9c49dc926457f69d17 (patch) | |
tree | 170900a9975cdb18b9b386e9754b50ab6c2bf93a /plugins/org.eclipse.emf.cdo.server.db | |
parent | 442b3dee3931d65fba39842912584ef8cb0215f9 (diff) | |
download | cdo-a09f9d10aeeab79ed9c8cb9c49dc926457f69d17.tar.gz cdo-a09f9d10aeeab79ed9c8cb9c49dc926457f69d17.tar.xz cdo-a09f9d10aeeab79ed9c8cb9c49dc926457f69d17.zip |
[352062] [DB] Dawn PostgreSQL Issue: IllegalStateException: No typebugs/352062
mapping factory found EByteArray --> VARBINARY
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352062
- added the missing type mapping
- adjusted the db adapter
- removed the skipConfig for BLOB-attribute-tests
the basic testcases seem to run
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.db')
2 files changed, 36 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/CoreTypeMappings.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/CoreTypeMappings.java index c0551e63a6..e2ebb06e9d 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/CoreTypeMappings.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/CoreTypeMappings.java @@ -173,7 +173,7 @@ public class CoreTypeMappings {
return null;
}
-
+
int pos = str.indexOf('-');
byte[] id = HexUtil.hexToBytes(str.substring(0, pos));
@@ -225,7 +225,7 @@ public class CoreTypeMappings {
return null;
}
-
+
int pos = str.indexOf('-');
byte[] id = HexUtil.hexToBytes(str.substring(0, pos));
@@ -689,6 +689,38 @@ public class CoreTypeMappings /**
* @author Eike Stepper
*/
+ public static class TMBytesVarbinary extends AbstractTypeMapping
+ {
+ public static final Factory FACTORY = new Factory(TypeMappingUtil.createDescriptor(ID_PREFIX
+ + ".ByteArrayVarbinary", EcorePackage.eINSTANCE.getEByteArray(), DBType.VARBINARY));
+
+ @Override
+ public Object getResultSetValue(ResultSet resultSet) throws SQLException
+ {
+ return resultSet.getBytes(getField().getName());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Factory extends AbstractTypeMappingFactory
+ {
+ public Factory(Descriptor descriptor)
+ {
+ super(descriptor);
+ }
+
+ @Override
+ public ITypeMapping create(String description) throws ProductCreationException
+ {
+ return new TMBytesVarbinary();
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
public static class TMBoolean extends AbstractTypeMapping
{
public static final Factory FACTORY = new Factory(TypeMappingUtil.createDescriptor(ID_PREFIX + ".Boolean",
@@ -857,7 +889,7 @@ public class CoreTypeMappings {
return null;
}
-
+
EFactory factory = getFeature().getEType().getEPackage().getEFactoryInstance();
return factory.convertToString((EDataType)getFeature().getEType(), defaultValue);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java index ccf5f6dbe5..5a3f859440 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java @@ -127,6 +127,7 @@ public class TypeMappingRegistry implements ITypeMapping.Registry, ITypeMapping. container.registerFactory(CoreTypeMappings.TMByte.FACTORY);
container.registerFactory(CoreTypeMappings.TMByte.FACTORY_OBJECT);
container.registerFactory(CoreTypeMappings.TMBytes.FACTORY);
+ container.registerFactory(CoreTypeMappings.TMBytesVarbinary.FACTORY);
container.registerFactory(CoreTypeMappings.TMCharacter.FACTORY);
container.registerFactory(CoreTypeMappings.TMCharacter.FACTORY_OBJECT);
container.registerFactory(CoreTypeMappings.TMCustom.FACTORY_VARCHAR);
|