use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class IngresExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// $NON-NLS-1$
convert.addTypeMapping("tinyint", FunctionModifier.BOOLEAN, FunctionModifier.BYTE);
// $NON-NLS-1$
convert.addTypeMapping("smallint", FunctionModifier.SHORT);
// $NON-NLS-1$
convert.addTypeMapping("integer", FunctionModifier.INTEGER);
// $NON-NLS-1$
convert.addTypeMapping("bigint", FunctionModifier.LONG);
// $NON-NLS-1$
convert.addTypeMapping("real", FunctionModifier.FLOAT);
// $NON-NLS-1$
convert.addTypeMapping("float", FunctionModifier.DOUBLE);
// $NON-NLS-1$
convert.addTypeMapping("decimal(38,19)", FunctionModifier.BIGDECIMAL);
// $NON-NLS-1$
convert.addTypeMapping("decimal(15,0)", FunctionModifier.BIGINTEGER);
// $NON-NLS-1$
convert.addTypeMapping("date", FunctionModifier.DATE);
// $NON-NLS-1$
convert.addTypeMapping("time", FunctionModifier.TIME);
// $NON-NLS-1$
convert.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP);
// $NON-NLS-1$
convert.addTypeMapping("char(1)", FunctionModifier.CHAR);
// $NON-NLS-1$
convert.addTypeMapping("varchar(4000)", FunctionModifier.STRING);
// $NON-NLS-1$
convert.addTypeMapping("blob", FunctionModifier.BLOB);
// $NON-NLS-1$
convert.addTypeMapping("clob", FunctionModifier.CLOB);
convert.addNumericBooleanConversions();
convert.setWideningNumericImplicit(true);
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITAND, new AliasModifier("bit_and"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITNOT, new AliasModifier("bit_not"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITOR, new AliasModifier("bit_or"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITXOR, new AliasModifier("bit_xor"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("current_time"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("current_date"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lowercase"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("uppercase"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day"));
// $NON-NLS-1$
addPushDownFunction(INGRES, "bit_add", INTEGER, INTEGER, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INGRES, "bit_length", INTEGER, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INGRES, "character_length", STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INGRES, "charextract", CHAR, STRING, INTEGER);
// uses ingres date??
// supportedFunctions.add("date_trunc");
// supportedFunctions.add("dow");
// supportedFunctions.add("extract");
// $NON-NLS-1$
addPushDownFunction(INGRES, "gmt_timestamp", STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INGRES, "hash", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "hex", STRING, STRING);
// do not have byte[] type
// supportedFunctions.add("intextract");
// $NON-NLS-1$
addPushDownFunction(INGRES, "ln", DOUBLE, DOUBLE);
// see lowercase
// supportedFunctions.add("lower");
// supportedFunctions.add("upper");
// $NON-NLS-1$
addPushDownFunction(INGRES, "octet_length", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "randomf", FLOAT);
// $NON-NLS-1$
addPushDownFunction(INGRES, "session_user", STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "size", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "squeeze", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "soundex", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "unhex", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "usercode", STRING);
// $NON-NLS-1$
addPushDownFunction(INGRES, "username", STRING);
// ignore
// supportedFunctions.add("uuid_create");
// supportedFunctions.add("uuid_compare");
// supportedFunctions.add("uuid_from_char");
// supportedFunctions.add("uuid_to_char");
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class InterSystemsCacheExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// $NON-NLS-1$
convert.addTypeMapping("tinyint", FunctionModifier.BYTE);
// $NON-NLS-1$
convert.addTypeMapping("smallint", FunctionModifier.SHORT);
// $NON-NLS-1$
convert.addTypeMapping("integer", FunctionModifier.INTEGER);
// $NON-NLS-1$
convert.addTypeMapping("bigint", FunctionModifier.LONG);
// $NON-NLS-1$
convert.addTypeMapping("decimal(38,19)", FunctionModifier.BIGDECIMAL);
// $NON-NLS-1$
convert.addTypeMapping("decimal(19,0)", FunctionModifier.BIGINTEGER);
// $NON-NLS-1$
convert.addTypeMapping("character", FunctionModifier.CHAR);
// $NON-NLS-1$
convert.addTypeMapping("varchar(4000)", FunctionModifier.STRING);
// $NON-NLS-1$
convert.addTypeMapping("date", FunctionModifier.DATE);
// $NON-NLS-1$
convert.addTypeMapping("time", FunctionModifier.TIME);
// $NON-NLS-1$
convert.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP);
convert.addNumericBooleanConversions();
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("nvl"));
registerFunctionModifier(SourceSystemFunctions.CONCAT, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.ACOS, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.ASIN, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.ATAN, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.COS, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.COT, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.CURDATE, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.CURTIME, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.DAYNAME, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.EXP, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.HOUR, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.LOG, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.LOG10, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.LEFT, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.MINUTE, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.MONTH, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.MOD, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.NOW, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.PI, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.QUARTER, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.RIGHT, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.SIN, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.SECOND, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.SQRT, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TAN, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TRUNCATE, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.WEEK, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.DIVIDE_OP, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
if (function.getType() == TypeFacility.RUNTIME_TYPES.INTEGER || function.getType() == TypeFacility.RUNTIME_TYPES.LONG) {
Function result = ConvertModifier.createConvertFunction(getLanguageFactory(), function, TypeFacility.getDataTypeName(function.getType()));
function.setType(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
return Arrays.asList(result);
}
return null;
}
});
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "CHARACTER_LENGTH", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "CHAR_LENGTH", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "CHARINDEX", INTEGER, STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "CHARINDEX", INTEGER, STRING, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "INSTR", INTEGER, STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "INSTR", INTEGER, STRING, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "IS_NUMERIC", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "REPLICATE", STRING, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "REVERSE", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "STUFF", STRING, STRING, STRING, INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(INTER_CACHE, "TRIM", STRING, STRING);
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class ModeShapeExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("UPPER"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("LOWER"));
registerFunctionModifier(JCR_ISCHILDNODE, new IdentifierFunctionModifier());
registerFunctionModifier(JCR_ISDESCENDANTNODE, new IdentifierFunctionModifier());
registerFunctionModifier(JCR_ISSAMENODE, new IdentifierFunctionModifier());
registerFunctionModifier(JCR_REFERENCE, new IdentifierFunctionModifier());
registerFunctionModifier(JCR_CONTAINS, new IdentifierFunctionModifier());
addPushDownFunction(JCR, JCR_ISCHILDNODE, BOOLEAN, STRING, STRING);
addPushDownFunction(JCR, JCR_ISDESCENDANTNODE, BOOLEAN, STRING, STRING);
addPushDownFunction(JCR, JCR_ISSAMENODE, BOOLEAN, STRING, STRING);
addPushDownFunction(JCR, JCR_CONTAINS, BOOLEAN, STRING, STRING);
addPushDownFunction(JCR, JCR_REFERENCE, BOOLEAN, STRING);
// $NON-NLS-1$
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "ModeShape Translator Started");
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class MySQL5ExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
registerFunctionModifier(SourceSystemFunctions.CHAR, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$ //$NON-NLS-2$
return Arrays.asList("char(", function.getParameters().get(0), " USING ASCII)");
}
});
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
Literal intervalType = (Literal) function.getParameters().get(0);
String interval = ((String) intervalType.getValue()).toUpperCase();
if (interval.equals(NonReserved.SQL_TSI_FRAC_SECOND)) {
// $NON-NLS-1$
intervalType.setValue("MICROSECOND");
Expression[] args = new Expression[] { function.getParameters().get(1), getLanguageFactory().createLiteral(1000, TypeFacility.RUNTIME_TYPES.INTEGER) };
// $NON-NLS-1$
function.getParameters().set(1, getLanguageFactory().createFunction("/", args, TypeFacility.RUNTIME_TYPES.INTEGER));
}
return null;
}
});
// $NON-NLS-1$ //$NON-NLS-2$
addPushDownFunction("mysql", "timestampdiff", TypeFacility.RUNTIME_NAMES.INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.TIMESTAMP, TypeFacility.RUNTIME_NAMES.TIMESTAMP);
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
Literal intervalType = (Literal) function.getParameters().get(0);
String interval = ((String) intervalType.getValue()).toUpperCase();
if (interval.equals(NonReserved.SQL_TSI_FRAC_SECOND)) {
// $NON-NLS-1$
intervalType.setValue("MICROSECOND");
// $NON-NLS-1$
return Arrays.asList(function, " * 1000");
}
return null;
}
});
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.ST_SRID, new AliasModifier("SRID"));
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class JPA2ExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
setSupportsInnerJoins(true);
setSupportsOrderBy(true);
setSupportsSelectDistinct(true);
setSupportedJoinCriteria(SupportedJoinCriteria.KEY);
setSupportsOuterJoins(true);
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("current_date"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("current_time"));
}
Aggregations