Diff for /loncom/interface/lonmysql.pm between versions 1.36 and 1.41

version 1.36, 2007/03/12 17:10:02 version 1.41, 2019/11/20 18:02:55
Line 751  sub build_table_creation_request { Line 751  sub build_table_creation_request {
         $table_id = &get_new_table_id();          $table_id = &get_new_table_id();
     }      }
     my $tablename = &translate_id($table_id);      my $tablename = &translate_id($table_id);
     &Apache::lonnet::logthis(" hmm $tablename, $table_id, ". $table_des->{'id'});  
     my $request = "CREATE TABLE IF NOT EXISTS ".$tablename." ";      my $request = "CREATE TABLE IF NOT EXISTS ".$tablename." ";
     foreach my $coldata (@{$table_des->{'columns'}}) {      foreach my $coldata (@{$table_des->{'columns'}}) {
         my $column = $coldata->{'name'};          my $column = $coldata->{'name'};
Line 818  sub build_table_creation_request { Line 817  sub build_table_creation_request {
     unless($table_des->{'permanent'} eq 'yes') {      unless($table_des->{'permanent'} eq 'yes') {
         $request.="COMMENT = 'temporary' ";          $request.="COMMENT = 'temporary' ";
     }       } 
     $request .= "TYPE=MYISAM";      $request .= "ENGINE=MYISAM";
     return $request,$table_id;      return $request,$table_id;
 }  }
   
Line 1096  Returns undef on error. Line 1095  Returns undef on error.
 =cut  =cut
   
 ###########################################  ###########################################
   
   ########## Show-Tables Cache
   my $have_read_tables = 0;
   my $dbh_sth;
   ##########
   
 sub tables_in_db {  sub tables_in_db {
     return undef if (!defined(&connect_to_db()));      return undef if (!defined(&connect_to_db()));
     my $sth=$dbh->prepare('SHOW TABLES');      
     $sth->execute();      ########## Show-Tables Cache
     $sth->execute();      if(!$have_read_tables) { 
     my $aref = $sth->fetchall_arrayref;       $dbh_sth=$dbh->prepare('SHOW TABLES');
     if ($sth->err()) {       $have_read_tables = 1;
       }   
       $dbh_sth->execute();
       #$dbh_sth->execute(); # Removed strange execute - from release 119
       ##########    
       
       my $aref = $dbh_sth->fetchall_arrayref;
       if ($dbh_sth->err()) {
         $errorstring =           $errorstring = 
             "$dbh ATTEMPTED:\n".'fetchall_arrayref after SHOW TABLES'.              "$dbh ATTEMPTED:\n".'fetchall_arrayref after SHOW TABLES'.
             "\nRESULTING ERROR:\n".$sth->errstr;              "\nRESULTING ERROR:\n".$dbh_sth->errstr;
         return undef;          return undef;
     }      }
     my @table_list;      my @table_list;
Line 1247  Fixes a table name so that it will work Line 1259  Fixes a table name so that it will work
 sub fix_table_name {  sub fix_table_name {
     my ($name) = @_;      my ($name) = @_;
     $name =~ s/^(\d+[eE]\d+)/_$1/;      $name =~ s/^(\d+[eE]\d+)/_$1/;
       $name =~ s/\W//g;
     return $name;      return $name;
 }  }
   
Line 1275  sub unsqltime { Line 1288  sub unsqltime {
     my $timestamp=shift;      my $timestamp=shift;
     if ($timestamp=~/^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/) {      if ($timestamp=~/^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/) {
         $timestamp=&maketime('year'=>$1,'month'=>$2,'day'=>$3,          $timestamp=&maketime('year'=>$1,'month'=>$2,'day'=>$3,
                              'hours'=>$4,'minutes'=>$5,'seconds'=>$6);                               'hours'=>$4,'minutes'=>$5,'seconds'=>$6,'dlsav'=>-1);
     }      }
     return $timestamp;      return $timestamp;
 }  }

Removed from v.1.36  
changed lines
  Added in v.1.41


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>