|
Lines 27-32
use C4::Debug;
Link Here
|
| 27 |
require Exporter; |
27 |
require Exporter; |
| 28 |
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); |
28 |
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); |
| 29 |
|
29 |
|
|
|
30 |
eval { |
| 31 |
my $servers = C4::Context->config('memcached_servers'); |
| 32 |
if ($servers) { |
| 33 |
require Memoize::Memcached; |
| 34 |
import Memoize::Memcached qw(memoize_memcached); |
| 35 |
|
| 36 |
my $memcached = { |
| 37 |
servers => [ $servers ], |
| 38 |
key_prefix => C4::Context->config('memcached_namespace') || 'koha', |
| 39 |
}; |
| 40 |
|
| 41 |
memoize_memcached('_get_columns', memcached => $memcached, expire_time => 600000); #cache for 10 minutes |
| 42 |
memoize_memcached('GetPrimaryKeys', memcached => $memcached, expire_time => 600000); #cache for 10 minutes |
| 43 |
} |
| 44 |
}; |
| 45 |
|
| 46 |
|
| 30 |
BEGIN { |
47 |
BEGIN { |
| 31 |
# set the version for version checking |
48 |
# set the version for version checking |
| 32 |
$VERSION = 0.5; |
49 |
$VERSION = 0.5; |
|
Lines 44-50
BEGIN {
Link Here
|
| 44 |
} |
61 |
} |
| 45 |
|
62 |
|
| 46 |
my $tablename; |
63 |
my $tablename; |
| 47 |
my $hash; |
64 |
my $hashref; |
| 48 |
|
65 |
|
| 49 |
=head1 NAME |
66 |
=head1 NAME |
| 50 |
|
67 |
|
|
Lines 231-240
With
Link Here
|
| 231 |
|
248 |
|
| 232 |
sub _get_columns($) { |
249 |
sub _get_columns($) { |
| 233 |
my ($tablename)=@_; |
250 |
my ($tablename)=@_; |
| 234 |
my $dbh=C4::Context->dbh; |
251 |
unless (exists ($hashref->{$tablename})){ |
| 235 |
my $sth=$dbh->prepare_cached(qq{SHOW COLUMNS FROM $tablename }); |
252 |
my $dbh=C4::Context->dbh; |
| 236 |
$sth->execute; |
253 |
my $sth=$dbh->prepare_cached(qq{SHOW COLUMNS FROM $tablename }); |
| 237 |
my $columns= $sth->fetchall_hashref(qw(Field)); |
254 |
$sth->execute; |
|
|
255 |
my $columns= $sth->fetchall_hashref(qw(Field)); |
| 256 |
$hashref->{$tablename}=$columns; |
| 257 |
} |
| 258 |
return $hashref->{$tablename}; |
| 238 |
} |
259 |
} |
| 239 |
|
260 |
|
| 240 |
=head2 _filter_columns |
261 |
=head2 _filter_columns |
| 241 |
- |
|
|