use of org.teiid.metadata.FunctionParameter in project teiid by teiid.
the class SystemSource method addLocateFunction.
private void addLocateFunction() {
FunctionMethod func = new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.LOCATE, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.Locate_desc"), // $NON-NLS-1$ //$NON-NLS-2$
STRING, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"locate", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("substring", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate_arg2")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("index", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Locate_arg3")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Locate_result")));
func.setNullOnNull(false);
functions.add(func);
functions.add(new // $NON-NLS-1$ //$NON-NLS-2$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$
SourceSystemFunctions.LOCATE, // $NON-NLS-1$ //$NON-NLS-2$
QueryPlugin.Util.getString("SystemSource.Locate2_desc"), // $NON-NLS-1$ //$NON-NLS-2$
STRING, // $NON-NLS-1$ //$NON-NLS-2$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$
"locate", new FunctionParameter[] { // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("substring", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate2_arg1")), // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Locate2_arg2")) }, // $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Locate2_result"))));
}
use of org.teiid.metadata.FunctionParameter 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.FunctionParameter in project teiid by teiid.
the class SystemSource method addUserFunction.
private void addUserFunction() {
functions.add(new // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"user", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
QueryPlugin.Util.getString("SystemSource.User_desc"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MISCELLANEOUS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PushDown.CANNOT_PUSHDOWN, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"user", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
null, new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.User_result")), true, // $NON-NLS-1$ //$NON-NLS-2$
Determinism.USER_DETERMINISTIC));
functions.add(new // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FunctionMethod(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"user", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
QueryPlugin.Util.getString("SystemSource.User_desc"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MISCELLANEOUS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PushDown.CANNOT_PUSHDOWN, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
FUNCTION_CLASS, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"user", Arrays.asList(// $NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("includeSecurityDomain", DataTypeManager.DefaultDataTypes.BOOLEAN, QueryPlugin.Util.getString("SystemSource.User_param1"))), new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.User_result")), true, // $NON-NLS-1$ //$NON-NLS-2$
Determinism.USER_DETERMINISTIC));
}
use of org.teiid.metadata.FunctionParameter 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.FunctionParameter 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);
}
Aggregations