blib/lib/MonetDB/CLI/MapiLib.pm

filter: Statementstmt 26.9% 24 / 89 Branchbran 0.0% 0 / 44 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 31.8% 7 / 22 Podpod 0.0% 0 / 1 totaltotal 19.8% 31 / 156 CC 23 SCAR 21.2
CC
23
Cov
18%
query
20.0
new_handle
20.0
query
12.0
CRAP 8.3
↑ Summary
1 package MonetDB::CLI::MapiLib;
2  
3 3 ▶use MapiLib();
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '0.03';
8  
9  
10 sub connect
11 2 ▶{
Subroutine connect: called CC=3 SCAR=19.2
Pod undocumented
12 2 my ($class, $host, $port, $user, $pass, $lang) = @_;
13  
14 2 ▶ my $h = MapiLib::mapi_connect( $host, $port, $user, $pass, $lang )
Branch: 1 branch
BranchTrueFalseTotal
my $h = MapiLib::mapi_connect($host, $port, $user, $pass, $lang) or die "Handle is undefined" 0 0 0
15 or die 'Handle is undefined';
16 0 ▶ die MapiLib::mapi_error_str( $h )
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($h) 0 0 0
17 if MapiLib::mapi_error( $h );
18 0 bless { h => $h },'MonetDB::CLI::MapiLib::Cxn';
19 }
20  
21  
22 package MonetDB::CLI::MapiLib::Cxn;
23  
24 sub query
25 0 ▶{
Subroutine query: not called CC=4 SCAR=30.0
26 0 my ($self, $statement) = @_;
27  
28 my $h = MapiLib::mapi_query( $self->{h}, $statement )
29 0 ▶ or die 'Handle is undefined ('. MapiLib::mapi_error_str( $self->{h} ) .')';
Branch: 1 branch
BranchTrueFalseTotal
my $h = MapiLib::mapi_query($self->{"h"}, $statement) or die 'Handle is undefined (' . MapiLib::mapi_error_str($self->{"h"}) . ')' 0 0 0
30 0 ▶ die MapiLib::mapi_result_error( $h )
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_result_error($h) 0 0 0
31 if MapiLib::mapi_result_error( $h );
32 die MapiLib::mapi_error_str( $self->{h} )
33 0 ▶ if MapiLib::mapi_error( $self->{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"h"}) 0 0 0
34 0 bless { h => $h, p => $self },'MonetDB::CLI::MapiLib::Req';
35 }
36  
37 sub new_handle
38 0 ▶{
Subroutine new_handle: not called CC=4 SCAR=30.0
39 0 my ($self) = @_;
40  
41 my $h = MapiLib::mapi_new_handle( $self->{h} )
42 0 ▶ or die 'Handle is undefined ('. MapiLib::mapi_error_str( $self->{h} ) .')';
Branch: 1 branch
BranchTrueFalseTotal
my $h = MapiLib::mapi_new_handle($self->{"h"}) or die 'Handle is undefined (' . MapiLib::mapi_error_str($self->{"h"}) . ')' 0 0 0
43 0 ▶ die MapiLib::mapi_result_error( $h )
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_result_error($h) 0 0 0
44 if MapiLib::mapi_result_error( $h );
45 die MapiLib::mapi_error_str( $self->{h} )
46 0 ▶ if MapiLib::mapi_error( $self->{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"h"}) 0 0 0
47 0 bless { h => $h, p => $self },'MonetDB::CLI::MapiLib::Req';
48 }
49  
50 sub DESTROY
51 0 ▶{
Subroutine DESTROY: not called CC=2 SCAR=17.9
52 0 my ($self) = @_;
53  
54 0 MapiLib::mapi_destroy( $self->{h});
55 die MapiLib::mapi_error_str( $self->{h} )
56 0 ▶ if MapiLib::mapi_error( $self->{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"h"}) 0 0 0
57 0 return;
58 }
59  
60  
61 package MonetDB::CLI::MapiLib::Req;
62  
63 sub query
64 0 ▶{
Subroutine query: not called CC=3 SCAR=24.8
65 0 my ($self, $statement) = @_;
66  
67 0 MapiLib::mapi_query_handle( $self->{h}, $statement );
68 die MapiLib::mapi_result_error( $self->{h} )
69 0 ▶ if MapiLib::mapi_result_error( $self->{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_result_error($self->{"h"}) 0 0 0
70 die MapiLib::mapi_error_str( $self->{p}{h} )
71 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
72 0 return;
73 }
74  
75 sub querytype
76 0 ▶{
Subroutine querytype: not called CC=2 SCAR=17.9
77 0 my ($self) = @_;
78  
79 0 my $r = MapiLib::mapi_get_querytype( $self->{h} );
80 die MapiLib::mapi_error_str( $self->{p}{h} )
81 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
82 0 return $r;
83 }
84  
85 sub id
86 0 ▶{
Subroutine id: not called CC=2 SCAR=17.9
87 0 my ($self) = @_;
88  
89 0 my $r = MapiLib::mapi_get_tableid( $self->{h} );
90 die MapiLib::mapi_error_str( $self->{p}{h} )
91 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
92 0 return $r;
93 }
94  
95 sub rows_affected
96 0 ▶{
Subroutine rows_affected: not called CC=2 SCAR=17.9
97 0 my ($self) = @_;
98  
99 0 my $r = MapiLib::mapi_rows_affected( $self->{h} );
100 die MapiLib::mapi_error_str( $self->{p}{h} )
101 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
102 0 return $r;
103 }
104  
105 sub columncount
106 0 ▶{
Subroutine columncount: not called CC=2 SCAR=17.9
107 0 my ($self) = @_;
108  
109 0 my $r = MapiLib::mapi_get_field_count( $self->{h} );
110 die MapiLib::mapi_error_str( $self->{p}{h} )
111 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
112 0 return $r;
113 }
114  
115 sub name
116 0 ▶{
Subroutine name: not called CC=2 SCAR=17.9
117 0 my ($self, $fnr) = @_;
118  
119 0 my $r = MapiLib::mapi_get_name( $self->{h}, $fnr );
120 die MapiLib::mapi_error_str( $self->{p}{h} )
121 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
122 0 return $r;
123 }
124  
125 sub type
126 0 ▶{
Subroutine type: not called CC=2 SCAR=17.9
127 0 my ($self, $fnr) = @_;
128  
129 0 my $r = MapiLib::mapi_get_type( $self->{h}, $fnr );
130 die MapiLib::mapi_error_str( $self->{p}{h} )
131 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
132 0 return $r;
133 }
134  
135 sub length
136 0 ▶{
Subroutine length: not called CC=2 SCAR=17.9
137 0 my ($self, $fnr) = @_;
138  
139 0 my $r = MapiLib::mapi_get_len( $self->{h}, $fnr );
140 die MapiLib::mapi_error_str( $self->{p}{h} )
141 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
142 0 return $r;
143 }
144  
145 sub fetch
146 0 ▶{
Subroutine fetch: not called CC=2 SCAR=17.9
147 0 my ($self) = @_;
148  
149 0 my $r = MapiLib::mapi_fetch_row( $self->{h} );
150 die MapiLib::mapi_error_str( $self->{p}{h} )
151 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
152 0 return $r;
153 }
154  
155 sub field
156 0 ▶{
Subroutine field: not called CC=2 SCAR=17.9
157 0 my ($self, $fnr) = @_;
158  
159 0 my $r = MapiLib::mapi_fetch_field( $self->{h}, $fnr );
160 die MapiLib::mapi_error_str( $self->{p}{h} )
161 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
162 0 return $r;
163 }
164  
165 sub finish
166 0 ▶{
Subroutine finish: not called CC=2 SCAR=17.9
167 0 my ($self) = @_;
168  
169 0 MapiLib::mapi_finish( $self->{h} );
170 die MapiLib::mapi_error_str( $self->{p}{h} )
171 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
172 0 return;
173 }
174  
175 sub DESTROY
176 0 ▶{
Subroutine DESTROY: not called CC=2 SCAR=17.9
177 0 my ($self) = @_;
178  
179 0 MapiLib::mapi_close_handle( $self->{h} );
180 die MapiLib::mapi_error_str( $self->{p}{h} )
181 0 ▶ if MapiLib::mapi_error( $self->{p}{h} );
Branch: 1 branch
BranchTrueFalseTotal
if MapiLib::mapi_error($self->{"p"}{"h"}) 0 0 0
182 0 return;
183 }
184  
185 3 __PACKAGE__;
186  
187 =head1 NAME
188  
189 MonetDB::CLI::MapiLib - MonetDB::CLI implementation, using MapiLib
190  
191 =head1 DESCRIPTION
192  
193 MonetDB::CLI::MapiLib is an implementation of the MonetDB call level interface
194 L<MonetDB::CLI>.
195 It uses the SWIG generated L<MapiLib> - a wrapper module for libMapi.
196 Normally, you don't use this module directly, but let L<MonetDB::CLI>
197 choose an implementation module.
198  
199 =head1 AUTHORS
200  
201 Steffen Goeldner E<lt>sgoeldner@cpan.orgE<gt>.
202  
203 =head1 COPYRIGHT AND LICENCE
204  
205 The contents of this file are subject to the MonetDB Public License
206 Version 1.1 (the "License"); you may not use this file except in
207 compliance with the License. You may obtain a copy of the License at
208 http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
209  
210 Software distributed under the License is distributed on an "AS IS"
211 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
212 License for the specific language governing rights and limitations
213 under the License.
214  
215 The Original Code is the MonetDB Database System.
216  
217 The Initial Developer of the Original Code is CWI.
218 Portions created by CWI are Copyright (C) 1997-2006 CWI.
219 All Rights Reserved.
220  
221 =head1 SEE ALSO
222  
223 =head2 MonetDB
224  
225 Homepage : http://monetdb.cwi.nl
226 SourceForge : http://sourceforge.net/projects/monetdb
227  
228 =head2 Perl modules
229  
230 L<MonetDB::CLI>, L<MapiLib>
231  
232 =cut
↑ Summary