File Coverage

blib/lib/DBIx/Roles/StoredProcedures.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 3 0.0
total 17 20 85.0


line stmt bran cond sub pod time code
1             # $Id: StoredProcedures.pm,v 1.1.1.1 2005/11/20 18:01:06 dk Exp $
2              
3             package DBIx::Roles::StoredProcedures;
4              
5 1     1   4 use strict;
  1         2  
  1         30  
6 1     1   4 use vars qw($VERSION);
  1         2  
  1         209  
7              
8             $VERSION = '1.00';
9              
10             sub initialize
11             {
12 3     3 0 12 return undef, undef, qw(call_function);
13             }
14              
15             sub call_function
16             {
17 2     2 0 6 my ( $self, $storage, $function, @params) = @_;
18            
19 1         15 return $self-> selectrow_array(
20             "SELECT $function (".
21 2         25 join(',', map { '?' } @params) .
22             ")",
23             {},
24             @params
25             );
26             }
27              
28             # XXX any() is greedy here, but checking whether there is a corresponding stored procedure
29             # takes intimate knowledge about the particular DBD driver, so we leave that for now
30             sub any
31             {
32 2     2 0 6 my ( $self, $storage, $method, @params) = @_;
33              
34 2         10 return call_function( $self, $storage, $method, @params);
35             }
36              
37             1;
38              
39             __DATA__