| 2128 | |
| 2129 | |
| 2130 | blb* blb::copy_blob(thread_db* tdbb, const bid* source, bid* destination, |
| 2131 | USHORT bpb_length, const UCHAR* bpb, |
| 2132 | USHORT destPageSpaceID) |
| 2133 | { |
| 2134 | /************************************** |
| 2135 | * |
| 2136 | * c o p y _ b l o b |
| 2137 | * |
| 2138 | ************************************** |
| 2139 | * |
| 2140 | * Functional description |
| 2141 | * Make a copy of an existing blob. |
| 2142 | * |
| 2143 | **************************************/ |
| 2144 | SET_TDBB(tdbb); |
| 2145 | |
| 2146 | Request* request = tdbb->getRequest(); |
| 2147 | jrd_tra* transaction = request ? request->req_transaction : tdbb->getTransaction(); |
| 2148 | blb* input = open2(tdbb, transaction, source, bpb_length, bpb); |
| 2149 | blb* output = create(tdbb, transaction, destination); |
| 2150 | output->blb_sub_type = input->blb_sub_type; |
| 2151 | if (destPageSpaceID) { |
| 2152 | output->blb_pg_space_id = destPageSpaceID; |
| 2153 | } |
| 2154 | |
| 2155 | if (input->blb_flags & BLB_stream) { |
| 2156 | output->blb_flags |= BLB_stream; |
| 2157 | } |
| 2158 | |
| 2159 | HalfStaticArray<UCHAR, 2048> buffer; |
| 2160 | UCHAR* buff = buffer.getBuffer(input->isSegmented() ? |
| 2161 | input->blb_max_segment : |
| 2162 | MIN(input->blb_length, 32768)); |
| 2163 | |
| 2164 | while (true) |
| 2165 | { |
| 2166 | const USHORT length = input->BLB_get_segment(tdbb, buff, buffer.getCapacity()); |
| 2167 | if (input->blb_flags & BLB_eof) { |
| 2168 | break; |
| 2169 | } |
| 2170 | output->BLB_put_segment(tdbb, buff, length); |
| 2171 | } |
| 2172 | |
| 2173 | input->BLB_close(tdbb); |
| 2174 | output->BLB_close(tdbb); |
| 2175 | |
| 2176 | return output; |
| 2177 | } |
| 2178 | |
| 2179 | |
| 2180 | void blb::delete_blob(thread_db* tdbb, ULONG prior_page) |
nothing calls this directly
no test coverage detected