ui: Rename queryV2 -> query

find ui/src -type f | grep 'ts$' | xargs gsed -i 's/queryV2/query/g'

Change-Id: Ie6814e1f4195b9613d2e9f163ed6673c3d15057b
diff --git a/ui/src/controller/aggregation/aggregation_controller.ts b/ui/src/controller/aggregation/aggregation_controller.ts
index f99b5c6..e526f56 100644
--- a/ui/src/controller/aggregation/aggregation_controller.ts
+++ b/ui/src/controller/aggregation/aggregation_controller.ts
@@ -118,7 +118,7 @@
       sorting = `${pref.sorting.column} ${pref.sorting.direction}`;
     }
     const query = `select ${colIds} from ${this.kind} order by ${sorting}`;
-    const result = await this.args.engine.queryV2(query);
+    const result = await this.args.engine.query(query);
 
     const numRows = result.numRows();
     const columns = defs.map(def => this.columnFromColumnDef(def, numRows));
@@ -157,7 +157,7 @@
 
   async getSum(def: ColumnDef): Promise<string> {
     if (!def.sum) return '';
-    const result = await this.args.engine.queryV2(
+    const result = await this.args.engine.query(
         `select ifnull(sum(${def.columnId}), 0) as s from ${this.kind}`);
     let sum = result.firstRow({s: NUM}).s;
     if (def.kind === 'TIMESTAMP_NS') {
diff --git a/ui/src/controller/aggregation/counter_aggregation_controller.ts b/ui/src/controller/aggregation/counter_aggregation_controller.ts
index a24d97b..24d4a94 100644
--- a/ui/src/controller/aggregation/counter_aggregation_controller.ts
+++ b/ui/src/controller/aggregation/counter_aggregation_controller.ts
@@ -23,7 +23,7 @@
 
 export class CounterAggregationController extends AggregationController {
   async createAggregateView(engine: Engine, area: Area) {
-    await engine.queryV2(`drop view if exists ${this.kind};`);
+    await engine.query(`drop view if exists ${this.kind};`);
 
     const ids = [];
     for (const trackId of area.tracks) {
@@ -67,7 +67,7 @@
     on track_id = counter_track.id
     group by track_id`;
 
-    await engine.queryV2(query);
+    await engine.query(query);
     return true;
   }
 
diff --git a/ui/src/controller/aggregation/cpu_aggregation_controller.ts b/ui/src/controller/aggregation/cpu_aggregation_controller.ts
index f2be809..a8b1161 100644
--- a/ui/src/controller/aggregation/cpu_aggregation_controller.ts
+++ b/ui/src/controller/aggregation/cpu_aggregation_controller.ts
@@ -24,7 +24,7 @@
 
 export class CpuAggregationController extends AggregationController {
   async createAggregateView(engine: Engine, area: Area) {
-    await engine.queryV2(`drop view if exists ${this.kind};`);
+    await engine.query(`drop view if exists ${this.kind};`);
 
     const selectedCpus = [];
     for (const trackId of area.tracks) {
@@ -49,7 +49,7 @@
         thread_state.ts + thread_state.dur > ${toNs(area.startSec)} AND
         thread_state.ts < ${toNs(area.endSec)} group by utid`;
 
-    await engine.queryV2(query);
+    await engine.query(query);
     return true;
   }
 
diff --git a/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts b/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts
index a7f8e0e..baf9efe 100644
--- a/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts
+++ b/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts
@@ -23,7 +23,7 @@
 
 export class CpuByProcessAggregationController extends AggregationController {
   async createAggregateView(engine: Engine, area: Area) {
-    await engine.queryV2(`drop view if exists ${this.kind};`);
+    await engine.query(`drop view if exists ${this.kind};`);
 
     const selectedCpus = [];
     for (const trackId of area.tracks) {
@@ -48,7 +48,7 @@
         thread_state.ts + thread_state.dur > ${toNs(area.startSec)} AND
         thread_state.ts < ${toNs(area.endSec)} group by upid`;
 
-    await engine.queryV2(query);
+    await engine.query(query);
     return true;
   }
 
diff --git a/ui/src/controller/aggregation/slice_aggregation_controller.ts b/ui/src/controller/aggregation/slice_aggregation_controller.ts
index aba4341..f3b2807 100644
--- a/ui/src/controller/aggregation/slice_aggregation_controller.ts
+++ b/ui/src/controller/aggregation/slice_aggregation_controller.ts
@@ -30,7 +30,7 @@
 
 export class SliceAggregationController extends AggregationController {
   async createAggregateView(engine: Engine, area: Area) {
-    await engine.queryV2(`drop view if exists ${this.kind};`);
+    await engine.query(`drop view if exists ${this.kind};`);
 
     const selectedTrackIds = [];
     for (const trackId of area.tracks) {
@@ -61,7 +61,7 @@
         ts + dur > ${toNs(area.startSec)} AND
         ts < ${toNs(area.endSec)} group by name`;
 
-    await engine.queryV2(query);
+    await engine.query(query);
     return true;
   }
 
diff --git a/ui/src/controller/aggregation/thread_aggregation_controller.ts b/ui/src/controller/aggregation/thread_aggregation_controller.ts
index 51e0444..ff7bd6f 100644
--- a/ui/src/controller/aggregation/thread_aggregation_controller.ts
+++ b/ui/src/controller/aggregation/thread_aggregation_controller.ts
@@ -41,7 +41,7 @@
   }
 
   async createAggregateView(engine: Engine, area: Area) {
-    await engine.queryV2(`drop view if exists ${this.kind};`);
+    await engine.query(`drop view if exists ${this.kind};`);
     this.setThreadStateUtids(area.tracks);
     if (this.utids === undefined || this.utids.length === 0) return false;
 
@@ -65,7 +65,7 @@
       GROUP BY utid, concat_state
     `;
 
-    await engine.queryV2(query);
+    await engine.query(query);
     return true;
   }
 
@@ -81,7 +81,7 @@
             toNs(area.startSec)} AND
       thread_state.ts < ${toNs(area.endSec)}
       GROUP BY state, io_wait`;
-    const result = await engine.queryV2(query);
+    const result = await engine.query(query);
 
     const it = result.iter({
       state: STR_NULL,
diff --git a/ui/src/controller/cpu_profile_controller.ts b/ui/src/controller/cpu_profile_controller.ts
index b048a4d..932fb64 100644
--- a/ui/src/controller/cpu_profile_controller.ts
+++ b/ui/src/controller/cpu_profile_controller.ts
@@ -142,7 +142,7 @@
       ORDER BY callsites.depth;
     `;
 
-    const callsites = await this.args.engine.queryV2(sampleQuery);
+    const callsites = await this.args.engine.query(sampleQuery);
 
     if (callsites.numRows() === 0) {
       return undefined;
diff --git a/ui/src/controller/flow_events_controller.ts b/ui/src/controller/flow_events_controller.ts
index decd9a9..a5a80cd 100644
--- a/ui/src/controller/flow_events_controller.ts
+++ b/ui/src/controller/flow_events_controller.ts
@@ -44,7 +44,7 @@
   }
 
   queryFlowEvents(query: string, callback: (flows: Flow[]) => void) {
-    this.args.engine.queryV2(query).then(result => {
+    this.args.engine.query(query).then(result => {
       const flows: Flow[] = [];
       const it = result.iter({
         beginSliceId: NUM,
diff --git a/ui/src/controller/heap_profile_controller.ts b/ui/src/controller/heap_profile_controller.ts
index f8d11bb..8ec8e34 100644
--- a/ui/src/controller/heap_profile_controller.ts
+++ b/ui/src/controller/heap_profile_controller.ts
@@ -58,12 +58,12 @@
       // TODO(hjd): This should be LRU.
       if (this.cache.size > this.cacheSizeLimit) {
         for (const name of this.cache.values()) {
-          await this.engine.queryV2(`drop table ${name}`);
+          await this.engine.query(`drop table ${name}`);
         }
         this.cache.clear();
       }
       tableName = `${this.prefix}_${this.tableId++}`;
-      await this.engine.queryV2(
+      await this.engine.query(
           `create temp table if not exists ${tableName} as ${query}`);
       this.cache.set(query, tableName);
     }
@@ -268,7 +268,7 @@
         break;
     }
 
-    const callsites = await this.args.engine.queryV2(`
+    const callsites = await this.args.engine.query(`
         SELECT
         id as hash,
         IFNULL(DEMANGLE(name), name) as name,
@@ -387,7 +387,7 @@
 
     // Collecting data for more information about heap profile, such as:
     // total memory allocated, memory that is allocated and not freed.
-    const result = await this.args.engine.queryV2(
+    const result = await this.args.engine.query(
         `select pid from process where upid = ${upid}`);
     const pid = result.firstRow({pid: NUM}).pid;
     const startTime = fromNs(ts) - globals.state.traceTime.startSec;
diff --git a/ui/src/controller/logs_controller.ts b/ui/src/controller/logs_controller.ts
index f6a086f..e87319d 100644
--- a/ui/src/controller/logs_controller.ts
+++ b/ui/src/controller/logs_controller.ts
@@ -32,7 +32,7 @@
   const vizStartNs = toNsFloor(span.start);
   const vizEndNs = toNsCeil(span.end);
 
-  const countResult = await engine.queryV2(`
+  const countResult = await engine.query(`
      select
       ifnull(min(ts), 0) as minTs,
       ifnull(max(ts), 0) as maxTs,
@@ -45,12 +45,12 @@
   const lastRowNs = countRow.maxTs;
   const total = countRow.countTs;
 
-  const minResult = await engine.queryV2(`
+  const minResult = await engine.query(`
      select ifnull(max(ts), 0) as maxTs from android_logs where ts < ${
       vizStartNs}`);
   const startNs = minResult.firstRow({maxTs: NUM}).maxTs;
 
-  const maxResult = await engine.queryV2(`
+  const maxResult = await engine.query(`
      select ifnull(min(ts), 0) as minTs from android_logs where ts > ${
       vizEndNs}`);
   const endNs = maxResult.firstRow({minTs: NUM}).minTs;
@@ -76,7 +76,7 @@
   const vizEndNs = toNsCeil(span.end);
   const vizSqlBounds = `ts >= ${vizStartNs} and ts <= ${vizEndNs}`;
 
-  const rowsResult = await engine.queryV2(`
+  const rowsResult = await engine.query(`
         select
           ts,
           prio,
@@ -180,7 +180,7 @@
   }
 
   async hasAnyLogs() {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
       select count(*) as cnt from android_logs
     `);
     return result.firstRow({cnt: NUM}).cnt > 0;
diff --git a/ui/src/controller/metrics_controller.ts b/ui/src/controller/metrics_controller.ts
index 458f650..21ca500 100644
--- a/ui/src/controller/metrics_controller.ts
+++ b/ui/src/controller/metrics_controller.ts
@@ -34,7 +34,7 @@
 
   private async getMetricNames() {
     const metrics = [];
-    const result = await this.engine.queryV2('select name from trace_metrics');
+    const result = await this.engine.query('select name from trace_metrics');
     const it = result.iter({name: STR});
     for (; it.valid(); it.next()) {
       metrics.push(it.name);
diff --git a/ui/src/controller/search_controller.ts b/ui/src/controller/search_controller.ts
index cca107a..3ec461f 100644
--- a/ui/src/controller/search_controller.ts
+++ b/ui/src/controller/search_controller.ts
@@ -60,11 +60,11 @@
   }
 
   private async setup() {
-    await this.queryV2(`create virtual table search_summary_window
+    await this.query(`create virtual table search_summary_window
       using window;`);
-    await this.queryV2(`create virtual table search_summary_sched_span using
+    await this.query(`create virtual table search_summary_sched_span using
       span_join(sched PARTITIONED cpu, search_summary_window);`);
-    await this.queryV2(`create virtual table search_summary_slice_span using
+    await this.query(`create virtual table search_summary_slice_span using
       span_join(slice PARTITIONED track_id, search_summary_window);`);
   }
 
@@ -153,13 +153,13 @@
     startNs = Math.floor(startNs / quantumNs) * quantumNs;
 
     const windowDur = Math.max(endNs - startNs, 1);
-    await this.queryV2(`update search_summary_window set
+    await this.query(`update search_summary_window set
       window_start=${startNs},
       window_dur=${windowDur},
       quantum=${quantumNs}
       where rowid = 0;`);
 
-    const utidRes = await this.queryV2(`select utid from thread join process
+    const utidRes = await this.query(`select utid from thread join process
       using(upid) where thread.name like ${searchLiteral}
       or process.name like ${searchLiteral}`);
 
@@ -171,7 +171,7 @@
     const cpus = await this.engine.getCpus();
     const maxCpu = Math.max(...cpus, -1);
 
-    const res = await this.queryV2(`
+    const res = await this.query(`
         select
           (quantum_ts * ${quantumNs} + ${startNs})/1e9 as tsStart,
           ((quantum_ts+1) * ${quantumNs} + ${startNs})/1e9 as tsEnd,
@@ -231,7 +231,7 @@
       }
     }
 
-    const utidRes = await this.queryV2(`select utid from thread join process
+    const utidRes = await this.query(`select utid from thread join process
     using(upid) where
       thread.name like ${searchLiteral} or
       process.name like ${searchLiteral}`);
@@ -240,7 +240,7 @@
       utids.push(it.utid);
     }
 
-    const queryRes = await this.queryV2(`
+    const queryRes = await this.query(`
     select
       id as sliceId,
       ts,
@@ -303,8 +303,8 @@
     return searchResults;
   }
 
-  private async queryV2(query: string) {
-    const result = await this.engine.queryV2(query);
+  private async query(query: string) {
+    const result = await this.engine.query(query);
     return result;
   }
 }
diff --git a/ui/src/controller/selection_controller.ts b/ui/src/controller/selection_controller.ts
index 132237f..cab23b1 100644
--- a/ui/src/controller/selection_controller.ts
+++ b/ui/src/controller/selection_controller.ts
@@ -106,7 +106,7 @@
       promisedDescription = Promise.resolve(new Map());
       promisedArgs = Promise.resolve(new Map());
     } else {
-      const result = await this.args.engine.queryV2(`
+      const result = await this.args.engine.query(`
         SELECT
           type as leafTable,
           arg_set_id as argSetId
@@ -127,7 +127,7 @@
       promisedArgs = this.getArgs(argSetId);
     }
 
-    const promisedDetails = this.args.engine.queryV2(`
+    const promisedDetails = this.args.engine.query(`
       SELECT * FROM ${leafTable} WHERE id = ${selectedId};
     `);
 
@@ -197,7 +197,7 @@
       from describe_slice
       where slice_id = ${id}
     `;
-    const result = await this.args.engine.queryV2(query);
+    const result = await this.args.engine.query(query);
     const it = result.iter({description: STR, docLink: STR});
     for (; it.valid(); it.next()) {
       const description = it.description;
@@ -217,7 +217,7 @@
       FROM args
       WHERE arg_set_id = ${argId}
     `;
-    const result = await this.args.engine.queryV2(query);
+    const result = await this.args.engine.query(query);
     const it = result.iter({
       name: STR,
       value: STR,
@@ -240,7 +240,7 @@
   async getDestTrackId(sliceId: string): Promise<string> {
     const trackIdQuery = `select track_id as trackId from slice
     where slice_id = ${sliceId}`;
-    const result = await this.args.engine.queryV2(trackIdQuery);
+    const result = await this.args.engine.query(trackIdQuery);
     const trackIdTp = result.firstRow({trackId: NUM}).trackId;
     // TODO(hjd): If we had a consistent mapping from TP track_id
     // UI track id for slice tracks this would be unnecessary.
@@ -269,7 +269,7 @@
       from thread_state
       left join sched using(ts) where thread_state.id = ${id}
     `;
-    const result = await this.args.engine.queryV2(query);
+    const result = await this.args.engine.query(query);
 
     const selection = globals.state.currentSelection;
     if (result.numRows() > 0 && selection) {
@@ -310,7 +310,7 @@
       thread_state.id as threadStateId
     FROM sched join thread_state using(ts, utid, dur, cpu)
     WHERE sched.id = ${id}`;
-    const result = await this.args.engine.queryV2(sqlQuery);
+    const result = await this.args.engine.query(sqlQuery);
     // Check selection is still the same on completion of query.
     const selection = globals.state.currentSelection;
     if (result.numRows() > 0 && selection) {
@@ -352,7 +352,7 @@
   }
 
   async counterDetails(ts: number, rightTs: number, id: number) {
-    const counter = await this.args.engine.queryV2(
+    const counter = await this.args.engine.query(
         `SELECT value, track_id as trackId FROM counter WHERE id = ${id}`);
     const row = counter.iter({
       value: NUM,
@@ -362,7 +362,7 @@
     const trackId = row.trackId;
     // Finding previous value. If there isn't previous one, it will return 0 for
     // ts and value.
-    const previous = await this.args.engine.queryV2(`SELECT
+    const previous = await this.args.engine.query(`SELECT
           MAX(ts),
           IFNULL(value, 0) as value
         FROM counter WHERE ts < ${ts} and track_id = ${trackId}`);
@@ -377,9 +377,9 @@
 
   async schedulingDetails(ts: number, utid: number|Long) {
     let event = 'sched_waking';
-    const waking = await this.args.engine.queryV2(
+    const waking = await this.args.engine.query(
         `select * from instants where name = 'sched_waking' limit 1`);
-    const wakeup = await this.args.engine.queryV2(
+    const wakeup = await this.args.engine.query(
         `select * from instants where name = 'sched_wakeup' limit 1`);
     if (waking.numRows() === 0) {
       if (wakeup.numRows() === 0) return undefined;
@@ -390,7 +390,7 @@
     // Find the ts of the first sched_wakeup before the current slice.
     const queryWakeupTs = `select ts from instants where name = '${event}'
     and ref = ${utid} and ts < ${ts} order by ts desc limit 1`;
-    const wakeResult = await this.args.engine.queryV2(queryWakeupTs);
+    const wakeResult = await this.args.engine.query(queryWakeupTs);
     if (wakeResult.numRows() === 0) {
       return undefined;
     }
@@ -399,7 +399,7 @@
     // Find the previous sched slice for the current utid.
     const queryPrevSched = `select ts from sched where utid = ${utid}
     and ts < ${ts} order by ts desc limit 1`;
-    const prevSchedResult = await this.args.engine.queryV2(queryPrevSched);
+    const prevSchedResult = await this.args.engine.query(queryPrevSched);
 
     // If this is the first sched slice for this utid or if the wakeup found
     // was after the previous slice then we know the wakeup was for this slice.
@@ -412,7 +412,7 @@
     const queryWaker = `select utid, cpu from sched where utid =
     (select utid from raw where name = '${event}' and ts = ${wakeupTs})
     and ts < ${wakeupTs} and ts + dur >= ${wakeupTs};`;
-    const wakerResult = await this.args.engine.queryV2(queryWaker);
+    const wakerResult = await this.args.engine.query(queryWaker);
     if (wakerResult.numRows() === 0) {
       return undefined;
     }
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts
index c80d02b..70caac7 100644
--- a/ui/src/controller/trace_controller.ts
+++ b/ui/src/controller/trace_controller.ts
@@ -381,7 +381,7 @@
       //   of the limit 1, and instead delegate the filtering to the iterator.
       const query = `select '_' as _ from raw
           where cpu + 1 > 1 or utid + 1 > 1 limit 1`;
-      const result = await assertExists(this.engine).queryV2(query);
+      const result = await assertExists(this.engine).query(query);
       const hasFtrace = result.numRows() > 0;
       publishHasFtrace(hasFtrace);
     }
@@ -400,7 +400,7 @@
         union
         select distinct(graph_sample_ts) as ts, 'graph' as type, upid from
         heap_graph_object) order by ts limit 1`;
-    const profile = await assertExists(this.engine).queryV2(query);
+    const profile = await assertExists(this.engine).query(query);
     if (profile.numRows() !== 1) return;
     const row = profile.firstRow({ts: NUM, type: STR, upid: NUM});
     const ts = row.ts;
@@ -430,7 +430,7 @@
         from (select * from thread order by upid) as thread
         left join (select * from process order by upid) as process
         using(upid)`;
-    const result = await assertExists(this.engine).queryV2(query);
+    const result = await assertExists(this.engine).query(query);
     const threads: ThreadDesc[] = [];
     const it = result.iter({
       utid: NUM,
@@ -467,7 +467,7 @@
       const endNs = toNsCeil(endSec);
 
       // Sched overview.
-      const schedResult = await engine.queryV2(
+      const schedResult = await engine.query(
           `select sum(dur)/${stepSec}/1e9 as load, cpu from sched ` +
           `where ts >= ${startNs} and ts < ${endNs} and utid != 0 ` +
           'group by cpu order by cpu');
@@ -489,7 +489,7 @@
     // Slices overview.
     const traceStartNs = toNs(traceTime.start);
     const stepSecNs = toNs(stepSec);
-    const sliceResult = await engine.queryV2(`select
+    const sliceResult = await engine.query(`select
            bucket,
            upid,
            sum(utid_sum) / cast(${stepSecNs} as float) as load
@@ -528,7 +528,7 @@
 
   private async cacheCurrentTrace() {
     const engine = assertExists(this.engine);
-    const result = await engine.queryV2(`select str_value as uuid from metadata
+    const result = await engine.query(`select str_value as uuid from metadata
                   where name = 'trace_uuid'`);
     if (result.numRows() === 0) {
       throw new Error('metadata.trace_uuid could not be found.');
@@ -545,7 +545,7 @@
     this.updateStatus('Creating annotation counter track table');
     // Create the helper tables for all the annotations related data.
     // NULL in min/max means "figure it out per track in the usual way".
-    await engine.queryV2(`
+    await engine.query(`
       CREATE TABLE annotation_counter_track(
         id INTEGER PRIMARY KEY,
         name STRING,
@@ -556,7 +556,7 @@
       );
     `);
     this.updateStatus('Creating annotation slice track table');
-    await engine.queryV2(`
+    await engine.query(`
       CREATE TABLE annotation_slice_track(
         id INTEGER PRIMARY KEY,
         name STRING,
@@ -566,7 +566,7 @@
     `);
 
     this.updateStatus('Creating annotation counter table');
-    await engine.queryV2(`
+    await engine.query(`
       CREATE TABLE annotation_counter(
         id BIG INT,
         track_id INT,
@@ -576,7 +576,7 @@
       ) WITHOUT ROWID;
     `);
     this.updateStatus('Creating annotation slice table');
-    await engine.queryV2(`
+    await engine.query(`
       CREATE TABLE annotation_slice(
         id INTEGER PRIMARY KEY,
         track_id INT,
@@ -612,8 +612,7 @@
 
       this.updateStatus(`Inserting data for ${metric} metric`);
       try {
-        const result =
-            await engine.queryV2(`pragma table_info(${metric}_event)`);
+        const result = await engine.query(`pragma table_info(${metric}_event)`);
         let hasSliceName = false;
         let hasDur = false;
         let hasUpid = false;
@@ -630,7 +629,7 @@
         const upidColumnSelect = hasUpid ? 'upid' : '0 AS upid';
         const upidColumnWhere = hasUpid ? 'upid' : '0';
         if (hasSliceName && hasDur) {
-          await engine.queryV2(`
+          await engine.query(`
             INSERT INTO annotation_slice_track(name, __metric_name, upid)
             SELECT DISTINCT
               track_name,
@@ -639,7 +638,7 @@
             FROM ${metric}_event
             WHERE track_type = 'slice'
           `);
-          await engine.queryV2(`
+          await engine.query(`
             INSERT INTO annotation_slice(track_id, ts, dur, depth, cat, name)
             SELECT
               t.id AS track_id,
@@ -656,14 +655,14 @@
         }
 
         if (hasValue) {
-          const minMax = await engine.queryV2(`
+          const minMax = await engine.query(`
             SELECT
               IFNULL(MIN(value), 0) as minValue,
               IFNULL(MAX(value), 0) as maxValue
             FROM ${metric}_event
             WHERE ${upidColumnWhere} != 0`);
           const row = minMax.firstRow({minValue: NUM, maxValue: NUM});
-          await engine.queryV2(`
+          await engine.query(`
             INSERT INTO annotation_counter_track(
               name, __metric_name, min_value, max_value, upid)
             SELECT DISTINCT
@@ -675,7 +674,7 @@
             FROM ${metric}_event
             WHERE track_type = 'counter'
           `);
-          await engine.queryV2(`
+          await engine.query(`
             INSERT INTO annotation_counter(id, track_id, ts, value)
             SELECT
               -1 as id,
diff --git a/ui/src/controller/trace_error_controller.ts b/ui/src/controller/trace_error_controller.ts
index d921642..6b6f461 100644
--- a/ui/src/controller/trace_error_controller.ts
+++ b/ui/src/controller/trace_error_controller.ts
@@ -35,7 +35,7 @@
     this.hasRun = true;
     const engine = this.args.engine;
     engine
-        .queryV2(
+        .query(
             `SELECT sum(value) as sumValue FROM stats WHERE severity != 'info'`)
         .then(result => {
           const errors = result.firstRow({sumValue: NUM}).sumValue;
diff --git a/ui/src/controller/track_controller.ts b/ui/src/controller/track_controller.ts
index 5d34102..fd6aae6 100644
--- a/ui/src/controller/track_controller.ts
+++ b/ui/src/controller/track_controller.ts
@@ -114,8 +114,8 @@
     return resolution >= 0.0008;
   }
 
-  protected async queryV2(query: string) {
-    const result = await this.engine.queryV2(query);
+  protected async query(query: string) {
+    const result = await this.engine.query(query);
     return result;
   }
 
diff --git a/ui/src/controller/track_decider.ts b/ui/src/controller/track_decider.ts
index 0ab3f21..1c738ea 100644
--- a/ui/src/controller/track_decider.ts
+++ b/ui/src/controller/track_decider.ts
@@ -147,7 +147,7 @@
   async addCpuFreqTracks(): Promise<void> {
     const cpus = await this.engine.getCpus();
 
-    const maxCpuFreqResult = await this.engine.queryV2(`
+    const maxCpuFreqResult = await this.engine.query(`
     select ifnull(max(value), 0) as freq
     from counter c
     inner join cpu_counter_track t on c.track_id = t.id
@@ -160,7 +160,7 @@
       // cpu freq data.
       // TODO(hjd): Find a way to display cpu idle
       // events even if there are no cpu freq events.
-      const cpuFreqIdleResult = await this.engine.queryV2(`
+      const cpuFreqIdleResult = await this.engine.query(`
       select
         id as cpuFreqId,
         (
@@ -201,7 +201,7 @@
   }
 
   async addGlobalAsyncTracks(): Promise<void> {
-    const rawGlobalAsyncTracks = await this.engine.queryV2(`
+    const rawGlobalAsyncTracks = await this.engine.query(`
     SELECT
       t.name as name,
       t.track_ids as trackIds,
@@ -245,7 +245,7 @@
 
   async addGpuFreqTracks(): Promise<void> {
     const numGpus = await this.engine.getNumberOfGpus();
-    const maxGpuFreqResult = await this.engine.queryV2(`
+    const maxGpuFreqResult = await this.engine.query(`
     select ifnull(max(value), 0) as maximumValue
     from counter c
     inner join gpu_counter_track t on c.track_id = t.id
@@ -257,7 +257,7 @@
     for (let gpu = 0; gpu < numGpus; gpu++) {
       // Only add a gpu freq track if we have
       // gpu freq data.
-      const freqExistsResult = await this.engine.queryV2(`
+      const freqExistsResult = await this.engine.query(`
       select id
       from gpu_counter_track
       where name = 'gpufreq' and gpu_id = ${gpu}
@@ -282,7 +282,7 @@
 
   async addGlobalCounterTracks(): Promise<void> {
     // Add global or GPU counter tracks that are not bound to any pid/tid.
-    const globalCounters = await this.engine.queryV2(`
+    const globalCounters = await this.engine.query(`
     select name, id
     from (
       select name, id
@@ -325,7 +325,7 @@
     // it. This might look surprising in the UI, but placeholder tracks are
     // wasteful as there's no way of collapsing global counter tracks at the
     // moment.
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
       select printf("Cpu %u %s", cpu, name) as name, id
       from perf_counter_track as pct
       order by perf_session_id asc, pct.name asc, cpu asc
@@ -399,7 +399,7 @@
 
   async addLogsTrack(): Promise<void> {
     const result =
-        await this.engine.queryV2(`select count(1) as cnt from android_logs`);
+        await this.engine.query(`select count(1) as cnt from android_logs`);
     const count = result.firstRow({cnt: NUM}).cnt;
 
     if (count > 0) {
@@ -415,7 +415,7 @@
   }
 
   async addAnnotationTracks(): Promise<void> {
-    const sliceResult = await this.engine.queryV2(`
+    const sliceResult = await this.engine.query(`
     SELECT id, name, upid FROM annotation_slice_track`);
 
     const sliceIt = sliceResult.iter({
@@ -443,7 +443,7 @@
       });
     }
 
-    const counterResult = await this.engine.queryV2(`
+    const counterResult = await this.engine.query(`
     SELECT
       id,
       name,
@@ -487,7 +487,7 @@
   }
 
   async addThreadStateTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
       select
         utid,
         tid,
@@ -535,7 +535,7 @@
   }
 
   async addThreadCpuSampleTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
       select
         utid,
         tid,
@@ -574,7 +574,7 @@
   }
 
   async addThreadCounterTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
     select
       thread_counter_track.name as trackName,
       utid,
@@ -625,7 +625,7 @@
   }
 
   async addProcessAsyncSliceTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
         select
           process_track.upid as upid,
           process_track.name as trackName,
@@ -660,7 +660,7 @@
       const uuid = this.getUuid(0, upid);
 
       // TODO(hjd): 1+N queries are bad in the track_decider
-      const depthResult = await this.engine.queryV2(`
+      const depthResult = await this.engine.query(`
       SELECT IFNULL(MAX(layout_depth), 0) as depth
       FROM experimental_slice_layout('${rawTrackIds}');
     `);
@@ -684,7 +684,7 @@
   }
 
   async addActualFramesTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
         select
           upid,
           trackName,
@@ -722,7 +722,7 @@
       const uuid = this.getUuid(0, upid);
 
       // TODO(hjd): 1+N queries are bad in the track_decider
-      const depthResult = await this.engine.queryV2(`
+      const depthResult = await this.engine.query(`
       SELECT IFNULL(MAX(layout_depth), 0) as depth
       FROM experimental_slice_layout('${rawTrackIds}');
     `);
@@ -746,7 +746,7 @@
   }
 
   async addExpectedFramesTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
         select
           upid,
           trackName,
@@ -785,7 +785,7 @@
       const uuid = this.getUuid(0, upid);
 
       // TODO(hjd): 1+N queries are bad in the track_decider
-      const depthResult = await this.engine.queryV2(`
+      const depthResult = await this.engine.query(`
       SELECT IFNULL(MAX(layout_depth), 0) as depth
       FROM experimental_slice_layout('${rawTrackIds}');
     `);
@@ -809,7 +809,7 @@
   }
 
   async addThreadSliceTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
         select
           thread_track.utid as utid,
           thread_track.id as trackId,
@@ -869,7 +869,7 @@
   }
 
   async addProcessCounterTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
     select
       process_counter_track.id as trackId,
       process_counter_track.name as trackName,
@@ -919,7 +919,7 @@
   }
 
   async addProcessHeapProfileTracks(): Promise<void> {
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
     select distinct(upid) from heap_profile_allocation
     union
     select distinct(upid) from heap_graph_object
@@ -970,7 +970,7 @@
     //  total cpu time *for the whole parent process*
     //  upid
     //  utid
-    const result = await this.engine.queryV2(`
+    const result = await this.engine.query(`
     select
       the_tracks.upid,
       the_tracks.utid,