[otrs-cvs] Support/Kernel/System/Support/Database mysql.pm, 1.13, 1.14

cvs-log at otrs.org cvs-log at otrs.org
Wed Apr 2 07:58:45 GMT 2008


Comments:
Update of /home/cvs/Support/Kernel/System/Support/Database
In directory lancelot:/tmp/cvs-serv22638/Kernel/System/Support/Database

Modified Files:
	mysql.pm 
Log Message:
* For mysql, we now use the CHECK TABLE statement to check not only whether a table
  exists, but if it is in a usable state, too. 
  If a table is found to be not usable (a.k.a. 'crashed'), you can use the 'REPAIR TABLE' 
  statement to repair it (but you have to do that manually in the mysql client).

Author: ot

Index: mysql.pm
===================================================================
RCS file: /home/cvs/Support/Kernel/System/Support/Database/mysql.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** mysql.pm	22 Nov 2007 13:37:10 -0000	1.13
--- mysql.pm	2 Apr 2008 07:58:39 -0000	1.14
***************
*** 1,5 ****
  # --
  # Kernel/System/Support/Database/mysql.pm - all required system informations
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # Kernel/System/Support/Database/mysql.pm - all required system informations
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
  # --
  # $Id$
***************
*** 7,11 ****
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  # --
  
--- 7,11 ----
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  # --
  
***************
*** 386,405 ****
              my @XMLHash = $Self->{XMLObject}->XMLParse2XMLHash( String => $Content );
  
              for my $Table ( @{ $XMLHash[1]->{database}->[1]->{Table} } ) {
                  if ($Table) {
                      $Count++;
!                     if ( $Self->{DBObject}
!                         ->Prepare( SQL => "select * from $Table->{Name}", Limit => 1 ) )
!                     {
                          while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
                          }
                      }
                      else {
!                         $Message .= "$Table->{Name}, ";
                      }
                  }
              }
!             if ($Message) {
!                 $Message = "Table dosn't exists: $Message";
              }
              else {
--- 386,412 ----
              my @XMLHash = $Self->{XMLObject}->XMLParse2XMLHash( String => $Content );
  
+             my @Problems;
              for my $Table ( @{ $XMLHash[1]->{database}->[1]->{Table} } ) {
                  if ($Table) {
                      $Count++;
! 
!                     # use 'CHECK TABLE'-statement to determine state of each table
!                     # (which may yield several lines per table, the last of which will
!                     # contain the overall state of that table)
!                     if ( $Self->{DBObject}->Prepare( SQL => "CHECK TABLE $Table->{Name}" ) ) {
!                         my $Status;
                          while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
+                             $Status = $Row[3];      # look at field 'Msg_text'
                          }
+                         next if $Status eq 'OK';
+                         push @Problems, $Status;
                      }
                      else {
!                         push @Problems, "unable to check table '$Table->{Name}'";
                      }
                  }
              }
!             if (@Problems) {
!                 $Message = join "\n", @Problems;
              }
              else {


More information about the cvs-log mailing list