@@ -389,8 +389,7 @@ void SHOW_comments(bool force)
389
389
}
390
390
391
391
392
- bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
393
- SCHAR* info_buf,
392
+ void SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
394
393
const UCHAR* db_itemsL,
395
394
unsigned item_length,
396
395
bool translate,
@@ -407,7 +406,6 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
407
406
*
408
407
* Arguments:
409
408
* db_handle -- database handle
410
- * info_buf -- info_bufput file pointer
411
409
* db_itemsL -- list of db_info items to process
412
410
*
413
411
**************************************/
@@ -419,13 +417,10 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
419
417
Firebird::CheckStatusWrapper statusWrapper(status_vector);
420
418
db_handle->getInfo(&statusWrapper, item_length, db_itemsL, sizeof(buffer), buffer);
421
419
if (ISQL_errmsg(status_vector))
422
- return false ;
420
+ return;
423
421
424
422
bool crdatePrinted = false;
425
423
426
- *info_buf = '\0';
427
- SCHAR* info = info_buf;
428
-
429
424
for (Firebird::ClumpletReader p(Firebird::ClumpletReader::InfoResponse, buffer, sizeof(buffer)); !p.isEof(); p.moveNext())
430
425
{
431
426
UCHAR item = p.getClumpTag();
@@ -444,40 +439,40 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
444
439
445
440
case isc_info_page_size:
446
441
value_out = p.getInt();
447
- sprintf(info, "PAGE_SIZE %" SQUADFORMAT"%s", value_out, separator);
442
+ isqlGlob.printf( "PAGE_SIZE %" SQUADFORMAT"%s", value_out, separator);
448
443
break;
449
444
450
445
case isc_info_db_size_in_pages:
451
446
value_out = p.getInt();
452
447
if (translate)
453
448
{
454
449
IUTILS_msg_get(NUMBER_PAGES, msg, SafeArg() << value_out);
455
- sprintf(info, "%s%s", msg, separator);
450
+ isqlGlob.printf( "%s%s", msg, separator);
456
451
}
457
452
else
458
- sprintf(info, "Number of DB pages allocated = %" SQUADFORMAT"%s", value_out, separator);
453
+ isqlGlob.printf( "Number of DB pages allocated = %" SQUADFORMAT"%s", value_out, separator);
459
454
break;
460
455
461
456
case fb_info_pages_used:
462
457
value_out = p.getInt();
463
458
if (translate)
464
459
{
465
460
IUTILS_msg_get(NUMBER_USED_PAGES, msg, SafeArg() << value_out);
466
- sprintf(info, "%s%s", msg, separator);
461
+ isqlGlob.printf( "%s%s", msg, separator);
467
462
}
468
463
else
469
- sprintf(info, "Number of DB pages used = %" SQUADFORMAT"%s", value_out, separator);
464
+ isqlGlob.printf( "Number of DB pages used = %" SQUADFORMAT"%s", value_out, separator);
470
465
break;
471
466
472
467
case fb_info_pages_free:
473
468
value_out = p.getInt();
474
469
if (translate)
475
470
{
476
471
IUTILS_msg_get(NUMBER_FREE_PAGES, msg, SafeArg() << value_out);
477
- sprintf(info, "%s%s", msg, separator);
472
+ isqlGlob.printf( "%s%s", msg, separator);
478
473
}
479
474
else
480
- sprintf(info, "Number of DB pages free = %" SQUADFORMAT"%s", value_out, separator);
475
+ isqlGlob.printf( "Number of DB pages free = %" SQUADFORMAT"%s", value_out, separator);
481
476
break;
482
477
483
478
case fb_info_crypt_state:
@@ -499,11 +494,11 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
499
494
s += msg;
500
495
}
501
496
502
- sprintf(info, "%s%s", s.c_str(), separator);
497
+ isqlGlob.printf( "%s%s", s.c_str(), separator);
503
498
}
504
499
else
505
500
{
506
- sprintf(info, "DB %sencrypted%s%s",
501
+ isqlGlob.printf( "DB %sencrypted%s%s",
507
502
(value_out & fb_info_crypt_encrypted ? "" : "not "),
508
503
(value_out & fb_info_crypt_process ? ", crypt thread not complete" : ""),
509
504
separator);
@@ -515,79 +510,79 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
515
510
if (translate)
516
511
{
517
512
IUTILS_msg_get(SWEEP_INTERV, msg, SafeArg() << value_out);
518
- sprintf(info, "%s%s", msg, separator);
513
+ isqlGlob.printf( "%s%s", msg, separator);
519
514
}
520
515
else
521
- sprintf(info, "Sweep interval = %" SQUADFORMAT"%s", value_out, separator);
516
+ isqlGlob.printf( "Sweep interval = %" SQUADFORMAT"%s", value_out, separator);
522
517
break;
523
518
524
519
case isc_info_forced_writes:
525
520
value_out = p.getInt();
526
- sprintf (info, "Forced Writes are %s%s", (value_out == 1 ? "ON" : "OFF"), separator);
521
+ isqlGlob.printf( "Forced Writes are %s%s", (value_out == 1 ? "ON" : "OFF"), separator);
527
522
break;
528
523
529
524
case isc_info_oldest_transaction :
530
525
value_out = p.getInt();
531
- sprintf(info, "Transaction - oldest = %" SQUADFORMAT"%s", value_out, separator);
526
+ isqlGlob.printf( "Transaction - oldest = %" SQUADFORMAT"%s", value_out, separator);
532
527
break;
533
528
534
529
case isc_info_oldest_active :
535
530
value_out = p.getInt();
536
- sprintf(info, "Transaction - oldest active = %" SQUADFORMAT"%s", value_out, separator);
531
+ isqlGlob.printf( "Transaction - oldest active = %" SQUADFORMAT"%s", value_out, separator);
537
532
break;
538
533
539
534
case isc_info_oldest_snapshot :
540
535
value_out = p.getInt();
541
- sprintf(info, "Transaction - oldest snapshot = %" SQUADFORMAT"%s", value_out, separator);
536
+ isqlGlob.printf( "Transaction - oldest snapshot = %" SQUADFORMAT"%s", value_out, separator);
542
537
break;
543
538
544
539
case isc_info_next_transaction :
545
540
value_out = p.getInt();
546
- sprintf (info, "Transaction - Next = %" SQUADFORMAT"%s", value_out, separator);
541
+ isqlGlob.printf( "Transaction - Next = %" SQUADFORMAT"%s", value_out, separator);
547
542
break;
548
543
549
544
case isc_info_base_level:
550
545
value_out = p.getInt();
551
546
if (translate)
552
547
{
553
548
IUTILS_msg_get(BASE_LEVEL, msg, SafeArg() << value_out);
554
- sprintf(info, "%s%s", msg, separator);
549
+ isqlGlob.printf( "%s%s", msg, separator);
555
550
}
556
551
else
557
- sprintf(info, "Base level = %" SQUADFORMAT"%s", value_out, separator);
552
+ isqlGlob.printf( "Base level = %" SQUADFORMAT"%s", value_out, separator);
558
553
break;
559
554
560
555
case isc_info_limbo:
561
556
value_out = p.getInt();
562
557
if (translate)
563
558
{
564
559
IUTILS_msg_get(LIMBO, msg, SafeArg() << value_out);
565
- sprintf(info, "%s%s", msg, separator);
560
+ isqlGlob.printf( "%s%s", msg, separator);
566
561
}
567
562
else
568
- sprintf(info, "Transaction in limbo = %" SQUADFORMAT"%s", value_out, separator);
563
+ isqlGlob.printf( "Transaction in limbo = %" SQUADFORMAT"%s", value_out, separator);
569
564
break;
570
565
571
566
case isc_info_ods_version:
572
567
isqlGlob.major_ods = p.getInt();
573
568
break;
574
569
case isc_info_ods_minor_version:
575
570
value_out = p.getInt();
576
- sprintf(info, "ODS = %" SLONGFORMAT".%" SQUADFORMAT"%s",
571
+ isqlGlob.printf( "ODS = %" SLONGFORMAT".%" SQUADFORMAT"%s",
577
572
(SLONG) isqlGlob.major_ods, value_out, separator);
578
573
break;
579
574
580
575
case fb_info_wire_crypt:
581
576
if (p.getClumpLength())
582
- sprintf (info, "Wire crypt plugin: %.*s%s", p.getClumpLength(), p.getBytes(), separator);
577
+ isqlGlob.printf( "Wire crypt plugin: %.*s%s", p.getClumpLength(), p.getBytes(), separator);
583
578
break;
584
579
585
580
case fb_info_protocol_version:
586
581
value_out = p.getInt();
587
582
if (value_out)
588
- sprintf(info, "Protocol version = %" SQUADFORMAT"%s", value_out, separator);
583
+ isqlGlob.printf( "Protocol version = %" SQUADFORMAT"%s", value_out, separator);
589
584
else
590
- sprintf(info, "Embedded connection%s", separator);
585
+ isqlGlob.printf( "Embedded connection%s", separator);
591
586
break;
592
587
593
588
case isc_info_creation_date:
@@ -603,7 +598,7 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
603
598
struct tm time;
604
599
isc_decode_timestamp(&ts, &time);
605
600
606
- sprintf(info, "Creation date: %s %d, %d %d:%02d:%02d%s",
601
+ isqlGlob.printf( "Creation date: %s %d, %d %d:%02d:%02d%s",
607
602
FB_SHORT_MONTHS[time.tm_mon], time.tm_mday, time.tm_year + 1900,
608
603
time.tm_hour, time.tm_min, time.tm_sec, separator);
609
604
}
@@ -630,7 +625,7 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
630
625
if (ISQL_errmsg(fbStatus))
631
626
break;
632
627
633
- sprintf(info, "Creation date: %s %d, %d %d:%02d:%02d %s%s",
628
+ isqlGlob.printf( "Creation date: %s %d, %d %d:%02d:%02d %s%s",
634
629
FB_SHORT_MONTHS[month - 1], day, year,
635
630
hours, minutes, seconds, timeZone, separator);
636
631
@@ -647,12 +642,12 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
647
642
const UCHAR* end = s + p.getClumpLength();
648
643
++s; // Skip useless indicator.
649
644
int len = *s++;
650
- printf("DB = %.*s\n", len, s);
645
+ isqlGlob. printf("DB = %.*s\n", len, s);
651
646
s += len;
652
647
while (s < end)
653
648
{
654
649
len = *s++;
655
- printf("Host = %.*s\n", len, s);
650
+ isqlGlob. printf("Host = %.*s\n", len, s);
656
651
s += len;
657
652
}
658
653
}
@@ -667,17 +662,14 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
667
662
(value_out == fb_info_replica_read_only) ? "READ_ONLY" :
668
663
(value_out == fb_info_replica_read_write) ? "READ_WRITE" :
669
664
"unknown";
670
- sprintf(info, "Replica mode: %s%s", mode, separator);
665
+ isqlGlob.printf( "Replica mode: %s%s", mode, separator);
671
666
}
672
667
break;
673
668
674
669
case isc_info_truncated:
675
- return info > info_buf; // If we got some items, we are (partially) successful.
670
+ return;
676
671
}
677
- info += strlen(info);
678
672
}
679
-
680
- return info > info_buf;
681
673
}
682
674
683
675
@@ -3672,15 +3664,11 @@ static void show_db()
3672
3664
return;
3673
3665
END_ERROR;
3674
3666
3675
- SCHAR info_buf[BUFFER_LENGTH512];
3676
-
3677
3667
// First general database parameters
3678
3668
3679
3669
bool translate = true;
3680
3670
3681
- if (SHOW_dbb_parameters(DB, info_buf, db_items, sizeof(db_items), translate, NEWLINE)) {
3682
- isqlGlob.prints(info_buf);
3683
- }
3671
+ SHOW_dbb_parameters(DB, db_items, sizeof(db_items), translate, NEWLINE);
3684
3672
3685
3673
FOR DBB IN RDB$DATABASE
3686
3674
CROSS CS IN RDB$CHARACTER_SETS
0 commit comments