1#
2# $Id: Column.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 <bastian.friedrich@collax.com>)
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=head1 Kamailio::VDB::Column
27
28This package represents database column definition, consisting of a
29column name and its data type.
30
31=head2 Stringification
32
33When accessing a Kamailio::VDB::Column object as a string, it simply returns its
34column name regardless of its type.
35=cut
36
37package Kamailio::VDB::Column;
38
39use overload '""' => \&stringify;
40
41sub stringify { shift->{name} }
42
43use Kamailio;
44use Kamailio::Constants;
45
46our @ISA = qw ( Kamailio::Utils::Debug );
47
48=head2 new(type,name)
49
50Constructs a new Column object. Its type and the name are passed as
51parameters.
52
53=cut
54
55sub new {
56	my $class = shift;
57	my $type = shift;
58	my $name = shift;
59
60	my $self = {
61		type => $type,
62		name => $name,
63	};
64
65	bless $self, $class;
66
67	return $self;
68}
69
70
71=head2 type( )
72
73Returns or sets the current type. Please consider using the constants
74from Kamailio::Constants
75
76=cut
77
78sub type {
79	my $self = shift;
80	if (@_) {
81		$self->{type} = shift;
82	}
83
84	return $self->{type};
85}
86
87
88=head2 name()
89
90Returns or sets the current column name.
91
92=cut
93
94sub name {
95	my $self = shift;
96	if (@_) {
97		$self->{name} = shift;
98	}
99
100	return $self->{name};
101}
102
1031;
104