如何在编码器活动记录中设置group_concat_max_len


How to set group_concat_max_len in codeigniter active record?

我尝试用$this->db->query('SET GLOBAL group_concat_max_len=15000')在编码器中设置group_concat_max_len,但它不起作用。

我试过了:

$q = 'SET GLOBAL group_concat_max_len=15000';
$this->db->query($q);
$this->db->select("group_concat(id) ids");
$this->db->from("table_name");
$data = $this->db->get()->row_array();

,但这并没有给出所有的数据。有什么想法吗?谢谢! !

我找到了用SET SESSION代替SET GLOBAL的解决方案。

代码如下:

$this->db->simple_query('SET SESSION group_concat_max_len=15000');
$this->db->select("group_concat(id) ids");
$this->db->from("table_name");
$data = $this->db->get()->row_array();