Source:
<code>public ResultInterface query(int maxrows) { Column column = new Column("PLAN", Value.STRING); Database db = session.getDatabase(); ExpressionColumn expr = new ExpressionColumn(db, column); Expression[] expressions = { expr }; <START> result = session.getDatabase().getResultFactory().create(session, expressions, 1); <END> if (maxrows >= 0) { String plan; if (executeCommand) { PageStore store = null; Store mvStore = null; if (db.isPersistent()) { store = db.getPageStore(); if (store != null) { store.statisticsStart(); } mvStore = db.getStore(); if (mvStore != null) { mvStore.statisticsStart(); } } if (command.isQuery()) { command.query(maxrows); } else { command.update(); } plan = command.getPlanSQL(); Map<String, Integer> statistics = null; if (store != null) { statistics = store.statisticsEnd(); } else if (mvStore != null) { statistics = mvStore.statisticsEnd(); } if (statistics != null) { int total = 0; for (Entry<String, Integer> e : statistics.entrySet()) { total += e.getValue(); } if (total > 0) { statistics = new TreeMap<>(statistics); StringBuilder buff = new StringBuilder(); if (statistics.size() > 1) { buff.append("total: ").append(total).append('\n'); } for (Entry<String, Integer> e : statistics.entrySet()) { int value = e.getValue(); int percent = (int) (100L * value / total); buff.append(e.getKey()).append(": ").append(value); if (statistics.size() > 1) { buff.append(" (").append(percent).append("%)"); } buff.append('\n'); } plan += "\n "; } } } else { plan = command.getPlanSQL(); } add(plan); } result.done(); return result; }</code><technical_language>is a db variable instead of session.getDatabase()</technical_language>

Target:
public ResultInterface query(int maxrows) { Column column = new Column("PLAN", Value.STRING); Database db = session.getDatabase(); ExpressionColumn expr = new ExpressionColumn(db, column); Expression[] expressions = { expr }; result = db.getResultFactory().create(session, expressions, 1); if (maxrows >= 0) { String plan; if (executeCommand) { PageStore store = null; Store mvStore = null; if (db.isPersistent()) { store = db.getPageStore(); if (store != null) { store.statisticsStart(); } mvStore = db.getStore(); if (mvStore != null) { mvStore.statisticsStart(); } } if (command.isQuery()) { command.query(maxrows); } else { command.update(); } plan = command.getPlanSQL(); Map<String, Integer> statistics = null; if (store != null) { statistics = store.statisticsEnd(); } else if (mvStore != null) { statistics = mvStore.statisticsEnd(); } if (statistics != null) { int total = 0; for (Entry<String, Integer> e : statistics.entrySet()) { total += e.getValue(); } if (total > 0) { statistics = new TreeMap<>(statistics); StringBuilder buff = new StringBuilder(); if (statistics.size() > 1) { buff.append("total: ").append(total).append('\n'); } for (Entry<String, Integer> e : statistics.entrySet()) { int value = e.getValue(); int percent = (int) (100L * value / total); buff.append(e.getKey()).append(": ").append(value); if (statistics.size() > 1) { buff.append(" (").append(percent).append("%)"); } buff.append('\n'); } plan += "\n "; } } } else { plan = command.getPlanSQL(); } add(plan); } result.done(); return result; }