Background Image

FORUM

조회 수 9628 추천 수 0 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

function sql_prepare($sql, $params)
{
 global $conn;

 $req = cubrid_prepare( $conn, $sql ); //, CUBRID_INCLUDE_OID );
 $i = 1;
 //echo print_r($params)."<Br>";
 foreach ($params as &$p) {
  $res = cubrid_bind($req, $i, $p);
  $i++;
 }
 return $req;
}

$sql = "select * board a, category b where a.code=b.code and a.id = b.id and a.code= ? and a.id not in ( 249,248,247 ) order by num desc, reply asc for orderby_num() between ? and ? ";
$params = Array ( "cool", 0, 35 ) ;

$req = sql_prepare($sql, $params);
cubrid_execute($req);
while ($rs = cubrid_fetch($req))  <========= 이줄에서 오류가 납니다.

오류 메세지 :
Warning: Error: DBMS, -447, An operation has been attempted on a closed query result structure. in c:board.php on line 196 Loading... 

오류메세지 없이 잘 나오는 데이타가 있고 위의 오류가 나오면서 테이타가 나올때가 있습니다 위오류가 무슨오류인지도 궁금하네요

스키마는 다음과 같습니다.
CREATE TABLE "board"(
"id" integer NOT NULL,
"code" character varying(40) DEFAULT  NOT NULL,
"num" integer DEFAULT 0 NOT NULL,
"reply" character varying(20) DEFAULT  NOT NULL,
);

CREATE TABLE "category"(
"ca_id" integer AUTO_INCREMENT PRIMARY KEY,
"code" character varying(20) DEFAULT  NOT NULL,
"id" integer DEFAULT 0 NOT NULL,
"ca_name" character varying(510) DEFAULT  NOT NULL
);
============================================

 
  • ?
    seongjoon 2010.02.05 20:36
    해당 에러 메시지의 닫혀진 resultset에 접근을 하면서 발생한 것입니다.
    $req 변수의 중복 사용이 문제이며,
    $req = sql_prepare($sql, $params);
    cubrid_execute($req);
    while ($rs = cubrid_fetch($req)) 
    에서의 $req를 다른 변수명으로 변경해 보시기 바랍니다.
  • ?
    남재우 2010.02.11 01:19

    안녕하세요.
    답변에 문제가 있어서 죄송합니다. 문의하신 내용을 보니 질의문에 오류가 있습니다. select * from 으로 쓰셔야 합니다. from 이 누락되어 질의에서 에러가 발생한 것이고, 이에 대한 적절한 처리가 없이 진행되다 보니 질의 수행은 당연히 되지 않고 따라서 cubrid_fetch는 수행될 수가 없는 것입니다. 보내주신 소스를 기반으로 from 을 넣고 간단히 테스트해보니 정상적으로 수행됩니다. 따라서 질의에 오타가 있는 것으로 판단됩니다.
    아래는 테스트한 스키마 및 소스입니다.

    create class board (
    code string, id int,
    num int, reply int
    )
    create class category (
    code string, id int)

    insert into board values('cool',1,1,1)
    insert into category values('cool',1)

    select * from board a, category b where a.code=b.code and a.id = b.id and a.code= 'cool'
    and a.id not in ( 249,248,247 ) order by num desc, reply asc for orderby_num() between 0 and 35

    csql 에서 질의 수행결과 아래와 같은 결과가 나옵니다.
    === <Result of SELECT Command in Line 13> ===

      code                           id          num        reply  code                           id
    ================================================================================================
      'cool'                          1            1            1  'cool'                          1


    $sql = "select * from board a, category b where a.code=b.code and a.id = b.id and a.code= ? and a.id not in ( 249,248,247 ) order by num desc, reply asc for orderby_num() between ? and ? ";
    $params = Array ( "cool", 0, 35 ) ;

    $req = sql_prepare($sql, $params);
    cubrid_execute($req);
    while ($rs = cubrid_fetch($req)) {
    print_r($rs);
    }
    cubrid_disconnect($conn);

    위 소스의 실행결과 아래와 같은 결과가 나옵니다.
    $ php t.php
    Array
    (
        [0] => cool
        [code] => cool
        [1] => 1
        [id] => 1
        [2] => 1
        [num] => 1
        [3] => 1
        [reply] => 1
        [4] => cool
        [5] => 1
    )

     


  1. CUBRID 사용자를 위한 DBeaver 도구 출시 안내

    Date2024.04.23 Byadmin Views115
    read more
  2. SQLGate for CUBRID 영구 무료 라이선스 제공

    Date2020.04.09 Byadmin Views4474
    read more
  3. 내부 아이피 연결시 접속이 안되는 현상

    Date2010.02.10 By초보 Views13825
    Read More
  4. Spatial Extensions 지원하나요?

    Date2010.02.09 By온니발란스 Views14299
    Read More
  5. 542번글 재질의

    Date2010.02.09 By초보 Views9780
    Read More
  6. MS-SQL 데이타타입/함수비교

    Date2010.02.09 Bywebdoors Views16577
    Read More
  7. 큐브리드 매니저에 데이타베이스 복구가 비활성화 되어있습니다

    Date2010.02.08 By초보 Views9752
    Read More
  8. 데이터베이스 검사시에 에러

    Date2010.02.08 By천상하늘 Views9637
    Read More
  9. cci_execute() 에서 lock이 걸리는 현상

    Date2010.02.05 By두영 Views10869
    Read More
  10. 532번글 답변이 아직 없으셔서 다시 올립니다.

    Date2010.02.05 By초보 Views9628
    Read More
  11. 컬럼 수정이 안됩니다.

    Date2010.02.04 By초보 Views13021
    Read More
  12. 2.0에서 2.1로 업그레이드 하려면?

    Date2010.02.04 By초보 Views9803
    Read More
  13. CUBRID_Setup.sh: No such file or directory설치에러입니다.

    Date2010.02.04 By럭키늘보 Views12787
    Read More
  14. 서브쿼리 질문

    Date2010.02.03 By초보 Views11332
    Read More
  15. 큐브리드 매니져에서 정수 쿼리 16진수 표시

    Date2010.02.03 By소라게 Views12356
    Read More
  16. 오류구문이 뜹니다.

    Date2010.02.03 By초보 Views8841
    Read More
  17. 로그 분석 툴 이용시 분석 에러발생합니다.

    Date2010.02.03 By노스 Views10753
    Read More
  18. mysql 구문변환

    Date2010.02.03 By초보 Views10478
    Read More
  19. 매니저에 쿼리 오류 메세지가 갑자기 안나옵니다.

    Date2010.02.03 By초보 Views9578
    Read More
  20. data_buffer_page 를 300000 이상으로 늘렸더니

    Date2010.02.02 By초보 Views9996
    Read More
  21. 큐브리드 커넥션 유지 시간

    Date2010.02.02 By초보 Views10219
    Read More
  22. 서브쿼리 ORDERBY_NUM() 최적화 문제

    Date2010.01.29 Byasteroid Views13998
    Read More
Board Pagination Prev 1 ... 169 170 171 172 173 174 175 176 177 178 ... 200 Next
/ 200

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales