Background Image

FORUM

조회 수 12924 추천 수 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 Views144054
    read more
  2. 테이블명을 한글로 할 수는 없나요?

    Date2010.02.22 By유니콘 Views17101
    Read More
  3. timestamp 필드 데이터를 다시 timestamp로 변환하기

    Date2010.02.20 Bybyblog Views15425
    Read More
  4. 리눅스상에서 백업파일의 Backup Time을 알수있는 방법이 있나요?

    Date2010.02.19 By럭키늘보 Views12922
    Read More
  5. restoredb 이용한 복구가 제대로 되지 않아요.

    Date2010.02.18 By럭키늘보 Views15805
    Read More
  6. 설치 완료후 phpcubAdmin 에서 페이지 열기가 안됩니다.

    Date2010.02.12 By마루정 Views13104
    Read More
  7. 컴포지션 관련해서 문의 드립니다.

    Date2010.02.12 By野花 Views14929
    Read More
  8. 리눅스 설치 확인 부탁 드립니다.

    Date2010.02.12 ByPhilip Park Views14080
    Read More
  9. // 를 사용하고 싶습니다.

    Date2010.02.10 By죽통군 Views13795
    Read More
  10. 큐브리드 매니저에서 오류

    Date2010.02.10 By초보 Views13455
    Read More
  11. 내부 아이피 연결시 접속이 안되는 현상

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

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

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

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

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

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

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

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

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

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

    Date2010.02.04 By럭키늘보 Views15790
    Read More
Board Pagination Prev 1 ... 181 182 183 184 185 186 187 188 189 190 ... 213 Next
/ 213

Contact Cubrid

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