代码 如下:
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;
}
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;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货