Bugzilla – Attachment 167384 Details for
Bug 36367
Remove context stack
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36367: Remove dbh_stack
Bug-36367-Remove-dbhstack.patch (text/plain), 2.60 KB, created by
Martin Renvoize (ashimema)
on 2024-06-04 12:10:58 UTC
(
hide
)
Description:
Bug 36367: Remove dbh_stack
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-04 12:10:58 UTC
Size:
2.60 KB
patch
obsolete
>From 848e2a4750f0a85ffe4b8b8e3f30b23c1ceba6a0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 11 Mar 2024 15:12:09 +0100 >Subject: [PATCH] Bug 36367: Remove dbh_stack > >Same pattern, remove dbh stack > >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Context.pm | 61 --------------------------------------------------- > 1 file changed, 61 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 6aa8fd36867..8366148b516 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -97,9 +97,6 @@ environment variable to the pathname of a configuration file to use. > # file (/etc/koha/koha-conf.xml). > # dbh > # A handle to the appropriate database for this context. >-# dbh_stack >-# Used by &set_dbh and &restore_dbh to hold other database >-# handles for this context. > # Zconn > # A connection object for the Zebra server > >@@ -602,14 +599,8 @@ Returns a database handle connected to the Koha database for the > current context. If no connection has yet been made, this method > creates one, and connects to the database. > >-This database handle is cached for future use: if you call >-C<C4::Context-E<gt>dbh> twice, you will get the same handle both >-times. If you need a second database handle, use C<&new_dbh> and >-possibly C<&set_dbh>. >- > =cut > >-#' > sub dbh > { > my $self = shift; >@@ -643,58 +634,6 @@ sub new_dbh > return &dbh({ new => 1 }); > } > >-=head2 set_dbh >- >- $my_dbh = C4::Connect->new_dbh; >- C4::Connect->set_dbh($my_dbh); >- ... >- C4::Connect->restore_dbh; >- >-C<&set_dbh> saves the current database handle on a stack, then sets >-the current database handle to C<$my_dbh>. >- >-C<$my_dbh> is assumed to be a good database handle. >- >-=cut >- >-#' >-sub set_dbh >-{ >- my $self = shift; >- my $new_dbh = shift; >- >- # Save the current database handle on the handle stack. >- # We assume that $new_dbh is all good: if the caller wants to >- # screw himself by passing an invalid handle, that's fine by >- # us. >- push @{$context->{"dbh_stack"}}, $context->{"dbh"}; >- $context->{"dbh"} = $new_dbh; >-} >- >-=head2 restore_dbh >- >- C4::Context->restore_dbh; >- >-Restores the database handle saved by an earlier call to >-C<C4::Context-E<gt>set_dbh>. >- >-=cut >- >-#' >-sub restore_dbh >-{ >- my $self = shift; >- >- if ($#{$context->{"dbh_stack"}} < 0) >- { >- # Stack underflow >- die "DBH stack underflow"; >- } >- >- # Pop the old database handle and set it. >- $context->{"dbh"} = pop @{$context->{"dbh_stack"}}; >-} >- > =head2 userenv > > C4::Context->userenv; >-- >2.45.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36367
:
163500
|
163501
|
163502
|
163503
|
163504
|
163505
|
163506
|
163507
|
163508
|
165115
|
165116
|
165117
|
165118
|
165119
|
165120
|
165121
|
165122
|
165123
|
165124
|
165125
|
165126
|
167380
|
167381
|
167382
|
167383
| 167384 |
167385
|
167386
|
167387
|
167388
|
167389
|
167390
|
167391