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. No Image notice by admin 2024/04/23 by admin
    Views 115 

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

  2. SQLGate for CUBRID 영구 무료 라이선스 제공

  3. 내부 아이피 연결시 접속이 안되는 현상

  4. Spatial Extensions 지원하나요?

  5. 542번글 재질의

  6. MS-SQL 데이타타입/함수비교

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

  8. 데이터베이스 검사시에 에러

  9. cci_execute() 에서 lock이 걸리는 현상

  10. 532번글 답변이 아직 없으셔서 다시 올립니다.

  11. 컬럼 수정이 안됩니다.

  12. 2.0에서 2.1로 업그레이드 하려면?

  13. CUBRID_Setup.sh: No such file or directory설치에러입니다.

  14. 서브쿼리 질문

  15. 큐브리드 매니져에서 정수 쿼리 16진수 표시

  16. 로그 분석 툴 이용시 분석 에러발생합니다.

  17. 오류구문이 뜹니다.

  18. mysql 구문변환

  19. 매니저에 쿼리 오류 메세지가 갑자기 안나옵니다.

  20. data_buffer_page 를 300000 이상으로 늘렸더니

  21. 큐브리드 커넥션 유지 시간

  22. 서브쿼리 ORDERBY_NUM() 최적화 문제

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