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 Views115
    read more
  2. SQLGate for CUBRID 영구 무료 라이선스 제공

    Date2020.04.09 Byadmin Views4474
    read more
  3. CUBRID 2008 R 2.0 은 php모듈이 없나요?

    Date2009.10.06 Byoneorzero Views9838
    Read More
  4. 트리거 delete on 문법 문의

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

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

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

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

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

    Date2009.09.29 By차가워여 Views9256
    Read More
  10. cannot communicate with the broker

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

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

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

    Date2009.09.24 By고영진 Views12894
    Read More
  14. 큐브리드매니저의 아이콘 개선 요청

    Date2009.09.24 By고영진 Views11361
    Read More
  15. 큐브리드매니저에서 NULL값과 문자속성의 빈값을 구분하여 표시 필요

    Date2009.09.23 By고영진 Views14594
    Read More
  16. 큐브리드2008R2.0 설치 후 매니저에서 로그인시 발생하는 오류

    Date2009.09.23 By고영진 Views10127
    Read More
  17. 한글 깨짐

    Date2009.09.23 By짱똘 Views16784
    Read More
  18. Exception in thread "Thread-10" java.lang.NullPointerException

    Date2009.09.23 By김동진81 Views19818
    Read More
  19. cubrid manager 질의기능 중,,,,

    Date2009.09.22 By라솔 Views8880
    Read More
  20. php모듈 인식문제..

    Date2009.09.22 By호짱 Views9177
    Read More
  21. HA,64bit가 적용된 R2.0 에 대한 질문입니다.

    Date2009.09.19 By웃음이 Views18793
    Read More
  22. 질의 편집기로 부질의 유도테이블 쿼리실행에 대해

    Date2009.09.17 ByChans Views10503
    Read More
Board Pagination Prev 1 ... 178 179 180 181 182 183 184 185 186 187 ... 200 Next
/ 200

Contact Cubrid

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