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 488-493 sub get_file_path_from_name { Link Here
488
495
489
}
496
}
490
497
498
sub constraint_exists {
499
    my ( $table_name, $key_name ) = @_;
500
    my $dbh = C4::Context->dbh;
501
    my ($exists) = $dbh->selectrow_array(
502
        qq|
503
        SHOW INDEX FROM $table_name
504
        WHERE key_name = ?
505
        |, undef, $key_name
506
    );
507
    return $exists;
508
}
509
510
sub column_exists {
511
    my ( $table_name, $column_name ) = @_;
512
    my $dbh = C4::Context->dbh;
513
    my ($exists) = $dbh->selectrow_array(
514
        qq|
515
        SHOW COLUMNS FROM $table_name
516
        WHERE Field = ?
517
        |, undef, $column_name
518
    );
519
    return $exists;
520
}
491
521
492
=head1 AUTHOR
522
=head1 AUTHOR
493
523
(-)a/installer/data/mysql/updatedatabase.pl (-26 lines)
Lines 13192-13220 sub CheckVersion { Link Here
13192
    }
13192
    }
13193
}
13193
}
13194
13194
13195
sub constraint_exists {
13196
    my ( $table_name, $key_name ) = @_;
13197
    my $dbh = C4::Context->dbh;
13198
    my ($exists) = $dbh->selectrow_array(
13199
        qq|
13200
        SHOW INDEX FROM $table_name
13201
        WHERE key_name = ?
13202
        |, undef, $key_name
13203
    );
13204
    return $exists;
13205
}
13206
13207
sub column_exists {
13208
    my ( $table_name, $column_name ) = @_;
13209
    my $dbh = C4::Context->dbh;
13210
    my ($exists) = $dbh->selectrow_array(
13211
        qq|
13212
        SHOW COLUMNS FROM $table_name
13213
        WHERE Field = ?
13214
        |, undef, $column_name
13215
    );
13216
    return $exists;
13217
13218
}
13219
13220
exit;
13195
exit;
13221
- 

Return to bug 17234