|
在 MSSQL 数据库驱动中,“_limit”函数无效,所以要修改“mssql_driver.php”这个文件。
修改文件“system/database/drivers/mssql/mssql_driver.php”中的“_limit”函数为:PHP复制代码 function _limit ($sql, $limit, $offset)
{
$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;
} 复制代码 |
|