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
    )

     


List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 CUBRID 사용자를 위한 DBeaver 도구 출시 안내 admin 2024.04.23 43
공지 SQLGate for CUBRID 영구 무료 라이선스 제공 file admin 2020.04.09 4458
954 Python Driver connect 함수 실행 시 오류 7 이승환 2018.07.31 962
953 Python Cubrid DB 연동 시 import _cubrid 오류 1 이노무소오파 2023.01.13 148
952 Python 3.9 버전 사용시 Cubrid 접속 불가에 대한 개선 요청 1 오션나인 2021.02.19 231
951 Program 'spacedb' (pid 5835) was connected from the host 'localhost.localdomain' 3 file 도우너19 2022.05.16 158
950 Pro*c 지원 문의 1 secret 파도 2013.07.01 6
949 PreparedStatement.executeBatch에서 일부 데이터의 오류 시 반환 값 문의 2 새옹지마 2023.03.18 341
948 PreparedStatement 변수 바인딩 1 접때그넘 2014.12.06 7827
947 PK값 수정에 대해 1 ohgeumjin 2020.08.19 344
946 PK 생성 질문드립니다. 유니크 인덱스 자동생성이 안되네요? 2 덴드로비움 2017.08.17 2440
945 PHP에서 사용시 문의점 1 완초 2017.10.12 191
944 PHP에서 CUBRID 모듈이 로드 되지 않습니다. 3 유리심장 2011.04.03 15464
943 PHP에서 CUBRID 4.0 모듈이 로드 되지 않습니다. 1 file 유리심장 2011.06.22 11277
942 PHP-Cubrid 연동 오류 (Error: CCI, -16, Cannot connect to CUBRID CAS) 5 cubrid1234 2020.08.10 355
941 PHP-CUBRID 연결: 콘솔에서는 되는데 웹브라우저에서는 실패 1 cubrid1234 2020.08.12 197
940 PHP 클라이어트 모듈 설치시... 2 뿡뿡이당 2010.07.01 8695
939 PHP 커넥션 실패 문의 1 무리링 2011.03.02 9739
938 PHP 인스톨 중 에러입니다. 6 들뿔 2012.03.26 9924
937 PHP 에서 cubrid_connect 실패. 1 별의목소리 2009.02.03 14381
936 PHP 에서 ODBC 를 이용한 접근. 3 ApiClasser 2009.10.16 12319
935 PHP 버젼에 따라.. 값을 인식하지 못하는 현상(?) 3 레드오리 2008.12.24 17693
Board Pagination Prev 1 ... 148 149 150 151 152 153 154 155 156 157 ... 200 Next
/ 200

Contact Cubrid

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