Bug 17234: Move new subroutines to C4::Installer

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0b15c5e2cc)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Jonathan Druart 2016-09-27 08:28:09 +01:00 committed by Katrin Fischer
parent 70fe225bea
commit a34a60823f
2 changed files with 30 additions and 25 deletions

View File

@ -26,6 +26,13 @@ use C4::Installer::PerlModules;
use DBI;
use Koha;
use vars qw(@ISA @EXPORT);
BEGIN {
require Exporter;
@ISA = qw( Exporter );
push @EXPORT, qw( constraint_exists column_exists );
};
=head1 NAME
C4::Installer
@ -491,6 +498,29 @@ sub get_file_path_from_name {
}
sub constraint_exists {
my ( $table_name, $key_name ) = @_;
my $dbh = C4::Context->dbh;
my ($exists) = $dbh->selectrow_array(
qq|
SHOW INDEX FROM $table_name
WHERE key_name = ?
|, undef, $key_name
);
return $exists;
}
sub column_exists {
my ( $table_name, $column_name ) = @_;
my $dbh = C4::Context->dbh;
my ($exists) = $dbh->selectrow_array(
qq|
SHOW COLUMNS FROM $table_name
WHERE Field = ?
|, undef, $column_name
);
return $exists;
}
=head1 AUTHOR

View File

@ -13885,29 +13885,4 @@ sub CheckVersion {
}
}
sub constraint_exists {
my ( $table_name, $key_name ) = @_;
my $dbh = C4::Context->dbh;
my ($exists) = $dbh->selectrow_array(
qq|
SHOW INDEX FROM $table_name
WHERE key_name = ?
|, undef, $key_name
);
return $exists;
}
sub column_exists {
my ( $table_name, $column_name ) = @_;
my $dbh = C4::Context->dbh;
my ($exists) = $dbh->selectrow_array(
qq|
SHOW COLUMNS FROM $table_name
WHERE Field = ?
|, undef, $column_name
);
return $exists;
}
exit;