| 1 |
|
| # $Id$ |
| 2 |
|
| # Copyright (c) 2024-2026 DBI Team |
| 3 |
|
| # Copyright (c) 1997-2024 Tim Bunce Ireland |
| 4 |
|
| # Copyright (c) 2002 Jonathan Leffler |
| 5 |
|
| # |
| 6 |
|
| # You may distribute under the terms of either the GNU General Public |
| 7 |
|
| # License or the Artistic License, as specified in the Perl README file. |
| 8 |
|
| |
| 9 |
|
| |
| 10 |
|
| #include "Driver_xst.h" |
| 11 |
|
| |
| 12 |
|
| # Historically dbd_db_do4, dbd_st_execute, and dbd_st_rows returned an 'int' type. |
| 13 |
|
| # That's only 32 bits (31+sign) so isn't sufficient for very large row counts |
| 14 |
|
| # So now instead of defining those macros, drivers can define dbd_db_do4_iv, |
| 15 |
|
| # dbd_st_execute_iv, and dbd_st_rows_iv to be the names of functions that |
| 16 |
|
| # return an 'IV' type. They could also set DBIc_ROW_COUNT(imp_sth). |
| 17 |
|
| # |
| 18 |
|
| # To save a mess of #ifdef's we arrange for dbd_st_execute (etc) to work |
| 19 |
|
| # as dbd_st_execute_iv if that's defined |
| 20 |
|
| # |
| 21 |
|
| #if defined(dbd_st_execute_iv) |
| 22 |
|
| #undef dbd_st_execute |
| 23 |
|
| #define dbd_st_execute dbd_st_execute_iv |
| 24 |
|
| #endif |
| 25 |
|
| #if defined(dbd_st_rows_iv) |
| 26 |
|
| #undef dbd_st_rows |
| 27 |
|
| #define dbd_st_rows dbd_st_rows_iv |
| 28 |
|
| #endif |
| 29 |
|
| #if defined(dbd_db_do4_iv) |
| 30 |
|
| #undef dbd_db_do4 |
| 31 |
|
| #define dbd_db_do4 dbd_db_do4_iv |
| 32 |
|
| #endif |
| 33 |
|
| |
| 34 |
|
| MODULE = DBD::Perl PACKAGE = DBD::Perl |
| 35 |
|
| |
| 36 |
|
| REQUIRE: 1.929 |
| 37 |
|
| PROTOTYPES: DISABLE |
| 38 |
|
| |
| 39 |
|
| BOOT: |
| 40 |
|
| PERL_UNUSED_VAR(items); |
| 41 |
0 |
▶ | DBISTATE_INIT; |
Branch: 1 branch
| Branch | True | False | Total |
| DBISTATE_INIT; |
0 |
0 |
0 |
|
| 42 |
|
| /* XXX this interface will change: */ |
| 43 |
0 |
| DBI_IMP_SIZE("DBD::Perl::dr::imp_data_size", sizeof(imp_drh_t)); |
| 44 |
0 |
| DBI_IMP_SIZE("DBD::Perl::db::imp_data_size", sizeof(imp_dbh_t)); |
| 45 |
0 |
| DBI_IMP_SIZE("DBD::Perl::st::imp_data_size", sizeof(imp_sth_t)); |
| 46 |
0 |
| dbd_init(DBIS); |
| 47 |
|
| |
| 48 |
|
| |
| 49 |
|
| # ------------------------------------------------------------ |
| 50 |
|
| # driver level interface |
| 51 |
|
| # ------------------------------------------------------------ |
| 52 |
|
| MODULE = DBD::Perl PACKAGE = DBD::Perl::dr |
| 53 |
|
| |
| 54 |
|
| |
| 55 |
|
| void |
| 56 |
|
| dbixs_revision(...) |
| 57 |
|
| PPCODE: |
| 58 |
0 |
| ST(0) = sv_2mortal(newSViv(DBIXS_REVISION)); |
| 59 |
|
| |
| 60 |
|
| |
| 61 |
|
| #ifdef dbd_discon_all |
| 62 |
|
| |
| 63 |
|
| # disconnect_all renamed and ALIAS'd to avoid length clash on VMS :-( |
| 64 |
|
| bool |
| 65 |
|
| discon_all_(drh) |
| 66 |
|
| SV * drh |
| 67 |
|
| ALIAS: |
| 68 |
|
| disconnect_all = 1 |
| 69 |
|
| CODE: |
| 70 |
0 |
| D_imp_drh(drh); |
| 71 |
|
| PERL_UNUSED_VAR(ix); |
| 72 |
0 |
▶ | RETVAL = dbd_discon_all(drh, imp_drh); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_discon_all(drh, imp_drh); |
0 |
0 |
0 |
|
| 73 |
|
| OUTPUT: |
| 74 |
|
| RETVAL |
| 75 |
|
| |
| 76 |
|
| #endif /* dbd_discon_all */ |
| 77 |
|
| |
| 78 |
|
| |
| 79 |
|
| #ifdef dbd_dr_data_sources |
| 80 |
|
| |
| 81 |
|
| void |
| 82 |
|
| data_sources(drh, attr = Nullsv) |
| 83 |
|
| SV *drh |
| 84 |
|
| SV *attr |
| 85 |
|
| PPCODE: |
| 86 |
|
| { |
| 87 |
0 |
| D_imp_drh(drh); |
| 88 |
0 |
| AV *av = dbd_dr_data_sources(drh, imp_drh, attr); |
| 89 |
0 |
▶ | if (av) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (av) { |
0 |
0 |
0 |
|
| 90 |
|
| int i; |
| 91 |
0 |
| int n = AvFILL(av)+1; |
| 92 |
0 |
▶ | EXTEND(sp, n); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(sp, n); |
0 |
0 |
0 |
| EXTEND(sp, n); |
0 |
0 |
0 |
|
| 93 |
0 |
▶ | for (i = 0; i < n; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < n; ++i) { |
0 |
0 |
0 |
|
| 94 |
0 |
| PUSHs(AvARRAY(av)[i]); |
| 95 |
|
| } |
| 96 |
|
| } |
| 97 |
|
| } |
| 98 |
|
| |
| 99 |
|
| #endif |
| 100 |
|
| |
| 101 |
|
| |
| 102 |
|
| # ------------------------------------------------------------ |
| 103 |
|
| # database level interface |
| 104 |
|
| # ------------------------------------------------------------ |
| 105 |
|
| MODULE = DBD::Perl PACKAGE = DBD::Perl::db |
| 106 |
|
| |
| 107 |
|
| |
| 108 |
|
| bool |
| 109 |
|
| _login(dbh, dbname, username, password, attribs=Nullsv) |
| 110 |
|
| SV * dbh |
| 111 |
|
| SV * dbname |
| 112 |
|
| SV * username |
| 113 |
|
| SV * password |
| 114 |
|
| SV * attribs |
| 115 |
|
| CODE: |
| 116 |
|
| { |
| 117 |
0 |
| D_imp_dbh(dbh); |
| 118 |
|
| #if !defined(dbd_db_login6_sv) |
| 119 |
|
| STRLEN lna; |
| 120 |
0 |
▶ | char *u = (SvOK(username)) ? SvPV(username,lna) : (char*)""; |
Branch: 1 branch
| Branch | True | False | Total |
| char *u = (SvOK(username)) ? SvPV(username,lna) : (char*)""; |
0 |
0 |
0 |
|
| 121 |
0 |
▶ | char *p = (SvOK(password)) ? SvPV(password,lna) : (char*)""; |
Branch: 1 branch
| Branch | True | False | Total |
| char *p = (SvOK(password)) ? SvPV(password,lna) : (char*)""; |
0 |
0 |
0 |
|
| 122 |
|
| #endif |
| 123 |
|
| #ifdef dbd_db_login6_sv |
| 124 |
|
| RETVAL = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs); |
| 125 |
|
| #elif defined(dbd_db_login6) |
| 126 |
|
| RETVAL = dbd_db_login6(dbh, imp_dbh, SvPV_nolen(dbname), u, p, attribs); |
| 127 |
|
| #else |
| 128 |
|
| PERL_UNUSED_ARG(attribs); |
| 129 |
0 |
▶ | RETVAL = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p); |
0 |
0 |
0 |
|
| 130 |
|
| #endif |
| 131 |
|
| } |
| 132 |
|
| OUTPUT: |
| 133 |
|
| RETVAL |
| 134 |
|
| |
| 135 |
|
| |
| 136 |
|
| void |
| 137 |
|
| selectall_arrayref(...) |
| 138 |
|
| PREINIT: |
| 139 |
|
| SV *sth; |
| 140 |
|
| SV **maxrows_svp; |
| 141 |
|
| SV **tmp_svp; |
| 142 |
|
| SV *tmp_sv; |
| 143 |
0 |
| SV *attr = &PL_sv_undef; |
| 144 |
|
| imp_sth_t *imp_sth; |
| 145 |
|
| CODE: |
| 146 |
0 |
▶ | if (items > 2) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 2) { |
0 |
0 |
0 |
|
| 147 |
0 |
| attr = ST(2); |
| 148 |
0 |
▶ | if (SvROK(attr) && |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(attr) && |
0 |
0 |
0 |
|
| 149 |
0 |
▶ | (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
Branch: 10 branches
| Branch | True | False | Total |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
| (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) |
0 |
0 |
0 |
|
| 150 |
|
| ) { |
| 151 |
|
| /* fallback to perl implementation */ |
| 152 |
0 |
| SV *tmp =dbixst_bounce_method("DBD::Perl::db::SUPER::selectall_arrayref", items); |
| 153 |
0 |
| SPAGAIN; |
| 154 |
0 |
| ST(0) = tmp; |
| 155 |
0 |
| XSRETURN(1); |
| 156 |
|
| } |
| 157 |
|
| } |
| 158 |
|
| /* --- prepare --- */ |
| 159 |
0 |
▶ | if (SvROK(ST(1))) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(ST(1))) { |
0 |
0 |
0 |
|
| 160 |
|
| MAGIC *mg; |
| 161 |
0 |
| sth = ST(1); |
| 162 |
|
| /* switch to inner handle if not already */ |
| 163 |
0 |
▶ | if ( (mg = mg_find(SvRV(sth),'P')) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if ( (mg = mg_find(SvRV(sth),'P')) ) |
0 |
0 |
0 |
|
| 164 |
0 |
| sth = mg->mg_obj; |
| 165 |
|
| } |
| 166 |
|
| else { |
| 167 |
|
| MAGIC *mg; |
| 168 |
0 |
| sth = dbixst_bounce_method("prepare", 3); |
| 169 |
0 |
| SPAGAIN; SP -= items; /* because stack might have been realloc'd */ |
| 170 |
0 |
▶ | if (!SvROK(sth)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvROK(sth)) |
0 |
0 |
0 |
|
| 171 |
0 |
| XSRETURN_UNDEF; |
| 172 |
|
| /* switch to inner handle */ |
| 173 |
0 |
| mg = mg_find(SvRV(sth),'P'); |
| 174 |
0 |
▶ | if (!mg) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!mg) |
0 |
0 |
0 |
|
| 175 |
0 |
| XSRETURN_UNDEF; |
| 176 |
0 |
| sth = mg->mg_obj; |
| 177 |
|
| } |
| 178 |
0 |
| imp_sth = (imp_sth_t*)(DBIh_COM(sth)); |
| 179 |
|
| /* --- bind_param --- */ |
| 180 |
0 |
▶ | if (items > 3) { /* need to bind params before execute */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 3) { /* need to bind params before execute */ |
0 |
0 |
0 |
|
| 181 |
0 |
▶ | if (!dbdxst_bind_params(sth, imp_sth, items-2, ax+2) ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!dbdxst_bind_params(sth, imp_sth, items-2, ax+2) ) { |
0 |
0 |
0 |
|
| 182 |
0 |
| XSRETURN_UNDEF; |
| 183 |
|
| } |
| 184 |
|
| } |
| 185 |
|
| /* --- execute --- */ |
| 186 |
0 |
| DBIc_ROW_COUNT(imp_sth) = 0; |
| 187 |
0 |
▶ | if ( dbd_st_execute(sth, imp_sth) <= -2 ) { /* -2 == error */ |
Branch: 1 branch
| Branch | True | False | Total |
| if ( dbd_st_execute(sth, imp_sth) <= -2 ) { /* -2 == error */ |
0 |
0 |
0 |
|
| 188 |
0 |
| XSRETURN_UNDEF; |
| 189 |
|
| } |
| 190 |
|
| /* --- fetchall --- */ |
| 191 |
0 |
▶ | maxrows_svp = DBD_ATTRIB_GET_SVP(attr, "MaxRows", 7); |
Branch: 3 branches
| Branch | True | False | Total |
| maxrows_svp = DBD_ATTRIB_GET_SVP(attr, "MaxRows", 7); |
0 |
0 |
0 |
| maxrows_svp = DBD_ATTRIB_GET_SVP(attr, "MaxRows", 7); |
0 |
0 |
0 |
| maxrows_svp = DBD_ATTRIB_GET_SVP(attr, "MaxRows", 7); |
0 |
0 |
0 |
|
| 192 |
0 |
▶ | tmp_sv = dbdxst_fetchall_arrayref(sth, &PL_sv_undef, (maxrows_svp) ? *maxrows_svp : &PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| tmp_sv = dbdxst_fetchall_arrayref(sth, &PL_sv_undef, (maxrows_svp) ? *maxrows_svp : &PL_sv_undef); |
0 |
0 |
0 |
|
| 193 |
0 |
| SPAGAIN; |
| 194 |
0 |
| ST(0) = tmp_sv; |
| 195 |
|
| |
| 196 |
|
| |
| 197 |
|
| void |
| 198 |
|
| selectrow_arrayref(...) |
| 199 |
|
| ALIAS: |
| 200 |
|
| selectrow_array = 1 |
| 201 |
|
| PREINIT: |
| 202 |
0 |
| int is_selectrow_array = (ix == 1); |
| 203 |
|
| imp_sth_t *imp_sth; |
| 204 |
|
| SV *sth; |
| 205 |
|
| AV *row_av; |
| 206 |
|
| PPCODE: |
| 207 |
0 |
▶ | if (SvROK(ST(1))) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(ST(1))) { |
0 |
0 |
0 |
|
| 208 |
|
| MAGIC *mg; |
| 209 |
0 |
| sth = ST(1); |
| 210 |
|
| /* switch to inner handle if not already */ |
| 211 |
0 |
| mg = mg_find(SvRV(sth),'P'); |
| 212 |
0 |
▶ | if (!mg) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!mg) { |
0 |
0 |
0 |
|
| 213 |
0 |
▶ | if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
0 |
0 |
0 |
|
| 214 |
|
| } |
| 215 |
0 |
| sth = mg->mg_obj; |
| 216 |
|
| } |
| 217 |
|
| else { |
| 218 |
|
| MAGIC *mg; |
| 219 |
|
| /* --- prepare --- */ |
| 220 |
0 |
| sth = dbixst_bounce_method("prepare", 3); |
| 221 |
0 |
| SPAGAIN; SP -= items; /* because stack might have been realloc'd */ |
| 222 |
0 |
▶ | if (!SvROK(sth)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvROK(sth)) { |
0 |
0 |
0 |
|
| 223 |
0 |
▶ | if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
0 |
0 |
0 |
|
| 224 |
|
| } |
| 225 |
|
| /* switch to inner handle */ |
| 226 |
0 |
| mg = mg_find(SvRV(sth),'P'); |
| 227 |
0 |
▶ | if (!mg) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!mg) { |
0 |
0 |
0 |
|
| 228 |
0 |
▶ | if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
0 |
0 |
0 |
|
| 229 |
|
| } |
| 230 |
0 |
| sth = mg->mg_obj; |
| 231 |
|
| } |
| 232 |
0 |
| imp_sth = (imp_sth_t*)(DBIh_COM(sth)); |
| 233 |
|
| /* --- bind_param --- */ |
| 234 |
0 |
▶ | if (items > 3) { /* need to bind params before execute */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 3) { /* need to bind params before execute */ |
0 |
0 |
0 |
|
| 235 |
0 |
▶ | if (!dbdxst_bind_params(sth, imp_sth, items-2, ax+2) ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!dbdxst_bind_params(sth, imp_sth, items-2, ax+2) ) { |
0 |
0 |
0 |
|
| 236 |
0 |
▶ | if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
0 |
0 |
0 |
|
| 237 |
|
| } |
| 238 |
|
| } |
| 239 |
|
| /* --- execute --- */ |
| 240 |
0 |
| DBIc_ROW_COUNT(imp_sth) = 0; |
| 241 |
0 |
▶ | if ( dbd_st_execute(sth, imp_sth) <= -2 ) { /* -2 == error */ |
Branch: 1 branch
| Branch | True | False | Total |
| if ( dbd_st_execute(sth, imp_sth) <= -2 ) { /* -2 == error */ |
0 |
0 |
0 |
|
| 242 |
0 |
▶ | if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } |
0 |
0 |
0 |
|
| 243 |
|
| } |
| 244 |
0 |
| SPAGAIN; SP -= items; /* because stack might have been realloc'd */ |
| 245 |
|
| /* --- fetchrow_arrayref --- */ |
| 246 |
0 |
| row_av = dbd_st_fetch(sth, imp_sth); |
| 247 |
0 |
| SPAGAIN; SP -= items; /* because stack might have been realloc'd */ |
| 248 |
0 |
▶ | if (!row_av) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!row_av) { |
0 |
0 |
0 |
|
| 249 |
0 |
▶ | if (GIMME_V == G_SCALAR) |
Branch: 1 branch
| Branch | True | False | Total |
| if (GIMME_V == G_SCALAR) |
0 |
0 |
0 |
|
| 250 |
0 |
| PUSHs(&PL_sv_undef); |
| 251 |
|
| } |
| 252 |
0 |
▶ | else if (is_selectrow_array) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (is_selectrow_array) { |
0 |
0 |
0 |
|
| 253 |
|
| int i; |
| 254 |
0 |
| int num_fields = AvFILL(row_av)+1; |
| 255 |
0 |
▶ | if (GIMME_V == G_SCALAR) |
Branch: 1 branch
| Branch | True | False | Total |
| if (GIMME_V == G_SCALAR) |
0 |
0 |
0 |
|
| 256 |
0 |
| num_fields = 1; /* return just first field */ |
| 257 |
0 |
▶ | EXTEND(sp, num_fields); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(sp, num_fields); |
0 |
0 |
0 |
| EXTEND(sp, num_fields); |
0 |
0 |
0 |
|
| 258 |
0 |
▶ | for(i=0; i < num_fields; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for(i=0; i < num_fields; ++i) { |
0 |
0 |
0 |
|
| 259 |
0 |
| PUSHs(AvARRAY(row_av)[i]); |
| 260 |
|
| } |
| 261 |
|
| } |
| 262 |
|
| else { |
| 263 |
0 |
| PUSHs( sv_2mortal(newRV((SV *)row_av)) ); |
| 264 |
|
| } |
| 265 |
|
| /* --- finish --- */ |
| 266 |
|
| #ifdef dbd_st_finish3 |
| 267 |
|
| dbd_st_finish3(sth, imp_sth, 0); |
| 268 |
|
| #else |
| 269 |
0 |
| dbd_st_finish(sth, imp_sth); |
| 270 |
|
| #endif |
| 271 |
|
| |
| 272 |
|
| |
| 273 |
|
| #if defined(dbd_db_do6) || defined(dbd_db_do4) |
| 274 |
|
| |
| 275 |
|
| void |
| 276 |
|
| do(dbh, statement, params = Nullsv, ...) |
| 277 |
|
| SV * dbh |
| 278 |
|
| SV * statement |
| 279 |
|
| SV * params |
| 280 |
|
| CODE: |
| 281 |
|
| { |
| 282 |
0 |
| D_imp_dbh(dbh); |
| 283 |
|
| IV retval; |
| 284 |
|
| #ifdef dbd_db_do6 |
| 285 |
|
| /* items is a number of arguments passed to XSUB, supplied by xsubpp compiler */ |
| 286 |
|
| /* ax contains stack base offset used by ST() macro, supplied by xsubpp compiler */ |
| 287 |
|
| I32 offset = (items >= 3) ? 3 : items; |
| 288 |
|
| retval = dbd_db_do6(dbh, imp_dbh, statement, params, items-offset, ax+offset); |
| 289 |
|
| #else |
| 290 |
0 |
▶ | if (items > 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 3) |
0 |
0 |
0 |
|
| 291 |
0 |
| croak_xs_usage(cv, "dbh, statement, params = Nullsv"); |
| 292 |
0 |
| retval = dbd_db_do4(dbh, imp_dbh, SvPV_nolen(statement), params); /* might be dbd_db_do4_iv via macro */ |
| 293 |
|
| #endif |
| 294 |
|
| /* remember that dbd_db_do* must return <= -2 for error */ |
| 295 |
0 |
▶ | if (retval == 0) /* ok with no rows affected */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (retval == 0) /* ok with no rows affected */ |
0 |
0 |
0 |
|
| 296 |
0 |
| XST_mPV(0, "0E0"); /* (true but zero) */ |
| 297 |
0 |
▶ | else if (retval < -1) /* -1 == unknown number of rows */ |
Branch: 1 branch
| Branch | True | False | Total |
| else if (retval < -1) /* -1 == unknown number of rows */ |
0 |
0 |
0 |
|
| 298 |
0 |
| XST_mUNDEF(0); /* <= -2 means error */ |
| 299 |
|
| else |
| 300 |
0 |
| XST_mIV(0, retval); /* typically 1, rowcount or -1 */ |
| 301 |
|
| } |
| 302 |
|
| |
| 303 |
|
| #endif |
| 304 |
|
| |
| 305 |
|
| |
| 306 |
|
| #ifdef dbd_db_last_insert_id |
| 307 |
|
| |
| 308 |
|
| void |
| 309 |
|
| last_insert_id(dbh, catalog=&PL_sv_undef, schema=&PL_sv_undef, table=&PL_sv_undef, field=&PL_sv_undef, attr=Nullsv) |
| 310 |
|
| SV * dbh |
| 311 |
|
| SV * catalog |
| 312 |
|
| SV * schema |
| 313 |
|
| SV * table |
| 314 |
|
| SV * field |
| 315 |
|
| SV * attr |
| 316 |
|
| CODE: |
| 317 |
|
| { |
| 318 |
0 |
| D_imp_dbh(dbh); |
| 319 |
0 |
| SV *ret = dbd_db_last_insert_id(dbh, imp_dbh, catalog, schema, table, field, attr); |
| 320 |
0 |
| ST(0) = ret; |
| 321 |
|
| } |
| 322 |
|
| |
| 323 |
|
| #endif |
| 324 |
|
| |
| 325 |
|
| |
| 326 |
|
| bool |
| 327 |
|
| commit(dbh) |
| 328 |
|
| SV * dbh |
| 329 |
|
| CODE: |
| 330 |
0 |
| D_imp_dbh(dbh); |
| 331 |
0 |
▶ | if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) |
0 |
0 |
0 |
| if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) |
0 |
0 |
0 |
|
| 332 |
0 |
| warn("commit ineffective with AutoCommit enabled"); |
| 333 |
0 |
▶ | RETVAL = dbd_db_commit(dbh, imp_dbh); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_db_commit(dbh, imp_dbh); |
0 |
0 |
0 |
|
| 334 |
|
| OUTPUT: |
| 335 |
|
| RETVAL |
| 336 |
|
| |
| 337 |
|
| |
| 338 |
|
| bool |
| 339 |
|
| rollback(dbh) |
| 340 |
|
| SV * dbh |
| 341 |
|
| CODE: |
| 342 |
0 |
| D_imp_dbh(dbh); |
| 343 |
0 |
▶ | if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) |
0 |
0 |
0 |
| if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) |
0 |
0 |
0 |
|
| 344 |
0 |
| warn("rollback ineffective with AutoCommit enabled"); |
| 345 |
0 |
▶ | RETVAL = dbd_db_rollback(dbh, imp_dbh); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_db_rollback(dbh, imp_dbh); |
0 |
0 |
0 |
|
| 346 |
|
| OUTPUT: |
| 347 |
|
| RETVAL |
| 348 |
|
| |
| 349 |
|
| |
| 350 |
|
| bool |
| 351 |
|
| disconnect(dbh) |
| 352 |
|
| SV * dbh |
| 353 |
|
| CODE: |
| 354 |
0 |
| D_imp_dbh(dbh); |
| 355 |
0 |
▶ | if ( !DBIc_ACTIVE(imp_dbh) ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ( !DBIc_ACTIVE(imp_dbh) ) { |
0 |
0 |
0 |
|
| 356 |
0 |
| XSRETURN_YES; |
| 357 |
|
| } |
| 358 |
|
| /* Check for disconnect() being called whilst refs to cursors */ |
| 359 |
|
| /* still exists. This possibly needs some more thought. */ |
| 360 |
0 |
▶ | if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) { |
0 |
0 |
0 |
| if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) { |
0 |
0 |
0 |
| if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) { |
0 |
0 |
0 |
|
| 361 |
|
| STRLEN lna; |
| 362 |
0 |
▶ | char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? (char*)"" : (char*)"s"; |
Branch: 1 branch
| Branch | True | False | Total |
| char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? (char*)"" : (char*)"s"; |
0 |
0 |
0 |
|
| 363 |
0 |
| warn("%s->disconnect invalidates %d active statement handle%s %s", |
| 364 |
|
| SvPV(dbh,lna), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural, |
| 365 |
|
| "(either destroy statement handles or call finish on them before disconnecting)"); |
| 366 |
|
| } |
| 367 |
0 |
| RETVAL = dbd_db_disconnect(dbh, imp_dbh); |
| 368 |
0 |
▶ | DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
Branch: 6 branches
| Branch | True | False | Total |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
|
| 369 |
|
| OUTPUT: |
| 370 |
|
| RETVAL |
| 371 |
|
| |
| 372 |
|
| |
| 373 |
|
| void |
| 374 |
|
| STORE(dbh, keysv, valuesv) |
| 375 |
|
| SV * dbh |
| 376 |
|
| SV * keysv |
| 377 |
|
| SV * valuesv |
| 378 |
|
| CODE: |
| 379 |
0 |
| D_imp_dbh(dbh); |
| 380 |
0 |
▶ | if (SvGMAGICAL(valuesv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvGMAGICAL(valuesv)) |
0 |
0 |
0 |
|
| 381 |
0 |
| mg_get(valuesv); |
| 382 |
0 |
| ST(0) = &PL_sv_yes; |
| 383 |
0 |
▶ | if (!dbd_db_STORE_attrib(dbh, imp_dbh, keysv, valuesv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!dbd_db_STORE_attrib(dbh, imp_dbh, keysv, valuesv)) |
0 |
0 |
0 |
|
| 384 |
0 |
▶ | if (!DBIc_DBISTATE(imp_dbh)->set_attr(dbh, keysv, valuesv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_DBISTATE(imp_dbh)->set_attr(dbh, keysv, valuesv)) |
0 |
0 |
0 |
|
| 385 |
0 |
| ST(0) = &PL_sv_no; |
| 386 |
|
| |
| 387 |
|
| |
| 388 |
|
| void |
| 389 |
|
| FETCH(dbh, keysv) |
| 390 |
|
| SV * dbh |
| 391 |
|
| SV * keysv |
| 392 |
|
| CODE: |
| 393 |
0 |
| D_imp_dbh(dbh); |
| 394 |
0 |
| SV *valuesv = dbd_db_FETCH_attrib(dbh, imp_dbh, keysv); |
| 395 |
0 |
▶ | if (!valuesv) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!valuesv) |
0 |
0 |
0 |
|
| 396 |
0 |
| valuesv = DBIc_DBISTATE(imp_dbh)->get_attr(dbh, keysv); |
| 397 |
0 |
| ST(0) = valuesv; /* dbd_db_FETCH_attrib did sv_2mortal */ |
| 398 |
|
| |
| 399 |
|
| |
| 400 |
|
| void |
| 401 |
|
| DESTROY(dbh) |
| 402 |
|
| SV * dbh |
| 403 |
|
| PPCODE: |
| 404 |
|
| /* keep in sync with default DESTROY in DBI.xs */ |
| 405 |
0 |
| D_imp_dbh(dbh); |
| 406 |
0 |
| ST(0) = &PL_sv_yes; |
| 407 |
0 |
▶ | if (!DBIc_IMPSET(imp_dbh)) { /* was never fully set up */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_IMPSET(imp_dbh)) { /* was never fully set up */ |
0 |
0 |
0 |
|
| 408 |
|
| STRLEN lna; |
| 409 |
0 |
▶ | if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2) |
Branch: 3 branches
| Branch | True | False | Total |
| if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2) |
0 |
0 |
0 |
| if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2) |
0 |
0 |
0 |
| if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2) |
0 |
0 |
0 |
|
| 410 |
0 |
| PerlIO_printf(DBIc_LOGPIO(imp_dbh), |
| 411 |
|
| " DESTROY for %s ignored - handle not initialised\n", |
| 412 |
|
| SvPV(dbh,lna)); |
| 413 |
|
| } |
| 414 |
|
| else { |
| 415 |
0 |
▶ | if (DBIc_IADESTROY(imp_dbh)) { /* wants ineffective destroy */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_IADESTROY(imp_dbh)) { /* wants ineffective destroy */ |
0 |
0 |
0 |
|
| 416 |
0 |
▶ | DBIc_ACTIVE_off(imp_dbh); |
Branch: 5 branches
| Branch | True | False | Total |
| DBIc_ACTIVE_off(imp_dbh); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); |
0 |
0 |
0 |
|
| 417 |
0 |
▶ | if (DBIc_DBISTATE(imp_dbh)->debug) |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_DBISTATE(imp_dbh)->debug) |
0 |
0 |
0 |
|
| 418 |
0 |
| PerlIO_printf(DBIc_LOGPIO(imp_dbh), " DESTROY %s skipped due to InactiveDestroy\n", SvPV_nolen(dbh)); |
| 419 |
|
| } |
| 420 |
0 |
▶ | if (DBIc_ACTIVE(imp_dbh)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_ACTIVE(imp_dbh)) { |
0 |
0 |
0 |
|
| 421 |
0 |
▶ | if (!DBIc_has(imp_dbh,DBIcf_AutoCommit)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_has(imp_dbh,DBIcf_AutoCommit)) { |
0 |
0 |
0 |
|
| 422 |
|
| /* Application is using transactions and hasn't explicitly disconnected. |
| 423 |
|
| Some databases will automatically commit on graceful disconnect. |
| 424 |
|
| Since we're about to gracefully disconnect as part of the DESTROY |
| 425 |
|
| we want to be sure we're not about to implicitly commit changes |
| 426 |
|
| that are incomplete and should be rolled back. (The DESTROY may |
| 427 |
|
| be due to a RaiseError, for example.) So we rollback here. |
| 428 |
|
| This will be harmless if the application has issued a commit, |
| 429 |
|
| XXX Could add an attribute flag to indicate that the driver |
| 430 |
|
| doesn't have this problem. Patches welcome. |
| 431 |
|
| */ |
| 432 |
0 |
▶ | if (DBIc_WARN(imp_dbh) /* only warn if likely to be useful... */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_WARN(imp_dbh) /* only warn if likely to be useful... */ |
0 |
0 |
0 |
|
| 433 |
0 |
▶ | && DBIc_is(imp_dbh, DBIcf_Executed) /* has not just called commit/rollback */ |
Branch: 1 branch
| Branch | True | False | Total |
| && DBIc_is(imp_dbh, DBIcf_Executed) /* has not just called commit/rollback */ |
0 |
0 |
0 |
|
| 434 |
|
| /* && !DBIc_is(imp_dbh, DBIcf_ReadOnly) -- is not read only */ |
| 435 |
0 |
▶ | && (!PL_dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3) |
Branch: 2 branches
| Branch | True | False | Total |
| && (!PL_dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3) |
0 |
0 |
0 |
| && (!PL_dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3) |
0 |
0 |
0 |
|
| 436 |
|
| ) { |
| 437 |
0 |
▶ | warn("Issuing rollback() due to DESTROY without explicit disconnect() of %s handle %s", |
Branch: 1 branch
| Branch | True | False | Total |
| warn("Issuing rollback() due to DESTROY without explicit disconnect() of %s handle %s", |
0 |
0 |
0 |
|
| 438 |
|
| SvPV_nolen(*hv_fetchs((HV*)SvRV(dbh), "ImplementorClass", 1)), |
| 439 |
|
| SvPV_nolen(*hv_fetchs((HV*)SvRV(dbh), "Name", 1)) |
| 440 |
|
| ); |
| 441 |
|
| } |
| 442 |
0 |
| dbd_db_rollback(dbh, imp_dbh); /* ROLLBACK! */ |
| 443 |
|
| } |
| 444 |
0 |
| dbd_db_disconnect(dbh, imp_dbh); |
| 445 |
0 |
▶ | DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
Branch: 5 branches
| Branch | True | False | Total |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ |
0 |
0 |
0 |
|
| 446 |
|
| } |
| 447 |
0 |
| dbd_db_destroy(dbh, imp_dbh); |
| 448 |
|
| } |
| 449 |
|
| |
| 450 |
|
| |
| 451 |
|
| #ifdef dbd_take_imp_data |
| 452 |
|
| |
| 453 |
|
| void |
| 454 |
|
| take_imp_data(h) |
| 455 |
|
| SV * h |
| 456 |
|
| CODE: |
| 457 |
0 |
| D_imp_xxh(h); |
| 458 |
|
| /* dbd_take_imp_data() returns &sv_no (or other defined but false value) |
| 459 |
|
| * to indicate "preparations complete, now call SUPER::take_imp_data" for me. |
| 460 |
|
| * Anything else is returned to the caller via sv_2mortal(sv), typically that |
| 461 |
|
| * would be &sv_undef for error or an SV holding the imp_data. |
| 462 |
|
| */ |
| 463 |
0 |
| SV *sv = dbd_take_imp_data(h, imp_xxh, NULL); |
| 464 |
0 |
▶ | if (SvOK(sv) && !SvTRUE(sv)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvOK(sv) && !SvTRUE(sv)) { |
0 |
0 |
0 |
| if (SvOK(sv) && !SvTRUE(sv)) { |
0 |
0 |
0 |
|
| 465 |
0 |
| SV *tmp = dbixst_bounce_method("DBD::Perl::db::SUPER::take_imp_data", items); |
| 466 |
0 |
| SPAGAIN; |
| 467 |
0 |
| ST(0) = tmp; |
| 468 |
|
| } else { |
| 469 |
0 |
| ST(0) = sv_2mortal(sv); |
| 470 |
|
| } |
| 471 |
|
| |
| 472 |
|
| #endif |
| 473 |
|
| |
| 474 |
|
| #ifdef dbd_db_data_sources |
| 475 |
|
| |
| 476 |
|
| void |
| 477 |
|
| data_sources(dbh, attr = Nullsv) |
| 478 |
|
| SV *dbh |
| 479 |
|
| SV *attr |
| 480 |
|
| PPCODE: |
| 481 |
|
| { |
| 482 |
|
| D_imp_dbh(dbh); |
| 483 |
|
| AV *av = dbd_db_data_sources(dbh, imp_dbh, attr); |
| 484 |
|
| if (av) { |
| 485 |
|
| int i; |
| 486 |
|
| int n = AvFILL(av)+1; |
| 487 |
|
| EXTEND(sp, n); |
| 488 |
|
| for (i = 0; i < n; ++i) { |
| 489 |
|
| PUSHs(AvARRAY(av)[i]); |
| 490 |
|
| } |
| 491 |
|
| } |
| 492 |
|
| } |
| 493 |
|
| |
| 494 |
|
| #endif |
| 495 |
|
| |
| 496 |
|
| # -- end of DBD::Perl::db |
| 497 |
|
| |
| 498 |
|
| # ------------------------------------------------------------ |
| 499 |
|
| # statement interface |
| 500 |
|
| # ------------------------------------------------------------ |
| 501 |
|
| MODULE = DBD::Perl PACKAGE = DBD::Perl::st |
| 502 |
|
| |
| 503 |
|
| |
| 504 |
|
| bool |
| 505 |
|
| _prepare(sth, statement, attribs=Nullsv) |
| 506 |
|
| SV * sth |
| 507 |
|
| SV * statement |
| 508 |
|
| SV * attribs |
| 509 |
|
| CODE: |
| 510 |
|
| { |
| 511 |
0 |
| D_imp_sth(sth); |
| 512 |
0 |
▶ | DBD_ATTRIBS_CHECK("_prepare", sth, attribs); |
Branch: 5 branches
| Branch | True | False | Total |
| DBD_ATTRIBS_CHECK("_prepare", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("_prepare", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("_prepare", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("_prepare", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("_prepare", sth, attribs); |
0 |
0 |
0 |
|
| 513 |
|
| #ifdef dbd_st_prepare_sv |
| 514 |
|
| RETVAL = dbd_st_prepare_sv(sth, imp_sth, statement, attribs); |
| 515 |
|
| #else |
| 516 |
0 |
▶ | RETVAL = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs); |
0 |
0 |
0 |
|
| 517 |
|
| #endif |
| 518 |
|
| } |
| 519 |
|
| OUTPUT: |
| 520 |
|
| RETVAL |
| 521 |
|
| |
| 522 |
|
| |
| 523 |
|
| #ifdef dbd_st_rows |
| 524 |
|
| |
| 525 |
|
| void |
| 526 |
|
| rows(sth) |
| 527 |
|
| SV * sth |
| 528 |
|
| CODE: |
| 529 |
|
| D_imp_sth(sth); |
| 530 |
|
| XST_mIV(0, dbd_st_rows(sth, imp_sth)); |
| 531 |
|
| |
| 532 |
|
| #endif /* dbd_st_rows */ |
| 533 |
|
| |
| 534 |
|
| |
| 535 |
|
| #ifdef dbd_st_bind_col |
| 536 |
|
| |
| 537 |
|
| bool |
| 538 |
|
| bind_col(sth, col, ref, attribs=Nullsv) |
| 539 |
|
| SV * sth |
| 540 |
|
| SV * col |
| 541 |
|
| SV * ref |
| 542 |
|
| SV * attribs |
| 543 |
|
| CODE: |
| 544 |
|
| { |
| 545 |
0 |
| IV sql_type = 0; |
| 546 |
0 |
| D_imp_sth(sth); |
| 547 |
0 |
▶ | if (SvGMAGICAL(ref)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvGMAGICAL(ref)) |
0 |
0 |
0 |
|
| 548 |
0 |
| mg_get(ref); |
| 549 |
0 |
▶ | if (attribs) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (attribs) { |
0 |
0 |
0 |
|
| 550 |
0 |
▶ | if (SvNIOK(attribs)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvNIOK(attribs)) { |
0 |
0 |
0 |
|
| 551 |
0 |
| sql_type = SvIV(attribs); |
| 552 |
0 |
| attribs = Nullsv; |
| 553 |
|
| } |
| 554 |
|
| else { |
| 555 |
|
| SV **svp; |
| 556 |
0 |
▶ | DBD_ATTRIBS_CHECK("bind_col", sth, attribs); |
Branch: 5 branches
| Branch | True | False | Total |
| DBD_ATTRIBS_CHECK("bind_col", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_col", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_col", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_col", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_col", sth, attribs); |
0 |
0 |
0 |
|
| 557 |
|
| /* XXX we should perhaps complain if TYPE is not SvNIOK */ |
| 558 |
0 |
▶ | DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
Branch: 4 branches
| Branch | True | False | Total |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
|
| 559 |
|
| } |
| 560 |
|
| } |
| 561 |
0 |
| switch(dbd_st_bind_col(sth, imp_sth, col, ref, sql_type, attribs)) { |
| 562 |
|
| case 2: RETVAL = TRUE; /* job done completely */ |
| 563 |
|
| break; |
| 564 |
|
| case 1: /* fallback to DBI default */ |
| 565 |
0 |
| RETVAL = DBIc_DBISTATE(imp_sth)->bind_col(sth, col, ref, attribs); |
| 566 |
0 |
| break; |
| 567 |
|
| default: RETVAL = FALSE; /* dbd_st_bind_col has called set_err */ |
| 568 |
|
| break; |
| 569 |
|
| } |
| 570 |
|
| } |
| 571 |
|
| OUTPUT: |
| 572 |
|
| RETVAL |
| 573 |
|
| |
| 574 |
|
| #endif /* dbd_st_bind_col */ |
| 575 |
|
| |
| 576 |
|
| bool |
| 577 |
|
| bind_param(sth, param, value, attribs=Nullsv) |
| 578 |
|
| SV * sth |
| 579 |
|
| SV * param |
| 580 |
|
| SV * value |
| 581 |
|
| SV * attribs |
| 582 |
|
| CODE: |
| 583 |
|
| { |
| 584 |
0 |
| IV sql_type = 0; |
| 585 |
0 |
| D_imp_sth(sth); |
| 586 |
0 |
▶ | if (SvGMAGICAL(value)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvGMAGICAL(value)) |
0 |
0 |
0 |
|
| 587 |
0 |
| mg_get(value); |
| 588 |
0 |
▶ | if (attribs) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (attribs) { |
0 |
0 |
0 |
|
| 589 |
0 |
▶ | if (SvNIOK(attribs)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvNIOK(attribs)) { |
0 |
0 |
0 |
|
| 590 |
0 |
| sql_type = SvIV(attribs); |
| 591 |
0 |
| attribs = Nullsv; |
| 592 |
|
| } |
| 593 |
|
| else { |
| 594 |
|
| SV **svp; |
| 595 |
0 |
▶ | DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
Branch: 5 branches
| Branch | True | False | Total |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
|
| 596 |
|
| /* XXX we should perhaps complain if TYPE is not SvNIOK */ |
| 597 |
0 |
▶ | DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
Branch: 4 branches
| Branch | True | False | Total |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
|
| 598 |
|
| } |
| 599 |
|
| } |
| 600 |
0 |
▶ | RETVAL = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, FALSE, 0); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, FALSE, 0); |
0 |
0 |
0 |
|
| 601 |
|
| } |
| 602 |
|
| OUTPUT: |
| 603 |
|
| RETVAL |
| 604 |
|
| |
| 605 |
|
| |
| 606 |
|
| bool |
| 607 |
|
| bind_param_inout(sth, param, value_ref, maxlen, attribs=Nullsv) |
| 608 |
|
| SV * sth |
| 609 |
|
| SV * param |
| 610 |
|
| SV * value_ref |
| 611 |
|
| IV maxlen |
| 612 |
|
| SV * attribs |
| 613 |
|
| CODE: |
| 614 |
|
| { |
| 615 |
0 |
| IV sql_type = 0; |
| 616 |
0 |
| D_imp_sth(sth); |
| 617 |
|
| SV *value; |
| 618 |
0 |
▶ | if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG) |
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG) |
0 |
0 |
0 |
| if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG) |
0 |
0 |
0 |
|
| 619 |
0 |
| croak("bind_param_inout needs a reference to a scalar value"); |
| 620 |
0 |
| value = SvRV(value_ref); |
| 621 |
0 |
▶ | if (SvREADONLY(value)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvREADONLY(value)) |
0 |
0 |
0 |
|
| 622 |
0 |
| croak("Modification of a read-only value attempted"); |
| 623 |
0 |
▶ | if (SvGMAGICAL(value)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvGMAGICAL(value)) |
0 |
0 |
0 |
|
| 624 |
0 |
| mg_get(value); |
| 625 |
0 |
▶ | if (attribs) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (attribs) { |
0 |
0 |
0 |
|
| 626 |
0 |
▶ | if (SvNIOK(attribs)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvNIOK(attribs)) { |
0 |
0 |
0 |
|
| 627 |
0 |
| sql_type = SvIV(attribs); |
| 628 |
0 |
| attribs = Nullsv; |
| 629 |
|
| } |
| 630 |
|
| else { |
| 631 |
|
| SV **svp; |
| 632 |
0 |
▶ | DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
Branch: 5 branches
| Branch | True | False | Total |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
| DBD_ATTRIBS_CHECK("bind_param", sth, attribs); |
0 |
0 |
0 |
|
| 633 |
0 |
▶ | DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
Branch: 4 branches
| Branch | True | False | Total |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
| DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); |
0 |
0 |
0 |
|
| 634 |
|
| } |
| 635 |
|
| } |
| 636 |
0 |
▶ | RETVAL = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, maxlen); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, maxlen); |
0 |
0 |
0 |
|
| 637 |
|
| } |
| 638 |
|
| OUTPUT: |
| 639 |
|
| RETVAL |
| 640 |
|
| |
| 641 |
|
| |
| 642 |
|
| void |
| 643 |
|
| execute(sth, ...) |
| 644 |
|
| SV * sth |
| 645 |
|
| CODE: |
| 646 |
0 |
| D_imp_sth(sth); |
| 647 |
|
| IV retval; |
| 648 |
0 |
▶ | if (items > 1) { /* need to bind params */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { /* need to bind params */ |
0 |
0 |
0 |
|
| 649 |
0 |
▶ | if (!dbdxst_bind_params(sth, imp_sth, items, ax) ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!dbdxst_bind_params(sth, imp_sth, items, ax) ) { |
0 |
0 |
0 |
|
| 650 |
0 |
| XSRETURN_UNDEF; |
| 651 |
|
| } |
| 652 |
|
| } |
| 653 |
|
| /* XXX this code is duplicated in selectrow_arrayref above */ |
| 654 |
0 |
| DBIc_ROW_COUNT(imp_sth) = 0; |
| 655 |
0 |
| retval = dbd_st_execute(sth, imp_sth); /* might be dbd_st_execute_iv via macro */ |
| 656 |
|
| /* remember that dbd_st_execute must return <= -2 for error */ |
| 657 |
0 |
▶ | if (retval == 0) /* ok with no rows affected */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (retval == 0) /* ok with no rows affected */ |
0 |
0 |
0 |
|
| 658 |
0 |
| XST_mPV(0, "0E0"); /* (true but zero) */ |
| 659 |
0 |
▶ | else if (retval < -1) /* -1 == unknown number of rows */ |
Branch: 1 branch
| Branch | True | False | Total |
| else if (retval < -1) /* -1 == unknown number of rows */ |
0 |
0 |
0 |
|
| 660 |
0 |
| XST_mUNDEF(0); /* <= -2 means error */ |
| 661 |
|
| else |
| 662 |
0 |
| XST_mIV(0, retval); /* typically 1, rowcount or -1 */ |
| 663 |
|
| |
| 664 |
|
| |
| 665 |
|
| #ifdef dbd_st_execute_for_fetch |
| 666 |
|
| |
| 667 |
|
| void |
| 668 |
|
| execute_for_fetch(sth, fetch_tuple_sub, tuple_status = Nullsv) |
| 669 |
|
| SV * sth |
| 670 |
|
| SV * fetch_tuple_sub |
| 671 |
|
| SV * tuple_status |
| 672 |
|
| CODE: |
| 673 |
|
| { |
| 674 |
0 |
| D_imp_sth(sth); |
| 675 |
0 |
| SV *ret = dbd_st_execute_for_fetch(sth, imp_sth, fetch_tuple_sub, tuple_status); |
| 676 |
0 |
| ST(0) = ret; |
| 677 |
|
| } |
| 678 |
|
| |
| 679 |
|
| #endif |
| 680 |
|
| |
| 681 |
|
| |
| 682 |
|
| #ifdef dbd_st_last_insert_id |
| 683 |
|
| |
| 684 |
|
| void |
| 685 |
|
| last_insert_id(sth, catalog=&PL_sv_undef, schema=&PL_sv_undef, table=&PL_sv_undef, field=&PL_sv_undef, attr=Nullsv) |
| 686 |
|
| SV * sth |
| 687 |
|
| SV * catalog |
| 688 |
|
| SV * schema |
| 689 |
|
| SV * table |
| 690 |
|
| SV * field |
| 691 |
|
| SV * attr |
| 692 |
|
| CODE: |
| 693 |
|
| { |
| 694 |
|
| D_imp_sth(sth); |
| 695 |
|
| SV *ret = dbd_st_last_insert_id(sth, imp_sth, catalog, schema, table, field, attr); |
| 696 |
|
| ST(0) = ret; |
| 697 |
|
| } |
| 698 |
|
| |
| 699 |
|
| #endif |
| 700 |
|
| |
| 701 |
|
| |
| 702 |
|
| void |
| 703 |
|
| fetchrow_arrayref(sth) |
| 704 |
|
| SV * sth |
| 705 |
|
| ALIAS: |
| 706 |
|
| fetch = 1 |
| 707 |
|
| CODE: |
| 708 |
0 |
| D_imp_sth(sth); |
| 709 |
|
| AV *av; |
| 710 |
|
| PERL_UNUSED_VAR(ix); |
| 711 |
0 |
| av = dbd_st_fetch(sth, imp_sth); |
| 712 |
0 |
▶ | ST(0) = (av) ? sv_2mortal(newRV((SV *)av)) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| ST(0) = (av) ? sv_2mortal(newRV((SV *)av)) : &PL_sv_undef; |
0 |
0 |
0 |
|
| 713 |
|
| |
| 714 |
|
| |
| 715 |
|
| void |
| 716 |
|
| fetchrow_array(sth) |
| 717 |
|
| SV * sth |
| 718 |
|
| ALIAS: |
| 719 |
|
| fetchrow = 1 |
| 720 |
|
| PPCODE: |
| 721 |
0 |
| D_imp_sth(sth); |
| 722 |
|
| AV *av; |
| 723 |
0 |
| av = dbd_st_fetch(sth, imp_sth); |
| 724 |
0 |
▶ | if (av) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (av) { |
0 |
0 |
0 |
|
| 725 |
|
| int i; |
| 726 |
0 |
| int num_fields = AvFILL(av)+1; |
| 727 |
0 |
▶ | EXTEND(sp, num_fields); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(sp, num_fields); |
0 |
0 |
0 |
| EXTEND(sp, num_fields); |
0 |
0 |
0 |
|
| 728 |
0 |
▶ | for(i=0; i < num_fields; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for(i=0; i < num_fields; ++i) { |
0 |
0 |
0 |
|
| 729 |
0 |
| PUSHs(AvARRAY(av)[i]); |
| 730 |
|
| } |
| 731 |
|
| PERL_UNUSED_VAR(ix); |
| 732 |
|
| } |
| 733 |
|
| |
| 734 |
|
| |
| 735 |
|
| void |
| 736 |
|
| fetchall_arrayref(sth, slice=&PL_sv_undef, batch_row_count=&PL_sv_undef) |
| 737 |
|
| SV * sth |
| 738 |
|
| SV * slice |
| 739 |
|
| SV * batch_row_count |
| 740 |
|
| CODE: |
| 741 |
0 |
▶ | if (SvOK(slice)) { /* fallback to perl implementation */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvOK(slice)) { /* fallback to perl implementation */ |
0 |
0 |
0 |
|
| 742 |
0 |
| SV *tmp = dbixst_bounce_method("DBD::Perl::st::SUPER::fetchall_arrayref", 3); |
| 743 |
0 |
| SPAGAIN; |
| 744 |
0 |
| ST(0) = tmp; |
| 745 |
|
| } |
| 746 |
|
| else { |
| 747 |
0 |
| SV *tmp = dbdxst_fetchall_arrayref(sth, slice, batch_row_count); |
| 748 |
0 |
| SPAGAIN; |
| 749 |
0 |
| ST(0) = tmp; |
| 750 |
|
| } |
| 751 |
|
| |
| 752 |
|
| |
| 753 |
|
| bool |
| 754 |
|
| finish(sth) |
| 755 |
|
| SV * sth |
| 756 |
|
| CODE: |
| 757 |
0 |
| D_imp_sth(sth); |
| 758 |
0 |
| D_imp_dbh_from_sth; |
| 759 |
0 |
▶ | if (!DBIc_ACTIVE(imp_sth)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_ACTIVE(imp_sth)) { |
0 |
0 |
0 |
|
| 760 |
|
| /* No active statement to finish */ |
| 761 |
0 |
| XSRETURN_YES; |
| 762 |
|
| } |
| 763 |
0 |
▶ | if (!DBIc_ACTIVE(imp_dbh)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_ACTIVE(imp_dbh)) { |
0 |
0 |
0 |
|
| 764 |
|
| /* Either an explicit disconnect() or global destruction */ |
| 765 |
|
| /* has disconnected us from the database. Finish is meaningless */ |
| 766 |
0 |
▶ | DBIc_ACTIVE_off(imp_sth); |
Branch: 5 branches
| Branch | True | False | Total |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
|
| 767 |
0 |
| XSRETURN_YES; |
| 768 |
|
| } |
| 769 |
|
| #ifdef dbd_st_finish3 |
| 770 |
|
| RETVAL = dbd_st_finish3(sth, imp_sth, 0); |
| 771 |
|
| #else |
| 772 |
0 |
▶ | RETVAL = dbd_st_finish(sth, imp_sth); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = dbd_st_finish(sth, imp_sth); |
0 |
0 |
0 |
|
| 773 |
|
| #endif |
| 774 |
|
| OUTPUT: |
| 775 |
|
| RETVAL |
| 776 |
|
| |
| 777 |
|
| |
| 778 |
|
| void |
| 779 |
|
| blob_read(sth, field, offset, len, destrv=Nullsv, destoffset=0) |
| 780 |
|
| SV * sth |
| 781 |
|
| int field |
| 782 |
|
| long offset |
| 783 |
|
| long len |
| 784 |
|
| SV * destrv |
| 785 |
|
| long destoffset |
| 786 |
|
| CODE: |
| 787 |
|
| { |
| 788 |
0 |
| D_imp_sth(sth); |
| 789 |
0 |
▶ | if (!destrv) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!destrv) |
0 |
0 |
0 |
|
| 790 |
0 |
| destrv = sv_2mortal(newRV(sv_2mortal(newSV(0)))); |
| 791 |
0 |
▶ | if (dbd_st_blob_read(sth, imp_sth, field, offset, len, destrv, destoffset)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (dbd_st_blob_read(sth, imp_sth, field, offset, len, destrv, destoffset)) |
0 |
0 |
0 |
|
| 792 |
0 |
| ST(0) = SvRV(destrv); |
| 793 |
0 |
| else ST(0) = &PL_sv_undef; |
| 794 |
|
| } |
| 795 |
|
| |
| 796 |
|
| |
| 797 |
|
| void |
| 798 |
|
| STORE(sth, keysv, valuesv) |
| 799 |
|
| SV * sth |
| 800 |
|
| SV * keysv |
| 801 |
|
| SV * valuesv |
| 802 |
|
| CODE: |
| 803 |
0 |
| D_imp_sth(sth); |
| 804 |
0 |
▶ | if (SvGMAGICAL(valuesv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvGMAGICAL(valuesv)) |
0 |
0 |
0 |
|
| 805 |
0 |
| mg_get(valuesv); |
| 806 |
0 |
| ST(0) = &PL_sv_yes; |
| 807 |
0 |
▶ | if (!dbd_st_STORE_attrib(sth, imp_sth, keysv, valuesv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!dbd_st_STORE_attrib(sth, imp_sth, keysv, valuesv)) |
0 |
0 |
0 |
|
| 808 |
0 |
▶ | if (!DBIc_DBISTATE(imp_sth)->set_attr(sth, keysv, valuesv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_DBISTATE(imp_sth)->set_attr(sth, keysv, valuesv)) |
0 |
0 |
0 |
|
| 809 |
0 |
| ST(0) = &PL_sv_no; |
| 810 |
|
| |
| 811 |
|
| |
| 812 |
|
| # FETCH renamed and ALIAS'd to avoid case clash on VMS :-( |
| 813 |
|
| void |
| 814 |
|
| FETCH_attrib(sth, keysv) |
| 815 |
|
| SV * sth |
| 816 |
|
| SV * keysv |
| 817 |
|
| ALIAS: |
| 818 |
|
| FETCH = 1 |
| 819 |
|
| CODE: |
| 820 |
0 |
| D_imp_sth(sth); |
| 821 |
|
| SV *valuesv; |
| 822 |
|
| PERL_UNUSED_VAR(ix); |
| 823 |
0 |
| valuesv = dbd_st_FETCH_attrib(sth, imp_sth, keysv); |
| 824 |
0 |
▶ | if (!valuesv) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!valuesv) |
0 |
0 |
0 |
|
| 825 |
0 |
| valuesv = DBIc_DBISTATE(imp_sth)->get_attr(sth, keysv); |
| 826 |
0 |
| ST(0) = valuesv; /* dbd_st_FETCH_attrib did sv_2mortal */ |
| 827 |
|
| |
| 828 |
|
| |
| 829 |
|
| void |
| 830 |
|
| DESTROY(sth) |
| 831 |
|
| SV * sth |
| 832 |
|
| PPCODE: |
| 833 |
|
| /* keep in sync with default DESTROY in DBI.xs */ |
| 834 |
0 |
| D_imp_sth(sth); |
| 835 |
0 |
| ST(0) = &PL_sv_yes; |
| 836 |
0 |
▶ | if (!DBIc_IMPSET(imp_sth)) { /* was never fully set up */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (!DBIc_IMPSET(imp_sth)) { /* was never fully set up */ |
0 |
0 |
0 |
|
| 837 |
|
| STRLEN lna; |
| 838 |
0 |
▶ | if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2) |
Branch: 3 branches
| Branch | True | False | Total |
| if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2) |
0 |
0 |
0 |
| if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2) |
0 |
0 |
0 |
| if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2) |
0 |
0 |
0 |
|
| 839 |
0 |
| PerlIO_printf(DBIc_LOGPIO(imp_sth), |
| 840 |
|
| " DESTROY for %s ignored - handle not initialised\n", |
| 841 |
|
| SvPV(sth,lna)); |
| 842 |
|
| } |
| 843 |
|
| else { |
| 844 |
0 |
▶ | if (DBIc_IADESTROY(imp_sth)) { /* wants ineffective destroy */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_IADESTROY(imp_sth)) { /* wants ineffective destroy */ |
0 |
0 |
0 |
|
| 845 |
0 |
▶ | DBIc_ACTIVE_off(imp_sth); |
Branch: 5 branches
| Branch | True | False | Total |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
|
| 846 |
0 |
▶ | if (DBIc_DBISTATE(imp_sth)->debug) |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_DBISTATE(imp_sth)->debug) |
0 |
0 |
0 |
|
| 847 |
0 |
| PerlIO_printf(DBIc_LOGPIO(imp_sth), " DESTROY %s skipped due to InactiveDestroy\n", SvPV_nolen(sth)); |
| 848 |
|
| } |
| 849 |
0 |
▶ | if (DBIc_ACTIVE(imp_sth)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (DBIc_ACTIVE(imp_sth)) { |
0 |
0 |
0 |
|
| 850 |
0 |
| D_imp_dbh_from_sth; |
| 851 |
0 |
▶ | if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) { |
0 |
0 |
0 |
| if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) { |
0 |
0 |
0 |
|
| 852 |
|
| #ifdef dbd_st_finish3 |
| 853 |
|
| dbd_st_finish3(sth, imp_sth, 1); |
| 854 |
|
| #else |
| 855 |
0 |
| dbd_st_finish(sth, imp_sth); |
| 856 |
|
| #endif |
| 857 |
|
| } |
| 858 |
|
| else { |
| 859 |
0 |
▶ | DBIc_ACTIVE_off(imp_sth); |
Branch: 5 branches
| Branch | True | False | Total |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
| DBIc_ACTIVE_off(imp_sth); |
0 |
0 |
0 |
|
| 860 |
|
| } |
| 861 |
|
| } |
| 862 |
0 |
| dbd_st_destroy(sth, imp_sth); |
| 863 |
|
| } |
| 864 |
|
| |
| 865 |
|
| # end of Perl.xst |
| 866 |
|
| # vim:ts=8:sw=4:et |