title: What's the equivalent of $this->db->last_query() in Codeigniter 4?
body: <p>I just started learning Codeigniter 4. My query always generates NULL and I don't know why. How can I see the generated SQL Select command just like Codeigniter 3?</p>
  
  <p>In Codeigniter 3 this command does the job:</p>
  
  <pre><code>echo $this-&gt;db-&gt;last_query();
  </code></pre>
  
  <p>And this is my controller code in Codeigniter 4 that I need to get the generated query:</p>
  
  <pre><code>$cityModel = new CityModel();
  $cities = $cityModel
      -&gt;select('city.name AS cityName')
      -&gt;select('county.name AS countryName')
      -&gt;select('province.name AS provinceName')
      -&gt;join('province', 'city.province_id = province.id', 'left')
      -&gt;join('county', 'city.county_id = county.id', 'left')
      -&gt;result();
  </code></pre>
  
  <p><strong>Update:</strong>
  I tried this code but it's returning an empty string:</p>
  
  <pre><code>var_export((string)$cityModel-&gt;db-&gt;getLastQuery());
  </code></pre>