- Timestamp:
- 03/17/15 18:31:05 (9 years ago)
- Location:
- branches/4.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0
-
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r1135 r1284 637 637 } 638 638 639 sub getobjectlogs { 640 my ($self, $otype, $name) = @_; 641 642 my $sth = $self->db->prepare(q{ 643 select ikey from objectslogs where 644 otype = ? and 645 name = ? 646 group by ikey 647 }); 648 $sth->execute($otype, $name); 649 my @ids; 650 while (my $res = $sth->fetchrow_hashref) { 651 push(@ids, $res->{ikey}); 652 } 653 @ids or return; 654 655 my $sth2 = $self->db->prepare(sprintf( 656 q{ 657 select * from objectslogs where ikey IN (%s) 658 order by logdate asc 659 }, 660 join(',', ('?') x scalar(@ids)) 661 )); 662 663 $sth2->execute(@ids); 664 my @logs; 665 while (my $res = $sth2->fetchrow_hashref) { 666 push(@logs, $res); 667 } 668 669 return @logs; 670 } 671 672 sub getlogs { 673 my ($self) = @_; 674 my $sth2 = $self->db->prepare( 675 q{ 676 select * from objectslogs 677 where logdate > now() - '1 year'::interval 678 order by logdate asc 679 }, 680 ); 681 682 $sth2->execute(); 683 my @logs; 684 while (my $res = $sth2->fetchrow_hashref) { 685 push(@logs, $res); 686 } 687 688 return @logs; 689 } 690 639 691 1; 640 692
Note: See TracChangeset
for help on using the changeset viewer.