| 233 | } |
| 234 | |
| 235 | void dump(CheckStatusWrapper* status, ISC_QUAD* blobId, IAttachment* att, ITransaction* tra, FILE* file) |
| 236 | { |
| 237 | /************************************** |
| 238 | * |
| 239 | * d u m p |
| 240 | * |
| 241 | ************************************** |
| 242 | * |
| 243 | * Functional description |
| 244 | * Dump a blob into a file. |
| 245 | * |
| 246 | **************************************/ |
| 247 | // Open the blob. If it failed, what the hell -- just return failure |
| 248 | |
| 249 | IBlob* blob = att->openBlob(status, tra, blobId, 0, NULL); |
| 250 | if (status->getState() & Firebird::IStatus::STATE_ERRORS) |
| 251 | return; |
| 252 | |
| 253 | // Copy data from blob to scratch file |
| 254 | |
| 255 | SCHAR buffer[256]; |
| 256 | const SSHORT short_length = sizeof(buffer); |
| 257 | |
| 258 | for (bool cond = true; cond; ) |
| 259 | { |
| 260 | unsigned l = 0; |
| 261 | switch (blob->getSegment(status, short_length, buffer, &l)) |
| 262 | { |
| 263 | case Firebird::IStatus::RESULT_ERROR: |
| 264 | case Firebird::IStatus::RESULT_NO_DATA: |
| 265 | cond = false; |
| 266 | break; |
| 267 | } |
| 268 | |
| 269 | if (l) |
| 270 | FB_UNUSED(fwrite(buffer, 1, l, file)); |
| 271 | } |
| 272 | |
| 273 | // Close the blob |
| 274 | |
| 275 | LocalStatus ls; |
| 276 | CheckStatusWrapper temp(&ls); |
| 277 | blob->close(&temp); |
| 278 | } |
| 279 | |
| 280 | |
| 281 | FB_BOOLEAN edit(CheckStatusWrapper* status, ISC_QUAD* blob_id, IAttachment* att, ITransaction* tra, |
no test coverage detected