… | |
… | |
593 | |
593 | |
594 | =back |
594 | =back |
595 | |
595 | |
596 | Pick your poison. |
596 | Pick your poison. |
597 | |
597 | |
|
|
598 | =head2 Case Study: C<DBD::SQLite> |
|
|
599 | |
|
|
600 | Last not least, while the abovew case studies show some difficult |
|
|
601 | examples, let's look at a more typical easy case, L<DBD::SQLite>. |
|
|
602 | |
|
|
603 | Practically all work is done by calling C<_sqlite_exec> in F<dbdimp.c>, so |
|
|
604 | other than providing the file and adding |
|
|
605 | |
|
|
606 | #include "perlmulticore.h" |
|
|
607 | |
|
|
608 | To that file, you only need to change the call to C<sqlite3_exec> in |
|
|
609 | that function by sandwiching it between C<perlinterp_release> and |
|
|
610 | C<perlinterp_acquire>: |
|
|
611 | |
|
|
612 | perlinterp_release (); // added |
|
|
613 | rc = sqlite3_exec(db, sql, NULL, NULL, &errmsg); |
|
|
614 | perlinterp_acquire (); // added |
|
|
615 | |
|
|
616 | To also catch the database opening phase, the same needs to be done for |
|
|
617 | C<_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 | |
|
|
631 | And that is it. |
598 | |
632 | |
599 | =head1 SEE ALSO |
633 | =head1 SEE ALSO |
600 | |
634 | |
601 | This document's canonical web address: L<http://perlmulticore.schmorp.de/> |
635 | This document's canonical web address: L<http://perlmulticore.schmorp.de/> |
602 | |
636 | |