ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/perlmulticore/perlmulticore.pod
(Generate patch)

Comparing perlmulticore/perlmulticore.pod (file contents):
Revision 1.11 by root, Mon Mar 4 06:36:37 2019 UTC vs.
Revision 1.12 by root, Mon Mar 4 06:42:05 2019 UTC

593 593
594=back 594=back
595 595
596Pick your poison. 596Pick your poison.
597 597
598=head2 Case Study: C<DBD::SQLite>
599
600Last not least, while the abovew case studies show some difficult
601examples, let's look at a more typical easy case, L<DBD::SQLite>.
602
603Practically all work is done by calling C<_sqlite_exec> in F<dbdimp.c>, so
604other than providing the file and adding
605
606 #include "perlmulticore.h"
607
608To that file, you only need to change the call to C<sqlite3_exec> in
609that function by sandwiching it between C<perlinterp_release> and
610C<perlinterp_acquire>:
611
612 perlinterp_release (); // added
613 rc = sqlite3_exec(db, sql, NULL, NULL, &errmsg);
614 perlinterp_acquire (); // added
615
616To also catch the database opening phase, the same needs to be done for
617C<_sqlite_open>:
618
619 _sqlite_open(pTHX_ SV *dbh, const char *dbname, sqlite3 **db, int flags, int extended)
620 {
621 int rc;
622 perlinterp_release (); // added
623 if (flags) {
624 rc = sqlite3_open_v2(dbname, db, flags, NULL);
625 } else {
626 rc = sqlite3_open(dbname, db);
627 }
628 perlinterp_acquire (); // added
629 if ( rc != SQLITE_OK ) {
630
631And that is it.
598 632
599=head1 SEE ALSO 633=head1 SEE ALSO
600 634
601This document's canonical web address: L<http://perlmulticore.schmorp.de/> 635This document's canonical web address: L<http://perlmulticore.schmorp.de/>
602 636

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines