| 425 | } |
| 426 | |
| 427 | void UtilInterface::getFbVersion(CheckStatusWrapper* status, IAttachment* att, |
| 428 | IVersionCallback* callback) |
| 429 | { |
| 430 | /************************************** |
| 431 | * |
| 432 | * g d s _ $ v e r s i o n |
| 433 | * |
| 434 | ************************************** |
| 435 | * |
| 436 | * Functional description |
| 437 | * Obtain and print information about a database. |
| 438 | * |
| 439 | **************************************/ |
| 440 | try |
| 441 | { |
| 442 | if (!att) |
| 443 | Arg::Gds(isc_bad_db_handle).raise(); |
| 444 | |
| 445 | UCharBuffer buffer; |
| 446 | USHORT buf_len = 256; |
| 447 | UCHAR* buf = buffer.getBuffer(buf_len); |
| 448 | |
| 449 | const TEXT* versions = 0; |
| 450 | const TEXT* implementations = 0; |
| 451 | const UCHAR* dbis = NULL; |
| 452 | bool redo; |
| 453 | |
| 454 | do |
| 455 | { |
| 456 | att->getInfo(status, sizeof(info), info, buf_len, buf); |
| 457 | if (status->getState() & Firebird::IStatus::STATE_ERRORS) |
| 458 | return; |
| 459 | |
| 460 | ClumpletReader p(ClumpletReader::InfoResponse, buf, buf_len); |
| 461 | |
| 462 | for (redo = false; !(redo || p.isEof()); p.moveNext()) |
| 463 | { |
| 464 | switch (p.getClumpTag()) |
| 465 | { |
| 466 | case isc_info_firebird_version: |
| 467 | versions = (TEXT*) p.getBytes(); |
| 468 | break; |
| 469 | |
| 470 | case isc_info_implementation: |
| 471 | implementations = (TEXT*) p.getBytes(); |
| 472 | break; |
| 473 | |
| 474 | case fb_info_implementation: |
| 475 | dbis = p.getBytes(); |
| 476 | if (dbis[0] * 6u + 1u > p.getClumpLength()) |
| 477 | { |
| 478 | // fb_info_implementation value appears incorrect |
| 479 | dbis = NULL; |
| 480 | } |
| 481 | break; |
| 482 | |
| 483 | case isc_info_error: |
| 484 | // old server does not understand fb_info_implementation |
no test coverage detected