mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 00:03:03 +01:00
Fixed bug CORE-4747 : Error "invalid BLOB ID" can occur when retrieving MON$STATEMENTS.MON$SQL_TEXT using ES/EDS and db_connect argument is not specified
This commit is contained in:
parent
7aef528e7f
commit
4307b08fe0
@ -503,9 +503,26 @@ void InternalStatement::doClose(thread_db* tdbb, bool drop)
|
||||
}
|
||||
}
|
||||
|
||||
// We need to copy external blob from\to dynamic statement.
|
||||
// If external blob is permanent one - we could use its blob_id and avoid
|
||||
// copying blob contents into new temporary blob.
|
||||
// If external blob is temporary - we could access it by blob_id only if
|
||||
// dynamic statement is executed in the same transaction as local (caller)
|
||||
// statement.
|
||||
|
||||
static bool isPermanentBlob(const dsc& src)
|
||||
{
|
||||
if (src.isBlob())
|
||||
{
|
||||
const bid* srcBlobID = reinterpret_cast<bid*> (src.dsc_address);
|
||||
return (srcBlobID->bid_internal.bid_relation_id != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InternalStatement::putExtBlob(thread_db* tdbb, dsc& src, dsc& dst)
|
||||
{
|
||||
if (m_transaction->getScope() == traCommon)
|
||||
if (isPermanentBlob(src) || m_transaction->getScope() == traCommon && m_intConnection.isCurrent())
|
||||
MOV_move(tdbb, &src, &dst);
|
||||
else
|
||||
Statement::putExtBlob(tdbb, src, dst);
|
||||
@ -516,7 +533,7 @@ void InternalStatement::getExtBlob(thread_db* tdbb, const dsc& src, dsc& dst)
|
||||
fb_assert(dst.dsc_length == src.dsc_length);
|
||||
fb_assert(dst.dsc_length == sizeof(bid));
|
||||
|
||||
if (m_transaction->getScope() == traCommon)
|
||||
if (isPermanentBlob(src) || m_transaction->getScope() == traCommon && m_intConnection.isCurrent())
|
||||
memcpy(dst.dsc_address, src.dsc_address, sizeof(bid));
|
||||
else
|
||||
Statement::getExtBlob(tdbb, src, dst);
|
||||
|
Loading…
Reference in New Issue
Block a user