类型 "e" 不存在,Redshift 通过 php codeigniter 中的 Postgresql 连接器
type "e" does not exist , Redshift through Postgresql connector in php codeigniter
我正在通过 Postgresql 连接器使用 Redshift 我在 php codeigniter 3.x、php 7.0 版中查询时遇到以下错误
型号如下
$subQuery = "select max(button_history_id) as button_history_id from button_history
where site_id =".$site_id." group by button_history_id ";
$this->another->select('cms_group_id');
$this->another->from('button_history');
$this->another->where('button_history_id IN ('.$subQuery.")");
$this->another->where('cms_group_id !=', '');
$queryGrp = $this->another->get();
$grpIds = array();
foreach($queryGrp->result_array() as $grps){
if($grps['cms_group_id'])
$grpIds = array_merge($grpIds,explode(',', $grps['cms_group_id']));
}
if($grpIds){
$grpIds = array_unique($grpIds);
$this->another->select('content_history_id, (content_id),content_name,content_type');
$this->another->from('content_history');
$this->another->where_in('content_id',$grpIds);
$this->another->group_by('content_history_id,content_id,content_name,content_type');
$this->another->order_by('content_id ,content_history_id',"desc");
$queryG = $this->another->get();
$result1 = $queryG->result_array();
}
但是在值之前附加了一个不需要的 E',如下所示
错误:类型 "e" 不存在
SELECT "content_history_id", (content_id), "content_name", "content_type" FROM "content_history" WHERE "content_id" IN( E'358', E'357', E'359', E'361', E'408', E'398', E'362', E'366', E'363') GROUP BY "content_history_id", "content_id", "content_name", "content_type" ORDER BY "content_id" DESC, "content_history_id" DESC
这个 E'358' "E" 引起了所有的麻烦,任何人都可以有任何建议请回复。我是新手,不知道这是什么原因,我在下面添加了这些信息。
php 版本:7.0
代码点火器:3.x
OS:Centos 6.9
此 E 用于 PostgreSQL 中的转义字符。参见 here。
尝试向where_in
添加第三个参数,避免转义。
$this->another->where_in('content_id',$grpIds, false);
我正在通过 Postgresql 连接器使用 Redshift 我在 php codeigniter 3.x、php 7.0 版中查询时遇到以下错误 型号如下
$subQuery = "select max(button_history_id) as button_history_id from button_history
where site_id =".$site_id." group by button_history_id ";
$this->another->select('cms_group_id');
$this->another->from('button_history');
$this->another->where('button_history_id IN ('.$subQuery.")");
$this->another->where('cms_group_id !=', '');
$queryGrp = $this->another->get();
$grpIds = array();
foreach($queryGrp->result_array() as $grps){
if($grps['cms_group_id'])
$grpIds = array_merge($grpIds,explode(',', $grps['cms_group_id']));
}
if($grpIds){
$grpIds = array_unique($grpIds);
$this->another->select('content_history_id, (content_id),content_name,content_type');
$this->another->from('content_history');
$this->another->where_in('content_id',$grpIds);
$this->another->group_by('content_history_id,content_id,content_name,content_type');
$this->another->order_by('content_id ,content_history_id',"desc");
$queryG = $this->another->get();
$result1 = $queryG->result_array();
}
但是在值之前附加了一个不需要的 E',如下所示
错误:类型 "e" 不存在
SELECT "content_history_id", (content_id), "content_name", "content_type" FROM "content_history" WHERE "content_id" IN( E'358', E'357', E'359', E'361', E'408', E'398', E'362', E'366', E'363') GROUP BY "content_history_id", "content_id", "content_name", "content_type" ORDER BY "content_id" DESC, "content_history_id" DESC
这个 E'358' "E" 引起了所有的麻烦,任何人都可以有任何建议请回复。我是新手,不知道这是什么原因,我在下面添加了这些信息。
php 版本:7.0 代码点火器:3.x OS:Centos 6.9
此 E 用于 PostgreSQL 中的转义字符。参见 here。
尝试向where_in
添加第三个参数,避免转义。
$this->another->where_in('content_id',$grpIds, false);