|
楼主 |
发表于 2013-5-11 12:53:21
|
显示全部楼层
解决方法,修改了sqlsrv这个驱动的 function _limit,
PHP复制代码 function _limit ($sql, $limit, $offset)
{
$str=strtolower(str_replace("\n",' ',$sql));
$strtemp=substr($str,strpos(strtolower($str),'from ')+5);
$tablename=substr($strtemp,0,stripos($strtemp,' '));
$orderby=substr($str,strpos(strtolower($str),'order by ')+9);
$sql = "
SELECT *
FROM
( SELECT *, ROW_NUMBER() OVER (ORDER BY $orderby) as NroFila
FROM $tablename
) AS PAG_TABLEXXX
WHERE
NroFila BETWEEN ".($offset? $offset+1:1)." AND ".($offset+$limit)."
";
return $sql;
} 复制代码 |
|