line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBD::Gofer::Policy::rush; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: rush.pm 10087 2007-10-16 12:42:37Z Tim $ |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Copyright (c) 2007, Tim Bunce, Ireland |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public |
8
|
|
|
|
|
|
|
# License or the Artistic License, as specified in the Perl README file. |
9
|
|
|
|
|
|
|
|
10
|
9
|
|
|
9
|
|
8750
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
300
|
|
11
|
9
|
|
|
9
|
|
48
|
use warnings; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
500
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = "0.010088"; |
14
|
|
|
|
|
|
|
|
15
|
9
|
|
|
9
|
|
55
|
use base qw(DBD::Gofer::Policy::Base); |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
2000
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->create_policy_subs({ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# always use connect_cached on server |
20
|
|
|
|
|
|
|
connect_method => 'connect_cached', |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# use same methods on server as is called on client |
23
|
|
|
|
|
|
|
# (because code not using placeholders would bloat the sth cache) |
24
|
|
|
|
|
|
|
prepare_method => '', |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Skipping the connect check is fast, but it also skips |
27
|
|
|
|
|
|
|
# fetching the remote dbh attributes! |
28
|
|
|
|
|
|
|
# Make sure that your application doesn't need access to dbh attributes. |
29
|
|
|
|
|
|
|
skip_connect_check => 1, |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# most code doesn't rely on sth attributes being set after prepare |
32
|
|
|
|
|
|
|
skip_prepare_check => 1, |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# we're happy to use local method if that's the same as the remote |
35
|
|
|
|
|
|
|
skip_default_methods => 1, |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# ping is almost meaningless for DBD::Gofer and most transports anyway |
38
|
|
|
|
|
|
|
skip_ping => 1, |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# don't update dbh attributes at all |
41
|
|
|
|
|
|
|
# XXX actually we currently need dbh_attribute_update for skip_default_methods to work |
42
|
|
|
|
|
|
|
# and skip_default_methods is more valuable to us than the cost of dbh_attribute_update |
43
|
|
|
|
|
|
|
dbh_attribute_update => 'none', # actually means 'first' currently |
44
|
|
|
|
|
|
|
#dbh_attribute_list => undef, |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# we'd like to set locally_* but can't because drivers differ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# in a rush assume metadata doesn't change |
49
|
|
|
|
|
|
|
cache_tables => 1, |
50
|
|
|
|
|
|
|
cache_table_info => 1, |
51
|
|
|
|
|
|
|
cache_column_info => 1, |
52
|
|
|
|
|
|
|
cache_primary_key_info => 1, |
53
|
|
|
|
|
|
|
cache_foreign_key_info => 1, |
54
|
|
|
|
|
|
|
cache_statistics_info => 1, |
55
|
|
|
|
|
|
|
cache_get_info => 1, |
56
|
|
|
|
|
|
|
}); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
DBD::Gofer::Policy::rush - The 'rush' policy for DBD::Gofer |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$dbh = DBI->connect("dbi:Gofer:transport=...;policy=rush", ...) |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The C policy tries to make as few round-trips as possible. |
72
|
|
|
|
|
|
|
It's the opposite end of the policy spectrum to the C policy. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Temporary docs: See the source code for list of policies and their defaults. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
In a future version the policies and their defaults will be defined in the pod and parsed out at load-time. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Tim Bunce, L |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
87
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|