| 90 | }; |
| 91 | |
| 92 | bool 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 | |
| 136 | bool DTransaction::prepareCommit(CheckStatusWrapper* status, TdrBuffer& tdr) |
| 137 | { |
nothing calls this directly
no test coverage detected