system/classes/Db_MySQL.php
public function exec()
    {
      // If there's a custom query to execute, do that instead of building one.
      if ($this->customQuery) {
        return $this->execCustom();
      }
      
      // Save copy of relevant data so we can calculate the total rows of this query
      // Does not save LIMIT as this is for use with pagination.
      $this->last_wheres = $this->wheres;
      $this->last_distinct = $this->distinct;
      $this->last_ins = $this->ins;
      $this->last_groupBys = $this->groupBys;
      $this->last_havings = $this->havings;
      $this->last_joins = $this->joins;
      
      // Execute this query
      $this->calculate();
      try {
          $result = $this->db->query($this->query);
      }
      catch (\PDOException $e) {
          if ($this->config['mode'] == 'development') {
              echo $this->getQuery();
          }
          $this->reset();
          throw $e;
      }
      $this->reset();
      
      // Return Result
      $dbResult = new Db_MySQLResult($result, $this->db);
      return $dbResult;
    }
public function exec()
    {
      // If there's a custom query to execute, do that instead of building one.
      if ($this->customQuery) {
        return $this->execCustom();
      }
      
      // Save copy of relevant data so we can calculate the total rows of this query
      // Does not save LIMIT as this is for use with pagination.
      $this->last_wheres = $this->wheres;
      $this->last_distinct = $this->distinct;
      $this->last_ins = $this->ins;
      $this->last_groupBys = $this->groupBys;
      $this->last_havings = $this->havings;
      $this->last_joins = $this->joins;
      
      // Execute this query
      $this->calculate();
      try {
          $result = $this->db->query($this->query);
      }
      catch (\PDOException $e) {
          if ($this->config['mode'] == 'development') {
              echo $this->getQuery();
          }
          $this->reset();
          throw $e;
      }
      $this->reset();
      
      // Return Result
      $dbResult = new Db_MySQLResult($result, $this->db);
      return $dbResult;
    }
Create SQL string and execute it on our database.