dongping4901 2012-05-26 18:01
浏览 60
已采纳

php Codeigniter - 执行库Subquery.php时出错

I have been using a library for subqueries to work - Subquery.php Ref : https://github.com/NTICompass/CodeIgniter-Subqueries

$this->db->select('test');
$this->db->select('test2');
$this->db->from('table');
$sub = $this->subquery->start_subquery('where_in');
$sub->select('IDs');
$sub->from('idTable');
$sub->where('date', '2011-07-10');
$this->subquery->end_subquery('id');

I think that this statement:

$sub = $this->subquery->start_subquery('where_in');

contains the error. When I execute this line, I get a blank page. The fn. start_subquery is:

function start_subquery($statement, $join_type = '', $join_on = 1){
        $db = $this->CI->load->database('', true); // after executing this statement, a blank page shows...
        $this->dbStack[] = $db;
        $this->statement[] = $statement;
        if(strtolower($statement) == 'join'){
            $this->join_type[] = $join_type;
            $this->join_on[] = $join_on;
        }
        return $db;
    }

FYI - In my database.php:

$active_group = 'default'
$active_record = TRUE;

And CI version is 2.1.0

  • 写回答

3条回答 默认 最新

  • dongnanman9093 2012-05-29 05:59
    关注

    Hm, understand. As I see the subquery's source code in line 27, it wants to call _compile_select or get_compiled_select. If you can check in CI's DB_active_rec.php the _compile_select is protected so you can't access from Subquery (it isn't subclass of db).

    Possible solution: _compile_select() should public or class Subquery should be extend of CI's db class. I think you should report this to author of Subquery.

    Or you can extend the CI's db class :)

    Sorry - I want to write it as a comment.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊