| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# DESCRIPTION |
|
3
|
|
|
|
|
|
|
# PerlORM - Object relational mapper (ORM) for Perl. PerlORM is Perl |
|
4
|
|
|
|
|
|
|
# library that implements object-relational mapping. Its features are |
|
5
|
|
|
|
|
|
|
# much similar to those of Java's Hibernate library, but interface is |
|
6
|
|
|
|
|
|
|
# much different and easier to use. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# AUTHOR |
|
9
|
|
|
|
|
|
|
# Alexey V. Akimov |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# COPYRIGHT |
|
12
|
|
|
|
|
|
|
# Copyright (C) 2005-2006 Alexey V. Akimov |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
|
15
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public |
|
16
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
17
|
|
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version. |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
|
20
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
22
|
|
|
|
|
|
|
# Lesser General Public License for more details. |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public |
|
25
|
|
|
|
|
|
|
# License along with this library; if not, write to the Free Software |
|
26
|
|
|
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package ORM::ResultSet; |
|
30
|
|
|
|
|
|
|
|
|
31
|
5
|
|
|
5
|
|
27
|
use ORM; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
1838
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$VERSION = 0.8; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
## |
|
36
|
|
|
|
|
|
|
## CONSTRUCTORS |
|
37
|
|
|
|
|
|
|
## |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
## use: $result_set = ORM::ResultSet->new( class=>string, result=>ORM::DbResultSet ); |
|
40
|
|
|
|
|
|
|
## |
|
41
|
|
|
|
|
|
|
sub new |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
|
44
|
1
|
|
|
|
|
5
|
my %arg = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
7
|
bless { class=>$arg{class}, result=>$arg{result} }, $class; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
## |
|
50
|
|
|
|
|
|
|
## PROPERTIES |
|
51
|
|
|
|
|
|
|
## |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
0
|
0
|
sub class { $_[0]->{class}; } |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub next |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
|
58
|
2
|
|
|
|
|
3
|
my $obj; |
|
59
|
|
|
|
|
|
|
|
|
60
|
2
|
50
|
|
|
|
13
|
if( exists $self->{preview} ) |
|
61
|
|
|
|
|
|
|
{ |
|
62
|
0
|
|
|
|
|
0
|
$obj = $self->{preview}; |
|
63
|
0
|
|
|
|
|
0
|
delete $self->{preview}; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
else |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
2
|
|
66
|
|
|
17
|
my $res = $self->{result} && $self->{result}->next_row; |
|
68
|
|
|
|
|
|
|
|
|
69
|
2
|
100
|
|
|
|
13
|
if( $res ) |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
1
|
|
|
|
|
6
|
$obj = $self->{class}->_cache->get( $res->{id}, 0 ); |
|
72
|
1
|
50
|
|
|
|
6
|
unless( $obj ) |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
1
|
|
|
|
|
6
|
$obj = $self->{class}->_find_constructor( $res, $self->{result}->result_tables ); |
|
75
|
1
|
|
|
|
|
5
|
$self->{class}->_cache->add( $obj ); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
13
|
return $obj; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub preview |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
$self->{preview} = $self->next( @_ ) unless( exists $self->{preview} ); |
|
88
|
0
|
|
|
|
|
|
return $self->{preview}; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub amount |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->{result}->rows; |
|
96
|
|
|
|
|
|
|
} |