File Coverage

blib/lib/SQL/Statement/Placeholder.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package SQL::Statement::Placeholder;
2              
3             ######################################################################
4             #
5             # This module is copyright (c), 2009-2017 by Jens Rehsack.
6             # All rights reserved.
7             #
8             # It may be freely distributed under the same terms as Perl itself.
9             # See below for help and copyright information (search for SYNOPSIS).
10             #
11             ######################################################################
12              
13 16     16   57 use strict;
  16         21  
  16         430  
14 16     16   54 use warnings FATAL => "all";
  16         16  
  16         483  
15              
16 16     16   50 use vars qw(@ISA);
  16         15  
  16         447  
17 16     16   56 use Carp ();
  16         22  
  16         166  
18              
19 16     16   53 use SQL::Statement::Term ();
  16         13  
  16         1929  
20              
21             our $VERSION = '1.412';
22              
23             @ISA = qw(SQL::Statement::Term);
24              
25             =pod
26              
27             =head1 NAME
28              
29             SQL::Statement::Placeholder - implements getting the next placeholder value
30              
31             =head1 SYNOPSIS
32              
33             # create an placeholder term with an SQL::Statement object as owner
34             # and the $argnum of the placeholder.
35             my $term = SQL::Statement::Placeholder->new( $owner, $argnum );
36             # access the result of that operation
37             $term->value( $eval );
38              
39             =head1 DESCRIPTION
40              
41             SQL::Statement::Placeholder implements getting the next placeholder value.
42             Accessing a specific placeholder is currently unimplemented and not tested.
43              
44             =head1 INHERITANCE
45              
46             SQL::Statement::Placeholder
47             ISA SQL::Statement::Term
48              
49             =head1 METHODS
50              
51             =head2 new
52              
53             Instantiates a new C instance.
54              
55             =head2 value
56              
57             Returns the value of the next placeholder.
58              
59             =cut
60              
61             sub new
62             {
63 28     28 1 65 my ( $class, $owner, $argnum ) = @_;
64              
65 28         85 my $self = $class->SUPER::new($owner);
66 28         36 $self->{ARGNUM} = $argnum;
67              
68 28         263 return $self;
69             }
70              
71             sub value($)
72             {
73              
74             # from S::S->get_row_value():
75             # my $val = (
76             # $self->{join}
77             # or !$eval
78             # or ref($eval) =~ /Statement$/
79             # ) ? $self->params($arg_num) : $eval->param($arg_num);
80              
81             # let's see where us will lead taking from params every time
82             # XXX later: return $_[0]->{OWNER}->{params}->[$_[0]->{ARGNUM}];
83 107     107 1 189 return $_[0]->{OWNER}->{params}->[ $_[0]->{OWNER}->{argnum}++ ];
84             }
85              
86             =head1 AUTHOR AND COPYRIGHT
87              
88             Copyright (c) 2009-2017 by Jens Rehsack: rehsackATcpan.org
89              
90             All rights reserved.
91              
92             You may distribute this module under the terms of either the GNU
93             General Public License or the Artistic License, as specified in
94             the Perl README file.
95              
96             =cut
97              
98             1;