我有以下功能:https://github.com/IgnitedDatatables/Ignited-Datatables/
private function get_paging()
{
$iStart = $this->ci->input->post('iDisplayStart');
$iLength = $this->ci->input->post('iDisplayLength');
if($iLength != '' && $iLength != '-1')
$this->ci->db->limit($iLength, ($iStart)? $iStart : 0);
}
在MySQL中,此功能完美运行。但是,在MS Access中,由于"限制"不受支持。 所以我的问题是如何更改
$this->ci->db->limit($iLength, ($iStart)? $iStart : 0);
到MS Access表示法?
答案 0 :(得分:1)
Codeigniter不支持对odbc驱动程序的limit()。
此代码副本来自" system / database / drivers / odbc / odbc_driver.php"第611行
function _limit($sql, $limit, $offset)
{
// Does ODBC doesn't use the LIMIT clause?
return $sql;
}
如您所见,它不会生成任何TOP查询命令。
在Access数据库中使用限制(TOP)。更改为手动查询并使用
$this->ci->db->query('your query here');