8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:43:02 +01:00

Frontported fix for CORE-5355: XpbBuilder fails to create new TPB

This commit is contained in:
AlexPeshkoff 2016-09-22 14:55:20 +03:00
parent c98ca99ce2
commit 10a4cded1a
2 changed files with 14 additions and 3 deletions

View File

@ -48,6 +48,7 @@ int main()
// status vector and main dispatcher // status vector and main dispatcher
ThrowStatusWrapper status(master->getStatus()); ThrowStatusWrapper status(master->getStatus());
IProvider* prov = master->getDispatcher(); IProvider* prov = master->getDispatcher();
IUtil* utl = master->getUtilInterface();
// declare pointers to required interfaces // declare pointers to required interfaces
IAttachment* att = NULL; IAttachment* att = NULL;
@ -55,6 +56,7 @@ int main()
IStatement* stmt = NULL; IStatement* stmt = NULL;
IMessageMetadata* meta = NULL; IMessageMetadata* meta = NULL;
IMetadataBuilder* builder = NULL; IMetadataBuilder* builder = NULL;
IXpbBuilder* tpb = NULL;
// Interface provides access to data returned by SELECT statement // Interface provides access to data returned by SELECT statement
IResultSet* curs = NULL; IResultSet* curs = NULL;
@ -64,8 +66,13 @@ int main()
// attach employee db // attach employee db
att = prov->attachDatabase(&status, "employee", 0, NULL); att = prov->attachDatabase(&status, "employee", 0, NULL);
// start default transaction // start read only transaction
tra = att->startTransaction(&status, 0, NULL); tpb = utl->getXpbBuilder(&status, IXpbBuilder::TPB, NULL, 0);
tpb->insertTag(&status, isc_tpb_read_committed);
tpb->insertTag(&status, isc_tpb_no_rec_version);
tpb->insertTag(&status, isc_tpb_wait);
tpb->insertTag(&status, isc_tpb_read);
tra = att->startTransaction(&status, tpb->getBufferLength(&status), tpb->getBuffer(&status));
// prepare statement // prepare statement
stmt = att->prepare(&status, tra, 0, "select last_name, first_name, phone_ext from phone_list " stmt = att->prepare(&status, tra, 0, "select last_name, first_name, phone_ext from phone_list "
@ -192,6 +199,8 @@ int main()
tra->release(); tra->release();
if (att) if (att)
att->release(); att->release();
if (tpb)
tpb->dispose();
prov->release(); prov->release();
status.dispose(); status.dispose();

View File

@ -739,6 +739,7 @@ public:
: pb(NULL), strVal(getPool()) : pb(NULL), strVal(getPool())
{ {
ClumpletReader::Kind k; ClumpletReader::Kind k;
UCHAR tag = 0;
const ClumpletReader::KindList* kl = NULL; const ClumpletReader::KindList* kl = NULL;
switch(kind) switch(kind)
@ -754,6 +755,7 @@ public:
break; break;
case TPB: case TPB:
k = ClumpletReader::Tpb; k = ClumpletReader::Tpb;
tag = isc_tpb_version3;
break; break;
default: default:
fatal_exception::raiseFmt("Wrong parameters block kind %d, should be from %d to %d", kind, DPB, TPB); fatal_exception::raiseFmt("Wrong parameters block kind %d, should be from %d to %d", kind, DPB, TPB);
@ -765,7 +767,7 @@ public:
if (kl) if (kl)
pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), kl, MAX_DPB_SIZE); pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), kl, MAX_DPB_SIZE);
else else
pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), k, MAX_DPB_SIZE); pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), k, MAX_DPB_SIZE, tag);
} }
else else
{ {