View | Details | Raw Unified | Return to bug 17234
Collapse All | Expand All

(-)a/C4/Installer.pm (+30 lines)
Lines 26-31 use C4::Installer::PerlModules; Link Here
26
use DBI;
26
use DBI;
27
use Koha;
27
use Koha;
28
28
29
use vars qw(@ISA @EXPORT);
30
BEGIN {
31
    require Exporter;
32
    @ISA = qw( Exporter );
33
    push @EXPORT, qw( constraint_exists column_exists );
34
};
35
29
=head1 NAME
36
=head1 NAME
30
37
31
C4::Installer
38
C4::Installer
Lines 491-496 sub get_file_path_from_name { Link Here
491
498
492
}
499
}
493
500
501
sub constraint_exists {
502
    my ( $table_name, $key_name ) = @_;
503
    my $dbh = C4::Context->dbh;
504
    my ($exists) = $dbh->selectrow_array(
505
        qq|
506
        SHOW INDEX FROM $table_name
507
        WHERE key_name = ?
508
        |, undef, $key_name
509
    );
510
    return $exists;
511
}
512
513
sub column_exists {
514
    my ( $table_name, $column_name ) = @_;
515
    my $dbh = C4::Context->dbh;
516
    my ($exists) = $dbh->selectrow_array(
517
        qq|
518
        SHOW COLUMNS FROM $table_name
519
        WHERE Field = ?
520
        |, undef, $column_name
521
    );
522
    return $exists;
523
}
494
524
495
=head1 AUTHOR
525
=head1 AUTHOR
496
526
(-)a/installer/data/mysql/updatedatabase.pl (-26 lines)
Lines 13458-13486 sub CheckVersion { Link Here
13458
    }
13458
    }
13459
}
13459
}
13460
13460
13461
sub constraint_exists {
13462
    my ( $table_name, $key_name ) = @_;
13463
    my $dbh = C4::Context->dbh;
13464
    my ($exists) = $dbh->selectrow_array(
13465
        qq|
13466
        SHOW INDEX FROM $table_name
13467
        WHERE key_name = ?
13468
        |, undef, $key_name
13469
    );
13470
    return $exists;
13471
}
13472
13473
sub column_exists {
13474
    my ( $table_name, $column_name ) = @_;
13475
    my $dbh = C4::Context->dbh;
13476
    my ($exists) = $dbh->selectrow_array(
13477
        qq|
13478
        SHOW COLUMNS FROM $table_name
13479
        WHERE Field = ?
13480
        |, undef, $column_name
13481
    );
13482
    return $exists;
13483
13484
}
13485
13486
exit;
13461
exit;
13487
- 

Return to bug 17234