07-26-2007, 04:59 PM
[eluser]Rav3soul[/eluser]
The "_limit" function didn't work, so I modified the "mssql_driver.php" file to make it work. Check my changes and you can use it to make a new release.
Basically, it's just to modify "system/database/drivers/mssql/mssql_driver.php"
to
Yeah, I know: "It's a Cursor!", but this method not use "ORDER BY". I find this method here :
http://www.elguille.info/colabora/NET200...Server.htm
And I just modify this to work whit CodeIgniter.
I use this, and I find this method "the better"
I've been waiting for your comments.
The "_limit" function didn't work, so I modified the "mssql_driver.php" file to make it work. Check my changes and you can use it to make a new release.
Basically, it's just to modify "system/database/drivers/mssql/mssql_driver.php"
to
Code:
function _limit($sql, $limit, $offset)
{
// Horrible solucion =)
//$i = $limit + $offset;
//return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql);
$cursorName = 'mi_cursor_'.md5(strtolower($sql));
$sql = "DECLARE ".$cursorName." CURSOR DYNAMIC READ_ONLY FOR
".$sql."
OPEN ".$cursorName."
DECLARE @CURSOR AS INT
SELECT @CURSOR = CURSOR_HANDLE FROM MASTER.DBO.SYSCURSORS
WHERE CURSOR_NAME = '".$cursorName."'
EXEC SP_CURSORFETCH @CURSOR, 32, ".($offset+1).", ".$limit."
EXEC SP_CURSORCLOSE @CURSOR";
return $sql;
}
http://www.elguille.info/colabora/NET200...Server.htm
And I just modify this to work whit CodeIgniter.
I use this, and I find this method "the better"

I've been waiting for your comments.