xs/abi.xs

filter: Statementstmt 100% 14 / 14 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 75.0% 21 / 28 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« include/dbil_txn.h ↑ Summary include/dbil_loop.h »
1 MODULE = DBIx::Loop PACKAGE = DBIx::Loop
2  
3 # Public C ABI entry point (dbil_abi.h / dbil_abi_impl.h): a DBI-style
4 # versioned function-pointer table for XS consumers (Punk::Model::DBIx::Loop,
5 # ...). Resolved at runtime - call_pv("DBIx::Loop::_abi_ptr"), INT2PTR, check
6 # abi_version.
7  
8 IV
9 _abi_ptr()
10 CODE:
11 2 ▶ RETVAL = PTR2IV(&dbil_abi_table);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = PTR2IV(&dbil_abi_table); 0 2 2
12 OUTPUT:
13 RETVAL
14  
15 # Resolve and exercise the whole table from C: future lifecycle (done, fail,
16 # on_ready including the already-settled case, double-settle no-op, borrowed
17 # values), is_future against things that are not futures, every select*
18 # reshape, and connect's no-croak error contract. 1 = every check passed.
19 IV
20 _abi_selftest()
21 CODE:
22 1 ▶ RETVAL = dbil_abi_selftest(aTHX);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = dbil_abi_selftest(aTHX); 0 1 1
23 OUTPUT:
24 RETVAL
25  
26 # The table's version, for tests and for a consumer that would rather ask
27 # than dereference the pointer itself.
28 IV
29 _abi_version()
30 CODE:
31 4 ▶ RETVAL = dbil_abi_table.abi_version;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = dbil_abi_table.abi_version; 0 4 4
32 OUTPUT:
33 RETVAL
34  
35 # DBIx::Loop->on_exec(\&start, \&done): the same statement-observer registry
36 # the C ABI's on_exec writes to, reached from Perl - for a consumer that is
37 # not an XS module, which on the native backend has no other hook at all
38 # (there is no DBI statement handle for $dbh->{Callbacks} to hang off).
39 # Same contract, one Perl call per statement as the price. Public.
40 IV
41 on_exec(class, start, done = &PL_sv_undef)
42 SV *class
43 SV *start
44 SV *done
45 CODE:
46 PERL_UNUSED_VAR(class);
47 4 ▶ RETVAL = dbil_obs_add_perl(aTHX_ start, done);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = dbil_obs_add_perl(aTHX_ start, done); 0 2 2
48 OUTPUT:
49 RETVAL
50  
51 # v2 on_exec, for t/13-observer.t. Registering a C callback is not something
52 # Perl can do, so the test drives these two instead.
53 IV
54 _abi_observer_install()
55 CODE:
56 1 ▶ RETVAL = dbil_obs_selftest_install(aTHX);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = dbil_obs_selftest_install(aTHX); 0 1 1
57 OUTPUT:
58 RETVAL
59  
60 # (starts, dones, resolved, failed, nbind, is_query, sql) since load.
61 void
62 _abi_observer_state()
63 PPCODE:
64 10 ▶ EXTEND(SP, 7);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP, 7); 0 10 10
65 10 mPUSHi(DBIL_OBS_ST_STARTS);
66 10 mPUSHi(DBIL_OBS_ST_DONES);
67 10 mPUSHi(DBIL_OBS_ST_OK);
68 10 mPUSHi(DBIL_OBS_ST_ERR);
69 10 mPUSHi(DBIL_OBS_ST_BIND);
70 10 mPUSHi(DBIL_OBS_ST_QUERY);
71 10 mPUSHp(DBIL_OBS_ST_SQL, strlen(DBIL_OBS_ST_SQL));
72  
73 # Drive the table against a real database: connect, exec, exec_shaped with and
74 # without binds, a C on_ready that fires when the rows land, and the failure
75 # path - all in C, with only the await going back through Perl. 1 = passed.
76 IV
77 _abi_dbtest(adapter, dsn)
78 SV *adapter
79 SV *dsn
80 CODE:
81 1 ▶ RETVAL = dbil_abi_dbtest(aTHX_ adapter, dsn);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = dbil_abi_dbtest(aTHX_ adapter, dsn); 0 1 1
82 OUTPUT:
83 RETVAL
« include/dbil_txn.h ↑ Summary include/dbil_loop.h »