Background Image

FORUM

?

단축키

Prev이전 문서

Next다음 문서

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

아래와 같이 처리했는데 업로드가 안됩니다.

업로드/다운로드하는 방법점 갈켜주세요..

pValueBuffer가 데이터 nWriteSize가 크기입니다.
---------------------------------------------------------------------------------------------------------------------------------------------------
영상 업로드

CString strQueryBegin, strQueryEnd;
strQueryBegin.Format("INSERT photo(image) VALUES('");
strQueryEnd.Format("')");

const ULONG nQueryBeginLength  = strQueryBegin.GetLength();
const ULONG nValueLength          = nWriteSize
const ULONG nQueryEndLength    = strQueryEnd.GetLength();
const ULONG nQueryLength          = nQueryBeginLength+nValueLength+nQueryEndLength;

char* pQueryBuffer = new char[nQueryLength+100];

memcpy(pQueryBuffer, strQueryBegin, nQueryBeginLength);
memcpy(pQueryBuffer + nQueryBeginLength, pValueBuffer, nValueLength);
memcpy(pQueryBuffer + (nQueryBeginLength + nValueLength), strQueryEnd, nQueryEndLength);

int nRes = m_dbCubrid.execDML(pQueryBuffer);
---------------------------------------------------------------------------------------------------------------------------------------------------

int execDML(LPCTSTR szSQL)
{
 if( m_conn <= 0 )
 {
  sprintf(m_szBuf, "no open db");
  return -1;
 }

 int req, res;

 // 질의 컴파일을 수행한다.
 if ((req = cci_prepare(m_conn, (char*)szSQL, 0, &m_error)) < 0) {
  // 에러 발생시 에러 코드와 에러메세지등을 출력한다.
  sprintf(m_szBuf, "prepare error[%d] %sn SQL: %sn", m_error.err_code, m_error.err_msg, szSQL);
  // 에러가 발생하였으므로 롤백처리한다
  cci_end_tran(m_conn, CCI_TRAN_ROLLBACK, &m_error);

  return -1;
 }

 // 질의를 수행한다.
 if ((res = cci_execute(req, 0, 0, &m_error)) < 0) {
  sprintf(m_szBuf, "prepare error[%d] %sn SQL: %sn", m_error.err_code, m_error.err_msg, szSQL);
  cci_end_tran(m_conn, CCI_TRAN_ROLLBACK, &m_error);
  return -1;
 }

 // 에러없이 정상 처리되었으므로 커밋 처리한다.
 if (cci_end_tran(m_conn, CCI_TRAN_COMMIT, &m_error) < 0) {
  // 입력중 커밋 에러이므로 알려야 한다.
  sprintf(m_szBuf, "COMMIT ERROR [%d] %sn", m_error.err_code, m_error.err_msg);
  return -1;
 }

 return 0;
}

  • ?
    anonymous 2009.09.25 04:43
    pValueBuffer의 데이터가 binary 라면 string으로 변환하여 SQL로 만들어야 합니다. bit string은 B'0101..' 과 같은 형식으로 이루어져야 합니다. CUBRID  매뉴얼 bit 데이터 타입 부분에 해당 내용이 있습니다.

    데이터의 크기가 크다면 SQL로 변환하여 insert 하는 것은 비효율적입니다. CCI의 bind ( cci_bind() )함수를 사용하시길 권합니다. 


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

    Date2024.04.23 Byadmin Views143915
    read more
  2. windows 2008 64비트에서 큐브리드 매니저 실행이 안되네요

    Date2009.10.15 By지니보이 Views14607
    Read More
  3. cubrid 설치 후 서버 기동 문제

    Date2009.10.13 By너와나 Views14146
    Read More
  4. loaddb 에러 발생.

    Date2009.10.09 By스팅거 Views13737
    Read More
  5. 컴파일 할 때 오류 cannot find -lcurses

    Date2009.10.08 By아주가끔은 Views15094
    Read More
  6. 클라이언트에서 원격지 DB로의 접속이 되지 않습니다...

    Date2009.10.08 By김동진81 Views17752
    Read More
  7. 7.1 -> 2008로 업그레이드 하면 문제가 없을까요?

    Date2009.10.07 By헬리 Views13125
    Read More
  8. db 초보자 입니다. 설치가 않되 질문 합니다.

    Date2009.10.06 Bywatertree Views13066
    Read More
  9. CUBRIDResultSetMetaData 에 관한 질문..

    Date2009.10.06 By눈꽃 Views13277
    Read More
  10. order siblings by 문의

    Date2009.10.06 By유쓰 Views24075
    Read More
  11. CUBRID 2008 R 2.0 은 php모듈이 없나요?

    Date2009.10.06 Byoneorzero Views13332
    Read More
  12. 트리거 delete on 문법 문의

    Date2009.10.05 ByaliveJune Views14101
    Read More
  13. 윈도우에서 백업받은 DB를 리눅스 환경에서 복구 할수 있나요?

    Date2009.10.03 Bynewbie Views15608
    Read More
  14. 현재 큐브리드 7.1 을 사용하고 있는데요

    Date2009.10.01 By헬리 Views13502
    Read More
  15. 테이블 조인 후, 또 정렬 후 결과값들을 게시판 페이징 처리할 때...

    Date2009.10.01 By조상필 Views22255
    Read More
  16. 테이블 컬럼에 COMMENT 추가는 어떻게 하나요?

    Date2009.09.29 By파나순 Views17500
    Read More
  17. 아이콘 활성 유무??

    Date2009.09.29 By차가워여 Views12406
    Read More
  18. cannot communicate with the broker

    Date2009.09.28 By차가워여 Views23235
    Read More
  19. 영상 데이터를 bit varying에 업로드/다운로드 하는 방법점..(cci_api)

    Date2009.09.24 Bypictions Views13595
    Read More
  20. 큐브리드매니저에서 값을 바로 수정하기는 어려운가요?

    Date2009.09.24 By고영진 Views16738
    Read More
  21. 큐브리드매니저에서 데이터 내려받기시 컬럼명 같이 저장기능 추가

    Date2009.09.24 By고영진 Views16054
    Read More
Board Pagination Prev 1 ... 190 191 192 193 194 195 196 197 198 199 ... 213 Next
/ 213

Contact Cubrid

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