Solar_Sql_Adapter::fetchOne PHP 메소드

fetchOne() 공개 메소드

When $spec is an array, automatically sets LIMIT 1 OFFSET 0 to limit the results to a single row.
public fetchOne ( array | string $spec, array $data = [] ) : array
$spec array | string An array of component parts for a SELECT, or a literal query string.
$data array An associative array of data to bind into the SELECT statement.
리턴 array
    public function fetchOne($spec, $data = array())
    {
        if (is_array($spec)) {
            // automatically limit to the first row only,
            // but leave the offset alone.
            $spec['limit']['count'] = 1;
        }
        $result = $this->fetchPdo($spec, $data);
        return $result->fetch(PDO::FETCH_ASSOC);
    }