diff options
author | Eike Stepper | 2012-10-30 07:19:55 +0000 |
---|---|---|
committer | Eike Stepper | 2012-10-30 07:19:55 +0000 |
commit | 2f8c489d32d48e9fb686a1e2ed2f092c8cebb823 (patch) | |
tree | 38e1bd612952e3052f498c131077b6f467cb6fcf /plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo | |
parent | 67f5f89c73bc0061a373bc92cc05d8a6ebc777ae (diff) | |
download | cdo-2f8c489d32d48e9fb686a1e2ed2f092c8cebb823.tar.gz cdo-2f8c489d32d48e9fb686a1e2ed2f092c8cebb823.tar.xz cdo-2f8c489d32d48e9fb686a1e2ed2f092c8cebb823.zip |
[344233] [DB] Get Max VARCHAR size from DBAdapter
https://bugs.eclipse.org/bugs/show_bug.cgi?id=344233
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java index 08e3f68fe2..9cbac4031a 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java @@ -24,6 +24,7 @@ import org.eclipse.emf.cdo.server.internal.db.mapping.TypeMappingRegistry; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.net4j.db.DBType; +import org.eclipse.net4j.db.IDBAdapter; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBTable; import org.eclipse.net4j.util.container.IManagedContainer; @@ -43,7 +44,7 @@ import java.sql.SQLException; * suitable factory for the {@link TypeMappingRegistry} and register it either manually using * {@link IManagedContainer#registerFactory(org.eclipse.net4j.util.factory.IFactory)} or using the Net4j Extension Point * <code>factories</code>. - * + * * @author Eike Stepper * @author Stefan Winkler * @since 4.0 @@ -219,7 +220,7 @@ public abstract class AbstractTypeMapping implements ITypeMapping /** * Implementors could override this method to convert a given value to the database representation and set it to the * prepared statement. - * + * * @param stmt * the {@link PreparedStatement} which is used for DB access * @param index @@ -235,7 +236,7 @@ public abstract class AbstractTypeMapping implements ITypeMapping /** * Returns the SQL type of this TypeMapping. The default implementation considers the type map held by the * {@link MetaDataManager meta-data manager}. Subclasses may override. - * + * * @return The sql type of this TypeMapping. */ protected int getSqlType() @@ -268,16 +269,14 @@ public abstract class AbstractTypeMapping implements ITypeMapping } } - // TODO: implement DBAdapter.getDBLength - // mappingStrategy.getStore().getDBAdapter().getDBLength(type); - // which should then return the correct default field length for the db type - return type == DBType.VARCHAR ? 32672 : IDBField.DEFAULT; + IDBAdapter adapter = mappingStrategy.getStore().getDBAdapter(); + return adapter.getFieldLength(type); } /** * Subclasses should implement this method to read the value from the result set. Typical implementations should look * similar to this one: <code>resultSet.getString(getField().getName())</code> - * + * * @param resultSet * the result set to read from * @return the result value read (this has to be compatible with the {@link #feature}. |