src/Modules/Database/Database.php
public function execute($sql = '', $params = [])
    {
        $result = $this->extendPrepare($sql, $params);

        if (preg_match('#insert#i', $sql)) {
            return (integer)$this->lastInsertId();
        } else {
            return (integer)$result->rowCount();
        }
    }
public function execute($sql = '', $params = [])
    {
        $result = $this->extendPrepare($sql, $params);

        if (preg_match('#insert#i', $sql)) {
            return (integer)$this->lastInsertId();
        } else {
            return (integer)$result->rowCount();
        }
    }
Example: $result = $database->extendPrepare('SELECT * FROM `table`');
while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { }

@param string $sql
@param array $params

@return integer