01: package net.sourceforge.squirrel_sql.plugins.hibernate.completion;
02:
03: import java.util.ArrayList;
04:
05: public class HQLFunctionInfo extends SimpleHQLCompletionInfo {
06: private static final String[] _builtInFunctions = {
07: // standard sql92 functions
08: "substring", "locate", "trim", "length", "bit_length",
09: "coalesce", "nullif", "abs", "mod", "sqrt",
10: "upper",
11: "lower",
12: "cast",
13: "extract",
14:
15: // time functions mapped to ansi extract
16: "second", "minute", "hour", "day",
17: "month",
18: "year",
19:
20: "str",
21:
22: // misc functions - based on oracle dialect
23: "sign", "acos", "asin", "atan", "cos", "cosh", "exp", "ln",
24: "sin", "sinh", "stddev", "sqrt", "tan", "tanh", "variance",
25:
26: "round", "trunc", "ceil", "floor",
27:
28: "chr", "initcap", "lower", "ltrim", "rtrim", "soundex",
29: "upper", "ascii", "length", "to_char", "to_date",
30:
31: "current_date", "current_time", "current_timestamp",
32: "lastday", "sysday", "systimestamp", "uid", "user",
33:
34: "rowid", "rownum",
35:
36: "concat", "instr", "instrb", "lpad", "replace", "rpad",
37: "substr", "substrb", "translate",
38:
39: "substring", "locate", "bit_length", "coalesce",
40:
41: "atan2", "log", "mod", "nvl", "nvl2", "power",
42:
43: "add_months", "months_between", "next_day",
44:
45: "max", "min", };
46:
47: private String _toString;
48:
49: public static ArrayList<HQLFunctionInfo> createInfos() {
50: ArrayList<HQLFunctionInfo> ret = new ArrayList<HQLFunctionInfo>(
51: _builtInFunctions.length);
52:
53: for (String builtInFunction : _builtInFunctions) {
54: ret.add(new HQLFunctionInfo(builtInFunction));
55: }
56:
57: return ret;
58: }
59:
60: public HQLFunctionInfo(String infoString) {
61: super (infoString);
62: _toString = super .toString() + " (function)";
63: }
64:
65: public String toString() {
66: return _toString;
67: }
68: }
|