繁体   English   中英

codeigniter 3.1.0中的protect_identifiers问题

[英]protect_identifiers issue in codeigniter 3.1.0

在以前的版本2.2.6中我使用以下代码:

$this->db->_protect_identifiers=false;

$dataField='tm.*,IFNULL(CONCAT_WS(" " ,pm.firstName,pm.lastName),"") as assignedToName,IFNULL(cm.caseNo,"") as CaseNo,IFNULL(cm1.fileNo,"") as fileNo,IFNULL(sm.caseStage,"") as caseStage';

$qryTable='task_mst as tm 
            LEFT JOIN case_mst as cm on tm.caseNo=cm.ID
            LEFT JOIN case_mst as cm1 on tm.fileNo=cm1.ID
            LEFT JOIN party_mst as pm on tm.assignedTo=pm.ID
            LEFT JOIN session_mst as sm on tm.sessionId=sm.ID';
$task= $this->db->select($dataField,false)->from($qryTable)->where($where,NULL,FALSE)->order_by("ID","desc")->limit(10)->get()->result_array();

现在我使用版本3.1.0但“_protect_identifiers”将给出错误消息

Fatal error: Cannot access protected property CI_DB_mysqli_driver::$_protect_identifiers

谁能告诉我如何在codeigniter 3.1.0中使用“protect_identifiers()”?

这是一个样本

return 'SELECT '.$this->escape_identifiers('name')
            .' FROM '.$this->escape_identifiers('sysobjects')
            .' WHERE '.$this->escape_identifiers('type')." = 'U'";

试着像这样设置..

$this->db->protect_idenifiers(FALSE)->select(...)->where(...)

欲了解更多请参考这个

只需从$ this-> db - > _ protect_identifiers中删除_。 (下划线符号)

$this->db->protect_identifiers=false;

这是新版本中的CI更改。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM