MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / buildPrepareInfo

Method buildPrepareInfo

src/yvalve/DistributedTransaction.cpp:92–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90};
91
92bool DTransaction::buildPrepareInfo(CheckStatusWrapper* status, TdrBuffer& tdr, ITransaction* from)
93{
94 // Information items for two phase commit.
95 static const UCHAR PREPARE_TR_INFO[] =
96 {
97 fb_info_tra_dbpath,
98 isc_info_tra_id,
99 isc_info_end
100 };
101
102 Array<UCHAR> bigBuffer;
103 // we need something really big here
104 // output of chaining distributed transaction can be huge
105 // limit MAX_SSHORT is chosen cause for old API larger buffer cause problems
106 UCHAR* buf = bigBuffer.getBuffer(MAX_SSHORT);
107 from->getInfo(status, sizeof(PREPARE_TR_INFO), PREPARE_TR_INFO, bigBuffer.getCount(), buf);
108 if (status->getState() & IStatus::STATE_ERRORS)
109 return false;
110
111 for (ClumpletReader p(ClumpletReader::InfoResponse, buf, bigBuffer.getCount()); !p.isEof(); p.moveNext())
112 {
113 const USHORT length = (USHORT) p.getClumpLength();
114 // Prevent information out of sync.
115 UCHAR lengthByte = length > MAX_UCHAR ? MAX_UCHAR : length;
116
117 switch(p.getClumpTag())
118 {
119 case isc_info_tra_id:
120 tdr.add(TDR_TRANSACTION_ID);
121 tdr.add(lengthByte);
122 tdr.add(p.getBytes(), lengthByte);
123 break;
124
125 case fb_info_tra_dbpath:
126 tdr.add(TDR_DATABASE_PATH);
127 tdr.add(lengthByte);
128 tdr.add(p.getBytes(), lengthByte);
129 break;
130 }
131 }
132
133 return true;
134}
135
136bool DTransaction::prepareCommit(CheckStatusWrapper* status, TdrBuffer& tdr)
137{

Callers

nothing calls this directly

Calls 10

getClumpLengthMethod · 0.80
getClumpTagMethod · 0.80
getBufferMethod · 0.45
getInfoMethod · 0.45
getCountMethod · 0.45
getStateMethod · 0.45
isEofMethod · 0.45
moveNextMethod · 0.45
addMethod · 0.45
getBytesMethod · 0.45

Tested by

no test coverage detected