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条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用