Skip to content

Commit 27b6538

Browse files
committed
Fixed CORE-5355: XpbBuilder fails to create new TPB
1 parent 681789b commit 27b6538

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

examples/interfaces/03.select.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ int main()
4848
// status vector and main dispatcher
4949
ThrowStatusWrapper status(master->getStatus());
5050
IProvider* prov = master->getDispatcher();
51+
IUtil* utl = master->getUtilInterface();
5152

5253
// declare pointers to required interfaces
5354
IAttachment* att = NULL;
5455
ITransaction* tra = NULL;
5556
IStatement* stmt = NULL;
5657
IMessageMetadata* meta = NULL;
5758
IMetadataBuilder* builder = NULL;
59+
IXpbBuilder* tpb = NULL;
5860

5961
// Interface provides access to data returned by SELECT statement
6062
IResultSet* curs = NULL;
@@ -64,8 +66,13 @@ int main()
6466
// attach employee db
6567
att = prov->attachDatabase(&status, "employee", 0, NULL);
6668

67-
// start default transaction
68-
tra = att->startTransaction(&status, 0, NULL);
69+
// start read only transaction
70+
tpb = utl->getXpbBuilder(&status, IXpbBuilder::TPB, NULL, 0);
71+
tpb->insertTag(&status, isc_tpb_read_committed);
72+
tpb->insertTag(&status, isc_tpb_no_rec_version);
73+
tpb->insertTag(&status, isc_tpb_wait);
74+
tpb->insertTag(&status, isc_tpb_read);
75+
tra = att->startTransaction(&status, tpb->getBufferLength(&status), tpb->getBuffer(&status));
6976

7077
// prepare statement
7178
stmt = att->prepare(&status, tra, 0, "select last_name, first_name, phone_ext from phone_list "
@@ -192,6 +199,8 @@ int main()
192199
tra->release();
193200
if (att)
194201
att->release();
202+
if (tpb)
203+
tpb->dispose();
195204

196205
prov->release();
197206
status.dispose();

src/yvalve/utl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ class XpbBuilder FB_FINAL : public DisposeIface<IXpbBuilderImpl<XpbBuilder, Chec
739739
: pb(NULL), strVal(getPool())
740740
{
741741
ClumpletReader::Kind k;
742+
UCHAR tag = 0;
742743
const ClumpletReader::KindList* kl = NULL;
743744

744745
switch(kind)
@@ -754,6 +755,7 @@ class XpbBuilder FB_FINAL : public DisposeIface<IXpbBuilderImpl<XpbBuilder, Chec
754755
break;
755756
case TPB:
756757
k = ClumpletReader::Tpb;
758+
tag = isc_tpb_version3;
757759
break;
758760
default:
759761
fatal_exception::raiseFmt("Wrong parameters block kind %d, should be from %d to %d", kind, DPB, TPB);
@@ -765,7 +767,7 @@ class XpbBuilder FB_FINAL : public DisposeIface<IXpbBuilderImpl<XpbBuilder, Chec
765767
if (kl)
766768
pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), kl, MAX_DPB_SIZE);
767769
else
768-
pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), k, MAX_DPB_SIZE);
770+
pb = FB_NEW_POOL(getPool()) ClumpletWriter(getPool(), k, MAX_DPB_SIZE, tag);
769771
}
770772
else
771773
{

0 commit comments

Comments
 (0)