@@ -67,8 +67,23 @@ around 'attrs' => sub {
67
67
my $symbol = ' &' . $method ;
68
68
$stash -> add_symbol(
69
69
$symbol => sub {
70
- my $self = shift ;
71
- return $self -> dbh-> $method (@_ );
70
+ my $self = shift ;
71
+ my $wantarray = wantarray ;
72
+ my $result = eval {
73
+ if ($wantarray ) {
74
+ [$self -> dbh-> $method (@_ )];
75
+ }
76
+ else {
77
+ [scalar $self -> dbh-> $method (@_ )];
78
+ }
79
+ };
80
+ if (not defined $result ) {
81
+ my $err = $@ ;
82
+ Carp::confess($err );
83
+ }
84
+ else {
85
+ return $wantarray ? @$result : $result -> [0];
86
+ }
72
87
}
73
88
);
74
89
}
@@ -511,8 +526,8 @@ sub bz_server_version {
511
526
sub bz_last_key {
512
527
my ($self , $table , $column ) = @_ ;
513
528
514
- return $self -> last_insert_id(Bugzilla-> localconfig-> db_name,
515
- undef , $table , $column );
529
+ return $self -> last_insert_id(Bugzilla-> localconfig-> db_name, undef , $table ,
530
+ $column );
516
531
}
517
532
518
533
sub bz_check_regexp {
@@ -579,7 +594,7 @@ sub bz_setup_foreign_keys {
579
594
# so if it doesn't have them, then we're setting up FKs
580
595
# for the first time, and should be quieter about it.
581
596
my $activity_fk = $self -> bz_fk_info(' profiles_activity' , ' userid' );
582
- my $any_fks = $activity_fk && $activity_fk -> {created };
597
+ my $any_fks = $activity_fk && $activity_fk -> {created };
583
598
if (!$any_fks ) {
584
599
print get_text(' install_fk_setup' ), " \n " ;
585
600
}
0 commit comments