Welcome Guest, Not a member yet? Register   Sign In
Database classes for SQL Server 2005 and SQL Server 2008 (using php_sqlsrv.dll from the Microsoft Data Programmability t
#34

[eluser]broadband[/eluser]
Using:
- IIS 7.5 & FastCGI
- PHP 5.3.5 (thread safe)
- MSSQL MSDE
- sqlsrv 2.0 lib(dll)
- http://www.phrenzy.org/code/sqlsrv-1.1.tar.gz

I have problems with performance when using:

Code:
$stmt = sqlsrv_query($conn, $tsql, null, array(
            'Scrollable'                => SQLSRV_CURSOR_STATIC | KEYSET,
            'SendStreamParamsAtExec'    => true
        ));

Above code works slow but num_rows() works.


If I use SQLSRV_CURSOR_FORWARD everything works quite fast, but num_rows doesn't work as is described in API. PHP outputs some NOTICE. For this to work I also had to change this two methods:

Code:
function _execute($sql)
    {
        $sql = $this->_prep_query($sql);
        return sqlsrv_query($this->conn_id, $sql);
    }

    function num_rows()
    {
        //return !$num_rows = sqlsrv_num_rows($this->result_id) ? 0 : $num_rows;
        // if i use select statement I use count with select count(*) where
        // the_same_conditions;
        return 1;
    }

Any ideas how to keep the performance and still have num_rows functionality?


Messages In This Thread
Database classes for SQL Server 2005 and SQL Server 2008 (using php_sqlsrv.dll from the Microsoft Data Programmability t - by El Forum - 02-16-2011, 02:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB