MapiXS.xs

filter: Statementstmt 0.0% 0 / 66 Branchbran 0.0% 0 / 52 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 118 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/MonetDB/CLI/MapiXS.pm »
1 /*
2 * The contents of this file are subject to the MonetDB Public License
3 * Version 1.1 (the "License"); you may not use this file except in
4 * compliance with the License. You may obtain a copy of the License at
5 * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
6 *
7 * Software distributed under the License is distributed on an "AS IS"
8 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
9 * License for the specific language governing rights and limitations
10 * under the License.
11 *
12 * The Original Code is the MonetDB Database System.
13 *
14 * The Initial Developer of the Original Code is CWI.
15 * Portions created by CWI are Copyright (C) 1997-2006 CWI.
16 * All Rights Reserved.
17 */
18  
19 /*
20  
21 Author: Steffen Goeldner <sgoeldner@cpan.org>
22  
23 */
24  
25 #include "EXTERN.h"
26 #include "perl.h"
27 #include "XSUB.h"
28  
29 #include "MapiXS.h"
30  
31 typedef Mapi MonetDB__CLI__MapiXS__Cxn;
32 typedef MapiHdl MonetDB__CLI__MapiXS__Req;
33  
34 MODULE = MonetDB::CLI::MapiXS PACKAGE = MonetDB::CLI::MapiXS
35  
36 PROTOTYPES: DISABLE
37  
38 MonetDB::CLI::MapiXS::Cxn
39 connect( CLASS, host, port, username, password, lang )
40 const char* CLASS
41 const char* host
42 int port
43 const char* username
44 const char* password
45 const char* lang
46 CODE:
47 0 RETVAL = mapi_connect( host, port, username, password, lang );
48 0 ▶ if ( RETVAL == NULL ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( RETVAL == NULL ) { 0 0 0
49 0 croak("Handle is undefined");
50 }
51 0 ▶ if ( RETVAL->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( RETVAL->error ) { 0 0 0
52 0 croak( RETVAL->errorstr );
53 }
54 OUTPUT:
55 RETVAL
56  
57  
58 MODULE = MonetDB::CLI::MapiXS PACKAGE = MonetDB::CLI::MapiXS::Cxn
59  
60 MonetDB::CLI::MapiXS::Req
61 query( self, statement )
62 MonetDB::CLI::MapiXS::Cxn self
63 const char* statement
64 SV* cxn = ST(0);
65 CODE:
66 0 RETVAL = mapi_query( self, statement );
67 0 ▶ if ( RETVAL == NULL ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( RETVAL == NULL ) { 0 0 0
68 0 croak("Handle is undefined (%s)", self->errorstr );
69 }
70 0 ▶ if ( RETVAL->result && RETVAL->result->errorstr ) {
Branch: 2 branches
BranchTrueFalseTotal
if ( RETVAL->result && RETVAL->result->errorstr ) { 0 0 0
if ( RETVAL->result && RETVAL->result->errorstr ) { 0 0 0
71 0 croak( RETVAL->result->errorstr );
72 }
73 0 ▶ if ( self->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->error ) { 0 0 0
74 0 croak( self->errorstr );
75 }
76 OUTPUT:
77 RETVAL
78 CLEANUP:
79 0 SvPVX ( SvRV( ST(0) ) ) = (char*)cxn;
80 0 SvROK_on( SvRV( ST(0) ) );
81 0 SvREFCNT_inc( cxn );
82  
83 MonetDB::CLI::MapiXS::Req
84 new_handle( self )
85 MonetDB::CLI::MapiXS::Cxn self
86 SV* cxn = ST(0);
87 CODE:
88 0 RETVAL = mapi_new_handle( self );
89 0 ▶ if ( RETVAL == NULL ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( RETVAL == NULL ) { 0 0 0
90 0 croak("Handle is undefined (%s)", self->errorstr );
91 }
92 0 ▶ if ( RETVAL->result && RETVAL->result->errorstr ) {
Branch: 2 branches
BranchTrueFalseTotal
if ( RETVAL->result && RETVAL->result->errorstr ) { 0 0 0
if ( RETVAL->result && RETVAL->result->errorstr ) { 0 0 0
93 0 croak( RETVAL->result->errorstr );
94 }
95 0 ▶ if ( self->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->error ) { 0 0 0
96 0 croak( self->errorstr );
97 }
98 OUTPUT:
99 RETVAL
100 CLEANUP:
101 0 SvPVX ( SvRV( ST(0) ) ) = (char*)cxn;
102 0 SvROK_on( SvRV( ST(0) ) );
103 0 SvREFCNT_inc( cxn );
104  
105 void
106 DESTROY( self )
107 MonetDB::CLI::MapiXS::Cxn self
108 CODE:
109 0 mapi_destroy( self );
110 0 ▶ if ( self->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->error ) { 0 0 0
111 0 croak( self->errorstr );
112 }
113  
114  
115 MODULE = MonetDB::CLI::MapiXS PACKAGE = MonetDB::CLI::MapiXS::Req
116  
117 void
118 query( self, statement )
119 MonetDB::CLI::MapiXS::Req self
120 const char* statement
121 CODE:
122 0 mapi_query_handle( self, statement );
123 0 ▶ if ( self->result && self->result->errorstr ) {
Branch: 2 branches
BranchTrueFalseTotal
if ( self->result && self->result->errorstr ) { 0 0 0
if ( self->result && self->result->errorstr ) { 0 0 0
124 0 croak( self->result->errorstr );
125 }
126 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
127 0 croak( self->mid->errorstr );
128 }
129  
130 int
131 querytype( self )
132 MonetDB::CLI::MapiXS::Req self
133 CODE:
134 0 RETVAL = mapi_get_querytype( self );
135 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
136 0 croak( self->mid->errorstr );
137 }
138 OUTPUT:
139 RETVAL
140  
141 int
142 id( self )
143 MonetDB::CLI::MapiXS::Req self
144 CODE:
145 0 RETVAL = mapi_get_tableid( self );
146 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
147 0 croak( self->mid->errorstr );
148 }
149 OUTPUT:
150 RETVAL
151  
152 int
153 rows_affected( self )
154 MonetDB::CLI::MapiXS::Req self
155 CODE:
156 0 RETVAL = mapi_rows_affected( self );
157 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
158 0 croak( self->mid->errorstr );
159 }
160 OUTPUT:
161 RETVAL
162  
163 int
164 columncount( self )
165 MonetDB::CLI::MapiXS::Req self
166 CODE:
167 0 RETVAL = mapi_get_field_count( self );
168 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
169 0 croak( self->mid->errorstr );
170 }
171 OUTPUT:
172 RETVAL
173  
174 char*
175 name( self, fnr )
176 MonetDB::CLI::MapiXS::Req self
177 int fnr
178 CODE:
179 0 RETVAL = mapi_get_name( self, fnr );
180 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
181 0 croak( self->mid->errorstr );
182 }
183 OUTPUT:
184 RETVAL
185  
186 char*
187 type( self, fnr )
188 MonetDB::CLI::MapiXS::Req self
189 int fnr
190 CODE:
191 0 RETVAL = mapi_get_type( self, fnr );
192 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
193 0 croak( self->mid->errorstr );
194 }
195 OUTPUT:
196 RETVAL
197  
198 int
199 length( self, fnr )
200 MonetDB::CLI::MapiXS::Req self
201 int fnr
202 CODE:
203 0 RETVAL = mapi_get_len( self, fnr );
204 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
205 0 croak( self->mid->errorstr );
206 }
207 OUTPUT:
208 RETVAL
209  
210 int
211 fetch( self )
212 MonetDB::CLI::MapiXS::Req self
213 CODE:
214 0 RETVAL = mapi_fetch_row( self );
215 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
216 0 croak( self->mid->errorstr );
217 }
218 OUTPUT:
219 RETVAL
220  
221 char*
222 field( self, fnr )
223 MonetDB::CLI::MapiXS::Req self
224 int fnr
225 CODE:
226 0 RETVAL = mapi_fetch_field( self, fnr );
227 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
228 0 croak( self->mid->errorstr );
229 }
230 OUTPUT:
231 RETVAL
232  
233 void
234 finish( self )
235 MonetDB::CLI::MapiXS::Req self
236 CODE:
237 0 mapi_finish( self );
238 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
239 0 croak( self->mid->errorstr );
240 }
241  
242 void
243 DESTROY( self )
244 MonetDB::CLI::MapiXS::Req self
245 CODE:
246 0 ▶ if ( mapi_close_handle( self ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( mapi_close_handle( self ) ) { 0 0 0
247 0 ▶ if ( self->mid->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( self->mid->error ) { 0 0 0
248 0 croak( self->mid->errorstr );
249 }
250 }
↑ Summary blib/lib/MonetDB/CLI/MapiXS.pm »