MCPcopy Create free account
hub / github.com/BaseXdb/basex / tableQuery

Method tableQuery

basex-core/src/main/java/org/basex/core/cmd/Find.java:73–95  ·  view source on GitHub ↗

Creates a query for the specified table search. @param filter filter terms @param cols filter columns @param elem element flag @param name name of root element @param root root flag @return query

(final StringList filter, final TokenList cols,
      final BoolList elem, final String name, final boolean root)

Source from the content-addressed store, hash-verified

71 * @return query
72 */
73 public static String tableQuery(final StringList filter, final TokenList cols,
74 final BoolList elem, final String name, final boolean root) {
75
76 final TokenBuilder tb = new TokenBuilder();
77 final int is = filter.size();
78 for(int i = 0; i < is; ++i) {
79 final String[] spl = split(filter.get(i));
80 for(final String s : spl) {
81 final byte[] term = trim(replace(token(s), '"', ' '));
82 if(term.length == 0) continue;
83 final boolean elm = elem.get(i);
84 tb.add('[').add(elm ? ".//" : "@").add("*:").add(cols.get(i));
85
86 if(term[0] == '<' || term[0] == '>') {
87 tb.add(term[0]).addLong(sizeToLong(substring(term, 1)));
88 } else {
89 tb.add(" contains text \"").add(term).add('"');
90 }
91 tb.add(']');
92 }
93 }
94 return tb.isEmpty() ? "/" : (root ? "/" : "") + Axis.DESCENDANT_OR_SELF + "::*:" + name + tb;
95 }
96
97 /**
98 * Converts the token with a size unit suffix to a numeric value.

Callers 1

findMethod · 0.95

Calls 12

splitMethod · 0.95
addMethod · 0.95
sizeToLongMethod · 0.95
isEmptyMethod · 0.95
addLongMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
tokenMethod · 0.65
addMethod · 0.65
trimMethod · 0.45
replaceMethod · 0.45
substringMethod · 0.45

Tested by

no test coverage detected