use of org.teiid.metadata.FunctionMethod in project teiid by teiid.
the class SystemSource method addConcatFunction.
private void addConcatFunction(String type) {
functions.add(new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.CONCAT, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.Concat_desc"), // $NON-NLS-1$ //$NON-NLS-2$
STRING, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"concat", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string1", type, QueryPlugin.Util.getString("SystemSource.Concat_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string2", type, QueryPlugin.Util.getString("SystemSource.Concat_arg2")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", type, QueryPlugin.Util.getString("SystemSource.Concat_result_desc"))));
functions.add(new // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"||", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
QueryPlugin.Util.getString("SystemSource.Concatop_desc"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
STRING, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"concat", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string1", type, QueryPlugin.Util.getString("SystemSource.Concatop_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string2", type, QueryPlugin.Util.getString("SystemSource.Concatop_arg2")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", type, QueryPlugin.Util.getString("SystemSource.Concatop_result_desc"))));
FunctionMethod concat2 = new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.CONCAT2, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.Concat_desc"), // $NON-NLS-1$ //$NON-NLS-2$
STRING, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"concat2", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string1", type, QueryPlugin.Util.getString("SystemSource.Concat_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string2", type, QueryPlugin.Util.getString("SystemSource.Concat_arg2")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", type, QueryPlugin.Util.getString("SystemSource.Concat_result_desc")));
concat2.setNullOnNull(false);
functions.add(concat2);
}
use of org.teiid.metadata.FunctionMethod in project teiid by teiid.
the class SystemSource method addDoubleFunction.
private void addDoubleFunction(String name, String description) {
functions.add(new FunctionMethod(name, description, NUMERIC, FUNCTION_CLASS, name, new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("number", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Double_arg2")) }, // $NON-NLS-1$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description)));
functions.add(new FunctionMethod(name, description, NUMERIC, FUNCTION_CLASS, name, new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("number", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Double_arg2")) }, // $NON-NLS-1$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description)));
}
use of org.teiid.metadata.FunctionMethod in project teiid by teiid.
the class SystemSource method addRandFunction.
private void addRandFunction() {
// With Seed
FunctionMethod rand = new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.RAND, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.Rand_desc"), // $NON-NLS-1$ //$NON-NLS-2$
NUMERIC, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"rand", // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] { new FunctionParameter("seed", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Rand_arg")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Rand_result_desc")));
rand.setNullOnNull(false);
rand.setDeterminism(Determinism.NONDETERMINISTIC);
// seed handling varies greatly by source
rand.setPushdown(PushDown.CANNOT_PUSHDOWN);
functions.add(rand);
// Without Seed
rand = new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.RAND, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.Rand_desc"), // $NON-NLS-1$ //$NON-NLS-2$
NUMERIC, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"rand", new FunctionParameter[] {}, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Rand_result_desc")));
rand.setDeterminism(Determinism.NONDETERMINISTIC);
functions.add(rand);
}
use of org.teiid.metadata.FunctionMethod in project teiid by teiid.
the class SystemSource method addNvlFunction.
private void addNvlFunction(String valueType) {
FunctionMethod nvl = new // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"nvl", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
QueryPlugin.Util.getString("SystemSource.Nvl_desc"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MISCELLANEOUS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"ifnull", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("value", valueType, QueryPlugin.Util.getString("SystemSource.Nvl_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("valueIfNull", valueType, QueryPlugin.Util.getString("SystemSource.Nvl_arg2")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", valueType, QueryPlugin.Util.getString("SystemSource.Nvl_result")));
nvl.setNullOnNull(false);
functions.add(nvl);
}
use of org.teiid.metadata.FunctionMethod in project teiid by teiid.
the class SystemSource method addEndsWithFunction.
private void addEndsWithFunction() {
FunctionMethod f = new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.ENDSWITH, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.endswith_desc"), // $NON-NLS-1$ //$NON-NLS-2$
STRING, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"endsWith", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("substring", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.endswith_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.endswith_arg2")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, QueryPlugin.Util.getString("SystemSource.endswith_result")));
functions.add(f);
}
Aggregations