Rework writing to blob
This commit is contained in:
parent
c092e8fa8f
commit
ba94fe6d99
@ -202,15 +202,22 @@ FB_UDR_EXECUTE_FUNCTION
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
att.reset(context->getAttachment(status));
|
||||
tra.reset(context->getTransaction(status));
|
||||
|
||||
// This is wrong - the calling application should pass in a blob handle
|
||||
AutoRelease<IBlob> Blob(att->createBlob(status, tra, &in->ablob, 0, nullptr));
|
||||
//AutoRelease<IBlob> Blob(att->openBlob(status, tra, &in->ablob, 0, nullptr));
|
||||
Blob.reset(att->openBlob(status, tra, &in->ablob, 0, nullptr));
|
||||
|
||||
if (Blob == nullptr) {
|
||||
out->result = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
vector<char> Buffer (MaxSegmentSize, 0);
|
||||
streamsize DataSize;
|
||||
std::vector<char> Buffer (MaxSegmentSize, 0);
|
||||
std::streamsize DataSize;
|
||||
|
||||
while ( FileReader.good() ) {
|
||||
FileReader.read( Buffer.data(), Buffer.size() );
|
||||
@ -227,12 +234,17 @@ FB_UDR_EXECUTE_FUNCTION
|
||||
// Should we reset result to 0?
|
||||
|
||||
}
|
||||
|
||||
Blob->close( status );
|
||||
Blob->release();
|
||||
|
||||
Buffer.clear();
|
||||
File.close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw std::runtime_error("Error writing stream to BLOB.");
|
||||
}
|
||||
|
||||
FileReader.close();
|
||||
out->result = 1;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user