Doodoori2's Blog

블로그 이미지
검색타고 정보 담으러 오신 분들. 블로그 글 긁어가시는 분들 댓글이라도 하나 달아주셔요 :)
두두리이

Article Category

Doodoori's (177)
Doodle (45)
Tutorial (0)
Programming (78)
Security (1)
Wargames (11)
Linux (15)
Tools (3)
Computer (3)
CS (3)
Game (4)
Internship (4)
i-Phone (6)
Reference (4)

Recent Comment

  • Total17,954
  • Today5
  • Yesterday35
stored procedure 를 여러 번 호출 하다보면 
Command out of sync 에러가 나는 경우가 있음. 

* 저장 프로시져 =  stored procedure  (이하 SP) 

SP 안에 select 문을 여러 개를 넣는 경우를 위하여 제공하는 함수들이 있는데 

여러 SP를 호출 하는 경우 
첫 번째 SP에 select 문이 하나인 경우에도 
뭔가 멍청한 상황이 발생하는 것 


CI 에서는 
system/database/drivers/mysqli/mysqli_driver.php 파일에서
 _excute 함수를 아래와 같이 고쳐서 해결 가능 

  function _execute($sql)
{
$sql = $this->_prep_query($sql);

// This handles stored procedures....
if(stripos($sql,"call") === 0 ) {
@mysqli_multi_query($this->conn_id, $sql);
$result = @mysqli_store_result($this->conn_id);
if (@mysqli_more_results($this->conn_id)) {
@mysqli_next_result($this->conn_id);
}
} else {
$result = @mysqli_query($this->conn_id, $sql);
}
$result = @mysqli_query($this->conn_id, $sql);
return $result;
}


아, 물론, 이렇게 하면 SP 안에 여러 select 문을 넣는 경우 
뒤에 select 문장들이 날아 갈듯 ..... ? 

http://codeigniter.com/forums/viewthread/73714/ 




저작자 표시 비영리 변경 금지

'Programming > PHP' 카테고리의 다른 글

[PHP Codeigniter] 'Command out of sync' ERROR  (0) 2012/01/28
form 에서 $_FILES가 넘어오지 않을때  (0) 2011/03/20
PHP "?:" operator  (0) 2011/01/17
[PEAR] Benchmark_Timer  (0) 2010/11/02
Trackback 0 and Comment 0

prev Prev : [1] : [2] : [3] : [4] : [5] ... : [177] : Next next