use of org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition in project teiid by teiid.
the class TeiidPlatform method buildFieldTypes.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected Hashtable buildFieldTypes() {
Hashtable fieldTypeMapping = super.buildFieldTypes();
fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("varbinary", false));
fieldTypeMapping.put(Character.class, new FieldTypeDefinition("char", false));
fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("boolean", false));
fieldTypeMapping.put(Byte.class, new FieldTypeDefinition("tinyint", false));
fieldTypeMapping.put(Short.class, new FieldTypeDefinition("smallint", false));
fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("integer", false));
fieldTypeMapping.put(Long.class, new FieldTypeDefinition("long", false));
fieldTypeMapping.put(BigInteger.class, new FieldTypeDefinition("biginteger", false));
fieldTypeMapping.put(Float.class, new FieldTypeDefinition("float", false));
fieldTypeMapping.put(Double.class, new FieldTypeDefinition("double", false));
fieldTypeMapping.put(BigDecimal.class, new FieldTypeDefinition("bigdecimal", false));
fieldTypeMapping.put(Date.class, new FieldTypeDefinition("date", false));
fieldTypeMapping.put(Time.class, new FieldTypeDefinition("time", false));
fieldTypeMapping.put(Timestamp.class, new FieldTypeDefinition("timestamp", false));
fieldTypeMapping.put(Object.class, new FieldTypeDefinition("object", false));
fieldTypeMapping.put(Blob.class, new FieldTypeDefinition("blob", false));
fieldTypeMapping.put(Clob.class, new FieldTypeDefinition("clob", false));
fieldTypeMapping.put(SQLXML.class, new FieldTypeDefinition("xml", false));
return fieldTypeMapping;
}
use of org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition in project eclipselink by eclipse-ee4j.
the class HSQLPlatform method buildFieldTypes.
@Override
protected Hashtable<Class<?>, FieldTypeDefinition> buildFieldTypes() {
Hashtable<Class<?>, FieldTypeDefinition> fieldTypeMapping = super.buildFieldTypes();
fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("BOOLEAN", false));
fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("INTEGER", false));
fieldTypeMapping.put(Long.class, new FieldTypeDefinition("BIGINT", false));
fieldTypeMapping.put(Float.class, new FieldTypeDefinition("REAL", false));
fieldTypeMapping.put(Double.class, new FieldTypeDefinition("REAL", false));
fieldTypeMapping.put(Short.class, new FieldTypeDefinition("SMALLINT", false));
fieldTypeMapping.put(Byte.class, new FieldTypeDefinition("SMALLINT", false));
fieldTypeMapping.put(java.math.BigInteger.class, new FieldTypeDefinition("BIGINT", false));
fieldTypeMapping.put(java.math.BigDecimal.class, new FieldTypeDefinition("NUMERIC", 38).setLimits(38, -19, 19));
fieldTypeMapping.put(Number.class, new FieldTypeDefinition("NUMERIC", 38).setLimits(38, -19, 19));
fieldTypeMapping.put(Byte[].class, new FieldTypeDefinition("LONGVARBINARY", false));
fieldTypeMapping.put(Character[].class, new FieldTypeDefinition("LONGVARCHAR", false));
fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("LONGVARBINARY", false));
fieldTypeMapping.put(char[].class, new FieldTypeDefinition("LONGVARCHAR", false));
// 319592: HSQL 2.0.0 requires VARCHAR length specified
fieldTypeMapping.put(String.class, new FieldTypeDefinition("VARCHAR", DEFAULT_VARCHAR_SIZE));
fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("LONGVARBINARY", false));
fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("LONGVARCHAR", false));
fieldTypeMapping.put(java.sql.Date.class, new FieldTypeDefinition("DATE", false));
fieldTypeMapping.put(java.sql.Timestamp.class, new FieldTypeDefinition("TIMESTAMP", false));
fieldTypeMapping.put(java.sql.Time.class, new FieldTypeDefinition("TIME", false));
fieldTypeMapping.put(java.util.Calendar.class, new FieldTypeDefinition("TIMESTAMP", false));
fieldTypeMapping.put(java.util.Date.class, new FieldTypeDefinition("TIMESTAMP", false));
return fieldTypeMapping;
}
use of org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition in project eclipselink by eclipse-ee4j.
the class MaxDBPlatform method buildFieldTypes.
@Override
protected Hashtable<Class<?>, FieldTypeDefinition> buildFieldTypes() {
final Hashtable<Class<?>, FieldTypeDefinition> fieldTypeMapping = new Hashtable<>();
// TODO boolean
fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("SMALLINT", false));
fieldTypeMapping.put(Number.class, new FieldTypeDefinition("DOUBLE PRECISION", false));
fieldTypeMapping.put(Short.class, new FieldTypeDefinition("SMALLINT", false));
fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("INTEGER", false));
fieldTypeMapping.put(Long.class, new FieldTypeDefinition("FIXED", 19));
fieldTypeMapping.put(Float.class, new FieldTypeDefinition("FLOAT", false));
fieldTypeMapping.put(Double.class, new FieldTypeDefinition("DOUBLE PRECISION", false));
fieldTypeMapping.put(BigInteger.class, new FieldTypeDefinition("FIXED", 19));
fieldTypeMapping.put(BigDecimal.class, new FieldTypeDefinition("FIXED", 38));
fieldTypeMapping.put(Character.class, new FieldTypeDefinition("CHAR", 1, "UNICODE"));
fieldTypeMapping.put(Character[].class, new FieldTypeDefinition("VARCHAR", 255, "UNICODE"));
fieldTypeMapping.put(char[].class, new FieldTypeDefinition("VARCHAR", 255, "UNICODE"));
fieldTypeMapping.put(String.class, new FieldTypeDefinition("VARCHAR", 255, "UNICODE"));
// can't be mapped to CHAR(1) BYTE as byte in java is signed
fieldTypeMapping.put(Byte.class, new FieldTypeDefinition("SMALLINT", false));
fieldTypeMapping.put(Byte[].class, FIELD_TYPE_DEFINITION_BLOB);
fieldTypeMapping.put(byte[].class, FIELD_TYPE_DEFINITION_BLOB);
fieldTypeMapping.put(Blob.class, FIELD_TYPE_DEFINITION_BLOB);
fieldTypeMapping.put(Clob.class, FIELD_TYPE_DEFINITION_CLOB);
fieldTypeMapping.put(Date.class, new FieldTypeDefinition("DATE", false));
fieldTypeMapping.put(Time.class, new FieldTypeDefinition("TIME", false));
fieldTypeMapping.put(Timestamp.class, new FieldTypeDefinition("TIMESTAMP", false));
return fieldTypeMapping;
}
use of org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition in project eclipselink by eclipse-ee4j.
the class StoredProcedureDefinition method printArgument.
/**
* Print the argument and its type.
* @param argument Stored procedure argument.
* @param writer Target writer where to write argument string.
* @param session Current session context.
* @throws IOException When any IO problem occurs.
*/
protected void printArgument(final FieldDefinition argument, final Writer writer, final AbstractSession session) throws IOException {
final DatabasePlatform platform = session.getPlatform();
final FieldTypeDefinition fieldType = getFieldTypeDefinition(session, argument.type, argument.typeName);
writer.write(platform.getProcedureArgumentString());
if (platform.shouldPrintInputTokenAtStart()) {
writer.write(" ");
writer.write(platform.getInputProcedureToken());
writer.write(" ");
}
writer.write(argument.name);
writer.write(" ");
writer.write(fieldType.getName());
if (fieldType.isSizeAllowed() && platform.allowsSizeInProcedureArguments() && ((argument.size != 0) || (fieldType.isSizeRequired()))) {
writer.write("(");
if (argument.size == 0) {
writer.write(Integer.toString(fieldType.getDefaultSize()));
} else {
writer.write(Integer.toString(argument.size));
}
if (argument.subSize != 0) {
writer.write(",");
writer.write(Integer.toString(argument.subSize));
} else if (fieldType.getDefaultSubSize() != 0) {
writer.write(",");
writer.write(Integer.toString(fieldType.getDefaultSubSize()));
}
writer.write(")");
}
}
use of org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition in project eclipselink by eclipse-ee4j.
the class StoredProcedureDefinition method printInOutputArgument.
/**
* Print the argument and its type.
* @param argument Stored procedure argument.
* @param writer Target writer where to write argument string.
* @param session Current session context.
* @throws ValidationException When invalid or inconsistent data were found.
*/
protected void printInOutputArgument(final FieldDefinition argument, final Writer writer, final AbstractSession session) throws ValidationException {
try {
final DatabasePlatform platform = session.getPlatform();
final FieldTypeDefinition fieldType = getFieldTypeDefinition(session, argument.type, argument.typeName);
writer.write(platform.getProcedureArgumentString());
if (platform.shouldPrintOutputTokenAtStart()) {
writer.write(" ");
writer.write(platform.getCreationInOutputProcedureToken());
writer.write(" ");
}
writer.write(argument.name);
if ((!platform.shouldPrintOutputTokenAtStart()) && platform.shouldPrintOutputTokenBeforeType()) {
writer.write(" ");
writer.write(platform.getCreationInOutputProcedureToken());
}
writer.write(" ");
writer.write(fieldType.getName());
if (fieldType.isSizeAllowed() && platform.allowsSizeInProcedureArguments() && ((argument.size != 0) || (fieldType.isSizeRequired()))) {
writer.write("(");
if (argument.size == 0) {
writer.write(Integer.toString(fieldType.getDefaultSize()));
} else {
writer.write(Integer.toString(argument.size));
}
if (argument.subSize != 0) {
writer.write(",");
writer.write(Integer.toString(argument.subSize));
} else if (fieldType.getDefaultSubSize() != 0) {
writer.write(",");
writer.write(Integer.toString(fieldType.getDefaultSubSize()));
}
writer.write(")");
}
if ((!platform.shouldPrintOutputTokenAtStart()) && (!platform.shouldPrintOutputTokenBeforeType())) {
writer.write(" ");
writer.write(platform.getCreationInOutputProcedureToken());
}
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
}
Aggregations