CI 묻고 답하기

제목 저장 프로시져(Stored Procedure) 사용시, warning error 가 나타납니다.
글쓴이 놀란 작성시각 2014/12/11 15:17:25
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 19254   RSS
안녕하세요.

프로젝트 진행 중입니다.

트랜잭션 처리가 필요한 부분을 SP 로 옮기고 있습니다.
실행도 잘 되고, 리턴 (output) 값도 받아서 잘 처리가 되고 있습니다.

그런데, 실행 때 마다 아래와 같은 warning 을 에러로 보여주고 있습니다.
이유와 처리법 아시는 분 계신가요?
구글링 해도 명확한 답이 없네요.

감사합니다.


Severity: Warning  --> mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given /Volumes/Data/Sources/AD_Project/system/database/drivers/mysqli/mysqli_result.php 37
 다음글 모바일 LG기종 ajax 세션 만료 문제
 이전글 doctypes.php 파일 사용방법이 무었일래나... (4)

댓글

한대승(불의회상) / 2014/12/11 16:04:49 / 추천 0
어떤 상황에서 발생하는 에러인가요?
놀란 / 2014/12/11 16:11:44 / 추천 0
@한대승

모델에서 SP 호출하면 항상 뜹니다.

$call_sp = "CALL USP_GAME_RESULT  (파라미터1, 2, 3)";

$query = $this->db->query($call_sp);

$this->db->query() 를 실행하면 저 워닝 메시지가 뜹니다.


 
한대승(불의회상) / 2014/12/11 16:42:14 / 추천 0
저장 프로시져나 함수는 호출하는 방법이 달랐던걸로 기억합니다.
저는 잘 사용하지 않아서.. ㅎㅎㅎㅎ
아래 URL 참조 하세요.

http://cikorea.net/user_guide_2.1.0/database/call_function.html
변종원(웅파) / 2014/12/11 19:10:17 / 추천 0
    /**
     * 프로시져 호출
     * @author Jongwon Byun <codeigniterk@gmail.com>
     */
    function use_procedure($proc_name, $arg_arr=array())
    {
        if($arg_arr)
        {
            $arg = '\'';
            $arg .= implode('\',\'', $arg_arr);
            $arg .= '\',@return_value';

            $sql = "CALL {$proc_name}({$arg});";
        }
        else
        {
            $sql = "CALL {$proc_name}(@return_value)";
        }

        $this->mysqli = $this->load->database('mysqli', TRUE);


        $this->mysqli->query($sql);
        $result = $this->mysqli->query("select @return_value");

        $returns = $result->result_array();

        //로깅
        $this->procedure_log($proc_name, implode('|', $arg_arr), implode('|', $returns[0]));

        return $returns;

     }

     /**
     * 프로시져 호출
     * 멀티 리턴
     * @author Jongwon Byun <codeigniterk@gmail.com>
     */
    function use_procedure_multi($proc_name, $arg_arr=array())
    {
        if($arg_arr)
        {
            $arg = '\'';
            $arg .= implode('\',\'', $arg_arr);
            $arg .= '\'';
            //$arg .= '\',@return_value';

            $sql = "CALL {$proc_name}({$arg});";
        }
        else
        {
            $sql = "CALL {$proc_name}(@return_value)";
        }

        $this->mysqli = $this->load->database('mysqli', TRUE);


        $result = $this->mysqli->query($sql);

        $returns = $result->result_array();

        //로깅
        $this->procedure_log($proc_name, implode('|', $arg_arr), @implode('|', $returns[0]));

        return $returns;

     }

이런 식으로 만들어 썼습니다. 로깅은 빼고 나머지 부분 참고하세요. 
놀란 / 2014/12/12 11:44:13 / 추천 0
답변들 감사합니다.
참고 하겠습니다!