Zend Framework 2 - Zend\Db\Adapter\Driver\Sqlsrv\Result

For programming and general questions on Zend Framework
Post Reply
denozawr
Posts: 5
Joined: Thu Dec 20, 2012 6:44 pm

Zend Framework 2 - Zend\Db\Adapter\Driver\Sqlsrv\Result

Post by denozawr » Thu Dec 20, 2012 7:02 pm

ZF2 2.0.6
In many cases very usefull fetchType=SQLSRV_FETCH_NUMERIC, but in function load of class Result i found only SQLSRV_FETCH_ASSOC. I think using SQLSRV_FETCH_BOTH will be better for all cases.

original code

Code: Select all

    protected function load($row = SQLSRV_SCROLL_NEXT)
    {
        $this->currentData = sqlsrv_fetch_array($this->resource, SQLSRV_FETCH_ASSOC, $row);
        $this->currentComplete = true;
        $this->position++;
        return $this->currentData;
    }
Why using SQLSRV_FETCH_ASSOC ?
I am executting many different stored procedures and user defined functions. In some cases i don't know collumn names...

denozawr
Posts: 5
Joined: Thu Dec 20, 2012 6:44 pm

Re: Zend Framework 2 - Zend\Db\Adapter\Driver\Sqlsrv\Result

Post by denozawr » Thu Mar 28, 2013 3:44 pm

In Zend Framework 2.1.4 the problem still exists.

line 118

Code: Select all

$this->currentData = sqlsrv_fetch_array($this->resource, SQLSRV_FETCH_ASSOC, $row);
i fix it by this

Code: Select all

$this->currentData = sqlsrv_fetch_array($this->resource, SQLSRV_FETCH_BOTH, $row);

Post Reply