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 48 

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

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

  3. Like 문이 의도하지 않은 결과값을 반환합니다.

  4. 한글메세지 출력 방법에 대해서..

  5. 555번 한글테이블 글 올린 사람입니다 (화면캡쳐함)

  6. 저장프로시저 함수-loadjava

  7. group by 오류

  8. 테이블명을 한글로 할 수는 없나요?

  9. timestamp 필드 데이터를 다시 timestamp로 변환하기

  10. 리눅스상에서 백업파일의 Backup Time을 알수있는 방법이 있나요?

  11. restoredb 이용한 복구가 제대로 되지 않아요.

  12. 설치 완료후 phpcubAdmin 에서 페이지 열기가 안됩니다.

  13. 컴포지션 관련해서 문의 드립니다.

  14. 리눅스 설치 확인 부탁 드립니다.

  15. // 를 사용하고 싶습니다.

  16. 큐브리드 매니저에서 오류

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

  18. Spatial Extensions 지원하나요?

  19. 542번글 재질의

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

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

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

Board Pagination Prev 1 ... 168 169 170 171 172 173 174 175 176 177 ... 200 Next
/ 200

Contact Cubrid

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