| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MonetDB::CLI::MapiLib; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
95890
|
use MapiLib(); |
|
|
3
|
|
|
3
|
|
15
|
|
|
|
3
|
|
|
|
|
66
|
|
|
|
3
|
|
|
|
|
19
|
|
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
55
|
|
|
4
|
3
|
|
|
3
|
|
14
|
use strict; |
|
|
3
|
|
|
3
|
|
5
|
|
|
|
3
|
|
|
|
|
98
|
|
|
|
3
|
|
|
|
|
26
|
|
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
96
|
|
|
5
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
|
3
|
|
|
3
|
|
11
|
|
|
|
3
|
|
|
|
|
8243
|
|
|
|
3
|
|
|
|
|
16
|
|
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
11521
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub connect |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
2
|
|
|
2
|
0
|
1758
|
my ($class, $host, $port, $user, $pass, $lang) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
0
|
|
|
|
38
|
my $h = MapiLib::mapi_connect( $host, $port, $user, $pass, $lang ) |
|
15
|
|
|
|
|
|
|
or die 'Handle is undefined'; |
|
16
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $h ) |
|
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
|
|
|
|
|
|
|
{ |
|
26
|
0
|
|
|
0
|
|
|
my ($self, $statement) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
my $h = MapiLib::mapi_query( $self->{h}, $statement ) |
|
29
|
|
|
|
|
|
|
or die 'Handle is undefined ('. MapiLib::mapi_error_str( $self->{h} ) .')'; |
|
30
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_result_error( $h ) |
|
31
|
|
|
|
|
|
|
if MapiLib::mapi_result_error( $h ); |
|
32
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{h} ) |
|
33
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{h} ); |
|
34
|
0
|
|
|
|
|
|
bless { h => $h, p => $self },'MonetDB::CLI::MapiLib::Req'; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new_handle |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
my $h = MapiLib::mapi_new_handle( $self->{h} ) |
|
42
|
|
|
|
|
|
|
or die 'Handle is undefined ('. MapiLib::mapi_error_str( $self->{h} ) .')'; |
|
43
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_result_error( $h ) |
|
44
|
|
|
|
|
|
|
if MapiLib::mapi_result_error( $h ); |
|
45
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{h} ) |
|
46
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{h} ); |
|
47
|
0
|
|
|
|
|
|
bless { h => $h, p => $self },'MonetDB::CLI::MapiLib::Req'; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub DESTROY |
|
51
|
|
|
|
|
|
|
{ |
|
52
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
MapiLib::mapi_destroy( $self->{h}); |
|
55
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{h} ) |
|
56
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{h} ); |
|
57
|
0
|
|
|
|
|
|
return; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
package MonetDB::CLI::MapiLib::Req; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub query |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
0
|
|
|
0
|
|
|
my ($self, $statement) = @_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
MapiLib::mapi_query_handle( $self->{h}, $statement ); |
|
68
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_result_error( $self->{h} ) |
|
69
|
|
|
|
|
|
|
if MapiLib::mapi_result_error( $self->{h} ); |
|
70
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
71
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
72
|
0
|
|
|
|
|
|
return; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub querytype |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_get_querytype( $self->{h} ); |
|
80
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
81
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
82
|
0
|
|
|
|
|
|
return $r; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub id |
|
86
|
|
|
|
|
|
|
{ |
|
87
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_get_tableid( $self->{h} ); |
|
90
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
91
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
92
|
0
|
|
|
|
|
|
return $r; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub rows_affected |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_rows_affected( $self->{h} ); |
|
100
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
101
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
102
|
0
|
|
|
|
|
|
return $r; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub columncount |
|
106
|
|
|
|
|
|
|
{ |
|
107
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_get_field_count( $self->{h} ); |
|
110
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
111
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
112
|
0
|
|
|
|
|
|
return $r; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub name |
|
116
|
|
|
|
|
|
|
{ |
|
117
|
0
|
|
|
0
|
|
|
my ($self, $fnr) = @_; |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_get_name( $self->{h}, $fnr ); |
|
120
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
121
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
122
|
0
|
|
|
|
|
|
return $r; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub type |
|
126
|
|
|
|
|
|
|
{ |
|
127
|
0
|
|
|
0
|
|
|
my ($self, $fnr) = @_; |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_get_type( $self->{h}, $fnr ); |
|
130
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
131
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
132
|
0
|
|
|
|
|
|
return $r; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub length |
|
136
|
|
|
|
|
|
|
{ |
|
137
|
0
|
|
|
0
|
|
|
my ($self, $fnr) = @_; |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_get_len( $self->{h}, $fnr ); |
|
140
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
141
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
142
|
0
|
|
|
|
|
|
return $r; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub fetch |
|
146
|
|
|
|
|
|
|
{ |
|
147
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_fetch_row( $self->{h} ); |
|
150
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
151
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
152
|
0
|
|
|
|
|
|
return $r; |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub field |
|
156
|
|
|
|
|
|
|
{ |
|
157
|
0
|
|
|
0
|
|
|
my ($self, $fnr) = @_; |
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
my $r = MapiLib::mapi_fetch_field( $self->{h}, $fnr ); |
|
160
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
161
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
162
|
0
|
|
|
|
|
|
return $r; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub finish |
|
166
|
|
|
|
|
|
|
{ |
|
167
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
MapiLib::mapi_finish( $self->{h} ); |
|
170
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
171
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
172
|
0
|
|
|
|
|
|
return; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub DESTROY |
|
176
|
|
|
|
|
|
|
{ |
|
177
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
178
|
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
MapiLib::mapi_close_handle( $self->{h} ); |
|
180
|
0
|
0
|
|
|
|
|
die MapiLib::mapi_error_str( $self->{p}{h} ) |
|
181
|
|
|
|
|
|
|
if MapiLib::mapi_error( $self->{p}{h} ); |
|
182
|
0
|
|
|
|
|
|
return; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
__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. |
|
195
|
|
|
|
|
|
|
It uses the SWIG generated L - a wrapper module for libMapi. |
|
196
|
|
|
|
|
|
|
Normally, you don't use this module directly, but let L |
|
197
|
|
|
|
|
|
|
choose an implementation module. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 AUTHORS |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Steffen Goeldner Esgoeldner@cpan.orgE. |
|
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, L |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=cut |