Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2012-05-04 02:40:59 -0400
committerStefan Winkler2012-05-04 02:40:59 -0400
commita09f9d10aeeab79ed9c8cb9c49dc926457f69d17 (patch)
tree170900a9975cdb18b9b386e9754b50ab6c2bf93a
parent442b3dee3931d65fba39842912584ef8cb0215f9 (diff)
downloadcdo-bugs/352062.tar.gz
cdo-bugs/352062.tar.xz
cdo-bugs/352062.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
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/CoreTypeMappings.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/TypeMappingRegistry.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java6
-rw-r--r--plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/PostgreSQLAdapter.java1
4 files changed, 40 insertions, 6 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);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java
index 7d57cba6ab..802dfc7c7f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java
@@ -100,7 +100,7 @@ public class AttributeTest extends AbstractCDOTest
}
// XXX disabled because of Bug 289445
- @Skips("Postgresql")
+ // @Skips("Postgresql")
@CleanRepositoriesBefore
public void testByteArray() throws Exception
{
@@ -144,7 +144,7 @@ public class AttributeTest extends AbstractCDOTest
}
// XXX disabled because of Bug 289445
- @Skips("Postgresql")
+ // @Skips("Postgresql")
@CleanRepositoriesBefore
public void testByteArrayEmpty() throws Exception
{
@@ -182,7 +182,7 @@ public class AttributeTest extends AbstractCDOTest
}
// XXX disabled because of Bug 289445
- @Skips("Postgresql")
+ // @Skips("Postgresql")
@CleanRepositoriesBefore
public void testByteArrayNull() throws Exception
{
diff --git a/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/PostgreSQLAdapter.java b/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/PostgreSQLAdapter.java
index 8f70a4eb5d..524698581a 100644
--- a/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/PostgreSQLAdapter.java
+++ b/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/PostgreSQLAdapter.java
@@ -99,6 +99,7 @@ public class PostgreSQLAdapter extends DBAdapter
case VARCHAR:
case CLOB:
return "text"; //$NON-NLS-1$
+ case VARBINARY:
case BLOB:
return "bytea"; //$NON-NLS-1$
case DOUBLE:

Back to the top