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

    Date2020.04.09 Byadmin Views4475
    read more
  3. 여러개 데이터 한번에 insert 문 수행하는 방법

    Date2014.12.10 Bywhwpdn Views12334
    Read More
  4. 여러행에 걸쳐 있는 데이터를 하나의 행으로 모으는게 가능하나요?

    Date2014.02.03 Bydashbell Views11928
    Read More
  5. 여러행의 로우를 하나의 로우로 나오게 할수 없나요??

    Date2016.08.26 Byrikal Views17164
    Read More
  6. 연결(Connection)을 얻을 수 없습니다. 브로커와 서버의 구동 상태를 점검하십시오. 이 에러가 납니다

    Date2011.06.22 By블루토토 Views13870
    Read More
  7. 연결(Connection)을 얻을 수 없습다. 브로커와 서버의 구동상태를 점검하십시오.

    Date2010.11.18 Bybaeheulk Views11391
    Read More
  8. 연계 시 에러 문의

    Date2016.03.04 Byjoke7 Views8048
    Read More
  9. 연계과정에서 질문드릴게있습니다.

    Date2017.11.16 Byqswaert Views165
    Read More
  10. 연동하는법좀

    Date2010.04.03 Byghkdldjfld Views12451
    Read More
  11. 영문 대소문자 구분

    Date2014.07.24 By헛개수 Views9749
    Read More
  12. 영문검색 시 대소문자 구분 문제

    Date2012.01.25 By재권 Views14811
    Read More
  13. 영상 데이터를 bit varying에 업로드/다운로드 하는 방법점..(cci_api)

    Date2009.09.24 Bypictions Views10592
    Read More
  14. 예약어 LEVEL 문의 드립니다

    Date2014.03.14 By잘될꺼야 Views5910
    Read More
  15. 예약어 관련하여 문의드립니다.

    Date2019.07.23 Byjechoi Views151
    Read More
  16. 예전 버전(8.4.3) 매니저/쿼리브라우저 다운로드 또는 호환버전 알려주세요~

    Date2014.05.08 By땡땡이 Views7440
    Read More
  17. 예전에 큐브리드 ERWIN 연동 글을 보고 문의남깁니다.

    Date2020.04.06 By변상민 Views348
    Read More
  18. 오라클 --> 큐브리드 CMT로 마이그레이션 시 옵션 질문이요~~

    Date2017.07.06 By덴드로비움 Views515
    Read More
  19. 오라클 -> cubrid 마이그레이션 시....

    Date2013.09.10 Byagkim Views10072
    Read More
  20. 오라클 -> 큐브리드 작업중 DB JOB 관련

    Date2015.05.26 By아코 Views9
    Read More
  21. 오라클 ==> cubrid로 마이그레이션 시 데이터 누락

    Date2019.05.23 By도하준빠 Views384
    Read More
  22. 오라클 Encrypt, Decrypt 함수에 해당하는 없나요?

    Date2013.10.11 By아워나 Views12607
    Read More
Board Pagination Prev 1 ... 137 138 139 140 141 142 143 144 145 146 ... 200 Next
/ 200

Contact Cubrid

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