Diff for /loncom/interface/lonmysql.pm between versions 1.1 and 1.2

version 1.1, 2002/07/26 16:22:24 version 1.2, 2002/07/28 18:21:13
Line 330  sub disconnect_from_db { Line 330  sub disconnect_from_db {
   
 =pod  =pod
   
 =item &query_table()  =item &number_of_rows()
   
 Currently unimplemented.  Input: table identifier
   
   Returns: the number of rows in the given table.
   
 =cut  =cut
   
 ###############################  ###############################
 sub query_table {   sub number_of_rows { 
     # someday this will work.      my ($table_id) = @_;
       # Update the table information
       my %Table_Info = %{&get_table_info($table_id)};
       # return the number of rows.
       if (defined(%Table_Info)) {
           return $Table_Info{'Rows'};
       }
       return undef;
 }  }
   
   
   
 ###############################  ###############################
   
 =pod  =pod
Line 577  Inputs: $table_id,$condition Line 584  Inputs: $table_id,$condition
   
 Returns: undef on error, an array ref to (array of) results on success.  Returns: undef on error, an array ref to (array of) results on success.
   
 Internally, this function does a 'SELECT * FROM table HAVING $condition'.  Internally, this function does a 'SELECT * FROM table WHERE $condition'.
 $condition = 'id>0' will result in all rows where column 'id' has a value  $condition = 'id>0' will result in all rows where column 'id' has a value
 greater than 0 being returned.  greater than 0 being returned.
   
Line 587  greater than 0 being returned. Line 594  greater than 0 being returned.
 sub get_rows {  sub get_rows {
     my ($table_id,$condition) = @_;      my ($table_id,$condition) = @_;
     my $tablename = &translate_id($table_id);      my $tablename = &translate_id($table_id);
     my $request = 'SELECT * FROM '.$tablename.' HAVING '.$condition;      my $request = 'SELECT * FROM '.$tablename.' WHERE '.$condition;
     my $sth=$dbh->prepare($request);      my $sth=$dbh->prepare($request);
     $sth->execute();      $sth->execute();
     if ($sth->err) {      if ($sth->err) {

Removed from v.1.1  
changed lines
  Added in v.1.2


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