代碼 如下:
bool ZzOcciDynaset::blobWrite(Blob* blob,std::stringstream* pIStream)
{
if (blob == NULL || blob->isNull())
{
return false;
}
if (NULL == pIStream)
{
return false;
}
try
{
oracle::occi::Stream* pStream = blob->getStream();
pIStream->seekg(0, std::ios::end);
unsigned long filesize = pIStream->tellg();
pIStream->seekg(0, std::ios::beg);
if (filesize == 0)
{
return false;
}
std::string strbuffer;
strbuffer.resize(1024);
unsigned long totalwritten = 0;
unsigned long amtread = 0;
while(totalwritten != filesize)
{
pIStream->read((char*)(strbuffer.c_str()), 1024);
amtread = pIStream->gcount();
if (amtread == 0)
{
break;
}
程式 掛在這里 :
pStream->writeBuffer((char*)(strbuffer.c_str()),amtread);
totalwritten = totalwritten + amtread;
}
char* c = (char*)"";
pStream->writeLastBuffer(c,0);
blob->closeStream(pStream);
}
catch(oracle::occi::SQLException ex)
{
ZZLOG(eException, "ZzOcciDynaset::blobWrite(Blob* blob,std::stringstream* pIStream) failed!::ErrorCode::" +
CommonData::toString(ex.getErrorCode()) + " failed Mesage:" + ex.getMessage());
return false;
}
catch(...)
{
ZZLOG(eException, "ZzOcciDynaset::blobWrite(Blob* blob,std::stringstream* pIStream) failed!");
return false;
}
return true;
}
uj5u.com熱心網友回復:
自己來頂一下 ,oracle 寫 blob檔案出錯 ,大神求助 !!轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/117709.html
標籤:開發
上一篇:求教sqlldr問題
