QueryPlanner::QueryPlanner(const std::string& query,
                           const SQLiteDBInstanceRef& instance) {
  QueryData plan;
  queryInternal("EXPLAIN QUERY PLAN " + query, plan, instance);
  queryInternal("EXPLAIN " + query, program_, instance);

  for (const auto& row : plan) {
    auto details = osquery::split(row.at("detail"));
    if (details.size() > 2 && details[0] == "SCAN") {
      tables_.push_back(details[2]);
    }
  }
}
QueryPlanner::QueryPlanner(const std::string& query,
                           const SQLiteDBInstanceRef& instance) {
  QueryData plan;
  queryInternal("EXPLAIN QUERY PLAN " + query, plan, instance);
  queryInternal("EXPLAIN " + query, program_, instance);

  for (const auto& row : plan) {
    auto details = osquery::split(row.at("detail"));
    if (details.size() > 2 && details[0] == "SCAN") {
      tables_.push_back(details[2]);
    }
  }
}