Update of /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9606/pkg/comments/OpenInteract2
Modified Files:
Comment.pm
Log Message:
fix small bug in finding count of all comments
Index: Comment.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Comment.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Comment.pm 18 Feb 2004 05:25:24 -0000 1.3
--- Comment.pm 29 Nov 2004 02:58:51 -0000 1.4
***************
*** 43,64 ****
sub count_comments {
my ( $class ) = @_;
! $log ||= get_logger( LOG_APP );
!
! my $sql = 'SELECT COUNT(*) FROM comment';
! my $count = 0;
! my ( $sth );
! eval {
! $sth = $class->global_datasource_handle->prepare( $sql );
! $sth->execute;
};
if ( $@ ) {
$log->warn( "Failed to get total number of comments: $@" );
}
! else {
! ( $count ) = $sth->fetchrow_array;
! $sth->finish;
! }
! return $count;
}
! 1;
\ No newline at end of file
--- 43,60 ----
sub count_comments {
my ( $class ) = @_;
! my $sql = sprintf( 'SELECT COUNT(*) FROM %s', $class->base_table );
! my $row = eval {
! $class->db_select({
! sql => $sql,
! db => $class->global_datasource_handle,
! return => 'single',
! })
};
if ( $@ ) {
+ $log ||= get_logger( LOG_APP );
$log->warn( "Failed to get total number of comments: $@" );
}
! return $row->[0];
}
! 1;
|