Debian Codegraph @

src/modules/app_perl/lib/perl/Kamailio/VDB/Result.pm

raw
1 #
2 # $Id: Result.pm 852 2007-03-01 20:32:37Z bastian $
3 #
4 # Perl module for Kamailio
5 #
6 # Copyright (C) 2006 Collax GmbH
7 # (Bastian Friedrich <[email protected]>)
8 #
9 # This file is part of Kamailio, a free SIP server.
10 #
11 # Kamailio is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version
15 #
16 # Kamailio is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #
25
26 use strict;
27
28 =head2 Kamailio::VDB::Result
29
30 This class represents a VDB result set. It contains a
31 column definition, plus an array of rows.
32 Rows themselves are simply references to arrays of scalars.
33
34 =cut
35
36 package Kamailio::VDB::Result;
37
38 use Kamailio;
39 use Kamailio::VDB::Column;
40
41 our @ISA = qw ( Kamailio::Utils::Debug );
42
43 =head2 new(coldefs,[row, row, ...])
44
45 The constructor creates a new Result object.
46 Its first parameter is a reference to an array of
47 Kamailio::VDB::Column objects.
48 Additional parameters may be passed to provide initial rows, which
49 are references to arrays of scalars.
50
51 =cut
52
53 sub new {
54 my $class = shift;
55 my $coldefs = shift;
56
57 my $self = {};
58
59 bless $self, $class;
60
61 $self->{coldefs} = $coldefs;
62
63 while (@_) {
64 push @{$self->{rows}}, shift;
65 }
66
67 return $self;
68 }
69
70 =head2 coldefs()
71
72 Returns or sets the column definition of the object.
73
74 =cut
75
76 sub coldefs {
77 my $self = shift;
78
79 if (@_) {
80 $self->{coldefs} = shift;
81 }
82
83 return $self->{coldefs};
84 }
85
86 =head2 rows()
87
88 Returns or sets the rows of the object.
89
90 =cut
91
92 sub rows {
93 my $self = shift;
94
95 while (@_) {
96 push @{$self->{rows}}, shift;
97 }
98
99 return $self->{rows};
100 }
101
102 1;