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

Method toString

basex-core/src/main/java/org/basex/query/QueryInfo.java:120–168  ·  view source on GitHub ↗

Returns detailed query information. @param qp query processor @param printed printed bytes @param hits number of returned hits @param locks read and write locks @param success success flag @return query string

(final QueryProcessor qp, final long printed, final long hits,
      final Locks locks, final boolean success)

Source from the content-addressed store, hash-verified

118 * @return query string
119 */
120 public String toString(final QueryProcessor qp, final long printed, final long hits,
121 final Locks locks, final boolean success) {
122
123 final TokenBuilder tb = new TokenBuilder();
124 final String total = Performance.formatNano(parsing.get() + compiling.get() + optimizing.get() +
125 evaluating.get() + serializing.get(), runs);
126 if(queryinfo) {
127 tb.add(NL);
128 if(query != null) {
129 tb.add(QUERY).add(COL).add(NL);
130 tb.add(QueryParser.removeComments(query, Integer.MAX_VALUE)).add(NL).add(NL);
131 }
132 if(!compile.isEmpty()) {
133 tb.add(COMPILING).add(COL).add(NL);
134 tb.add(compile).add(NL);
135 }
136 if(!optimize.isEmpty()) {
137 tb.add(OPTIMIZING).add(COL).add(NL);
138 tb.add(optimize).add(NL);
139 }
140 tb.add(OPTIMIZED_QUERY).add(COL).add(NL);
141 tb.add(qp.qc.main == null ? qp.qc.functions : qp.qc.main).add(NL);
142 tb.add(NL);
143 if(!evaluate.isEmpty()) {
144 tb.add(EVALUATING).add(COL).add(NL);
145 tb.add(evaluate).add(NL);
146 }
147 tb.add(PARSING_CC).add(Performance.formatNano(parsing.get(), runs)).add(NL);
148 tb.add(COMPILING_CC).add(Performance.formatNano(compiling.get(), runs)).add(NL);
149 tb.add(OPTIMIZING_CC).add(Performance.formatNano(optimizing.get(), runs)).add(NL);
150 tb.add(EVALUATING_CC).add(Performance.formatNano(evaluating.get(), runs)).add(NL);
151 tb.add(PRINTING_CC).add(Performance.formatNano(serializing.get(), runs)).add(NL);
152 tb.add(TOTAL_TIME_CC).add(total).add(NL).add(NL);
153 tb.add(NUMBER_CC + hits).add(' ').add(hits == 1 ? ITEM : ITEMS).add(NL);
154 final int up = qp.updates();
155 tb.add(UPDATED_CC + up).add(' ').add(up == 1 ? ITEM : ITEMS).add(NL);
156 tb.add(PRINTED_CC).add(Performance.formatHuman(printed)).add(NL);
157 if(locks != null) {
158 tb.add(READ_LOCKING_CC).add(locks.reads).add(NL);
159 tb.add(WRITE_LOCKING_CC).add(locks.writes).add(NL);
160 }
161 }
162 if(success) {
163 final IO baseIO = qp.sc.baseIO();
164 final String name = baseIO == null ? "" : " \"" + baseIO.name() + '"';
165 tb.add(NL).addExt(QUERY_EXECUTED_X_X, name, total);
166 }
167 return tb.toString();
168 }
169}

Callers 1

executeMethod · 0.95

Calls 12

formatNanoMethod · 0.95
addMethod · 0.95
removeCommentsMethod · 0.95
formatHumanMethod · 0.95
nameMethod · 0.95
toStringMethod · 0.95
baseIOMethod · 0.80
addExtMethod · 0.80
getMethod · 0.65
addMethod · 0.65
isEmptyMethod · 0.45
updatesMethod · 0.45

Tested by

no test coverage detected