Lines 30-36
use vars qw(@ISA @EXPORT);
Link Here
|
30 |
BEGIN { |
30 |
BEGIN { |
31 |
require Exporter; |
31 |
require Exporter; |
32 |
@ISA = qw( Exporter ); |
32 |
@ISA = qw( Exporter ); |
33 |
push @EXPORT, qw( foreign_key_exists index_exists column_exists ); |
33 |
push @EXPORT, qw( foreign_key_exists index_exists column_exists TableExists); |
34 |
}; |
34 |
}; |
35 |
|
35 |
|
36 |
=head1 NAME |
36 |
=head1 NAME |
Lines 527-532
sub index_exists {
Link Here
|
527 |
|
527 |
|
528 |
sub column_exists { |
528 |
sub column_exists { |
529 |
my ( $table_name, $column_name ) = @_; |
529 |
my ( $table_name, $column_name ) = @_; |
|
|
530 |
return unless TableExists($table_name); |
530 |
my $dbh = C4::Context->dbh; |
531 |
my $dbh = C4::Context->dbh; |
531 |
my ($exists) = $dbh->selectrow_array( |
532 |
my ($exists) = $dbh->selectrow_array( |
532 |
qq| |
533 |
qq| |
Lines 537-542
sub column_exists {
Link Here
|
537 |
return $exists; |
538 |
return $exists; |
538 |
} |
539 |
} |
539 |
|
540 |
|
|
|
541 |
sub TableExists { # Could be renamed table_exists for consistency |
542 |
my $table = shift; |
543 |
eval { |
544 |
my $dbh = C4::Context->dbh; |
545 |
local $dbh->{PrintError} = 0; |
546 |
local $dbh->{RaiseError} = 1; |
547 |
$dbh->do(qq{SELECT * FROM $table WHERE 1 = 0 }); |
548 |
}; |
549 |
return 1 unless $@; |
550 |
return 0; |
551 |
} |
552 |
|
553 |
|
540 |
=head1 AUTHOR |
554 |
=head1 AUTHOR |
541 |
|
555 |
|
542 |
C4::Installer is a refactoring of logic originally from installer/installer.pl, which was |
556 |
C4::Installer is a refactoring of logic originally from installer/installer.pl, which was |