Welcome Guest, Not a member yet? Register   Sign In
SQL Server 2012 (11.0.*) OFFSET NOT supported on mssql_driver LIMIT
#1
Bug 

Hi,

My first post on this forum!
I'm using CI + FlexiGrid + MySQL for a web app. This works very well.
Now I'm converting it to use MS SQL Server 2012 and the pagination don't works anymore...
After several tests I found the problem:

On the sqlsrv_driver.php file, on the _limit() method, the code starts this way:
PHP Code:
    protected function _limit($sql)

    {

        
// As of SQL Server 2012 (11.0.*) OFFSET is supported
        
if (version_compare($this->version(), '11''>='))
        {
            
// SQL Server OFFSET-FETCH can be used only with the ORDER BY clause
            
empty($this->qb_orderby) && $sql .= ' ORDER BY 1';

            return 
$sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY';
        } 


But on the mssql_driver.php file this piece of code don't exists.
After I copyed the piece of code to this file, my web app worked again!

This is a bug or a feature?
I'm on CI 3.1.4, but the files are the same on CI 3.1.7...

Just my 0.02...
Thank you for any advice!
Reply
#2

The mssql driver is deprecated; use sqlsrv.
Reply
#3

Thx for reply!
I'm trying to access MS SQL from Linux, using PHP 5.6. But I didn't find the sqlsrv driver for PHP 5.6
Any advice?

TIA!
Reply
#4

My advice is to upgrade PHP ... Even 7.0 is already in security maintenance mode.
Reply
#5

OK, thx!!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB