/** * Run the supplied query. Only for fetching rows from * the database. * * @param string Optional. The SQL query to execute. * @param array Optional. Additional parameters to * supply to the query. * @param bool If true, fetches all matching rows. * Defaults to TRUE. * @return array **/ protected final function read($query = NULL, $params = NULL, $fetchAll = TRUE) { $execution = $this->execute($query, $params); if ($execution !== TRUE) { return $execution; } if ($fetchAll) { return $this->database->fetchAll(); } return $this->database->fetch(); }