Pop\Db\Record\Prepared::query PHP Метод

query() публичный Метод

Execute a custom SQL query.
public query ( string $sql ) : void
$sql string
Результат void
    public function query($sql)
    {
        $this->sql->adapter()->query($sql);
        // Set the return results.
        if (stripos($sql, 'select') !== false) {
            // If there is more than one result returned, create an array of results.
            if ($this->sql->adapter()->numRows() > 1) {
                while (($row = $this->sql->adapter()->fetch()) != false) {
                    $this->rows[] = new \ArrayObject($row, \ArrayObject::ARRAY_AS_PROPS);
                }
                // Else, set the _columns array to the single returned result.
            } else {
                while (($row = $this->sql->adapter()->fetch()) != false) {
                    $this->rows[0] = new \ArrayObject($row, \ArrayObject::ARRAY_AS_PROPS);
                }
            }
        } else {
            if (stripos($sql, 'delete') !== false) {
                $this->columns = array();
                $this->rows = array();
            }
        }
    }