Filename | /usr/lib/x86_64-linux-gnu/perl5/5.20/DBD/mysql.pm |
Statements | Executed 2049 statements in 18.7ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
293 | 6 | 4 | 1.87ms | 5.07ms | __ANON__[:799] | DBD::mysql::st::
166 | 13 | 9 | 1.45ms | 4.26ms | prepare | DBD::mysql::db::
1 | 1 | 1 | 1.44ms | 1.44ms | _login (xsub) | DBD::mysql::db::
1 | 1 | 1 | 1.07ms | 1.18ms | get_info | DBD::mysql::db::
1 | 1 | 1 | 511µs | 4.50ms | BEGIN@113 | DBD::mysql::dr::
166 | 1 | 1 | 328µs | 328µs | _prepare (xsub) | DBD::mysql::st::
71 | 3 | 2 | 310µs | 921µs | __ANON__[:810] | DBD::mysql::st::
1 | 1 | 1 | 246µs | 316µs | BEGIN@111 | DBD::mysql::dr::
1 | 1 | 1 | 65µs | 364µs | BEGIN@112 | DBD::mysql::dr::
1 | 1 | 1 | 63µs | 1.58ms | connect | DBD::mysql::dr::
1 | 1 | 1 | 40µs | 40µs | BEGIN@785 | DBD::mysql::st::
1 | 1 | 1 | 37µs | 54µs | _OdbcParse | DBD::mysql::
1 | 1 | 1 | 21µs | 21µs | BEGIN@766 | DBD::mysql::db::
1 | 1 | 1 | 20µs | 32µs | BEGIN@196 | DBD::mysql::db::
6 | 2 | 1 | 18µs | 18µs | CORE:match (opcode) | DBD::mysql::
1 | 1 | 1 | 14µs | 37µs | BEGIN@770 | DBD::mysql::db::
1 | 1 | 1 | 14µs | 24µs | BEGIN@3 | DBI::_firesafe::
1 | 1 | 1 | 12µs | 40µs | BEGIN@9 | DBD::mysql::
1 | 1 | 1 | 11µs | 253µs | BEGIN@197 | DBD::mysql::db::
1 | 1 | 1 | 10µs | 40µs | BEGIN@11 | DBD::mysql::
1 | 1 | 1 | 10µs | 17µs | BEGIN@4 | DBI::_firesafe::
1 | 1 | 1 | 9µs | 16µs | BEGIN@783 | DBD::mysql::st::
1 | 1 | 1 | 9µs | 14µs | BEGIN@803 | DBD::mysql::st::
1 | 1 | 1 | 8µs | 12µs | BEGIN@790 | DBD::mysql::st::
1 | 1 | 1 | 4µs | 4µs | BEGIN@10 | DBD::mysql::
0 | 0 | 0 | 0s | 0s | AUTOLOAD | DBD::mysql::
0 | 0 | 0 | 0s | 0s | CLONE | DBD::mysql::
0 | 0 | 0 | 0s | 0s | _OdbcParseHost | DBD::mysql::
0 | 0 | 0 | 0s | 0s | ANSI2db | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | _ListTables | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | _SelectDB | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | __ANON__[:777] | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | _version | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | admin | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | column_info | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | db2ANSI | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | foreign_key_info | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | primary_key_info | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | table_info | DBD::mysql::db::
0 | 0 | 0 | 0s | 0s | admin | DBD::mysql::dr::
0 | 0 | 0 | 0s | 0s | data_sources | DBD::mysql::dr::
0 | 0 | 0 | 0s | 0s | driver | DBD::mysql::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | #!/usr/bin/perl | ||||
2 | |||||
3 | 2 | 40µs | 2 | 34µs | # spent 24µs (14+10) within DBI::_firesafe::BEGIN@3 which was called:
# once (14µs+10µs) by DBI::connect at line 3 # spent 24µs making 1 call to DBI::_firesafe::BEGIN@3
# spent 10µs making 1 call to strict::import |
4 | 2 | 64µs | 2 | 24µs | # spent 17µs (10+7) within DBI::_firesafe::BEGIN@4 which was called:
# once (10µs+7µs) by DBI::connect at line 4 # spent 17µs making 1 call to DBI::_firesafe::BEGIN@4
# spent 7µs making 1 call to warnings::import |
5 | 1 | 20µs | require 5.008_001; # just as DBI | ||
6 | |||||
7 | package DBD::mysql; | ||||
8 | |||||
9 | 2 | 63µs | 2 | 67µs | # spent 40µs (12+27) within DBD::mysql::BEGIN@9 which was called:
# once (12µs+27µs) by DBI::connect at line 9 # spent 40µs making 1 call to DBD::mysql::BEGIN@9
# spent 28µs making 1 call to Exporter::import |
10 | 2 | 26µs | 1 | 4µs | # spent 4µs within DBD::mysql::BEGIN@10 which was called:
# once (4µs+0s) by DBI::connect at line 10 # spent 4µs making 1 call to DBD::mysql::BEGIN@10 |
11 | 2 | 334µs | 2 | 70µs | # spent 40µs (10+30) within DBD::mysql::BEGIN@11 which was called:
# once (10µs+30µs) by DBI::connect at line 11 # spent 40µs making 1 call to DBD::mysql::BEGIN@11
# spent 30µs making 1 call to Exporter::import |
12 | 1 | 18µs | our @ISA = qw(DynaLoader); | ||
13 | 1 | 300ns | our $VERSION = '4.028'; | ||
14 | |||||
15 | 1 | 1.54ms | 1 | 1.52ms | bootstrap DBD::mysql $VERSION; # spent 1.52ms making 1 call to DynaLoader::bootstrap |
16 | |||||
17 | |||||
18 | 1 | 400ns | our $err = 0; # holds error code for DBI::err | ||
19 | 1 | 400ns | our $errstr = ""; # holds error string for DBI::errstr | ||
20 | 1 | 600ns | our $drh = undef; # holds driver handle once initialised | ||
21 | |||||
22 | 1 | 400ns | my $methods_are_installed = 0; | ||
23 | sub driver{ | ||||
24 | 1 | 300ns | return $drh if $drh; | ||
25 | 1 | 700ns | my($class, $attr) = @_; | ||
26 | |||||
27 | 1 | 900ns | $class .= "::dr"; | ||
28 | |||||
29 | # not a 'my' since we use it above to prevent multiple drivers | ||||
30 | 1 | 56µs | 1 | 42µs | $drh = DBI::_new_drh($class, { 'Name' => 'mysql', # spent 42µs making 1 call to DBI::_new_drh |
31 | 'Version' => $VERSION, | ||||
32 | 'Err' => \$DBD::mysql::err, | ||||
33 | 'Errstr' => \$DBD::mysql::errstr, | ||||
34 | 'Attribution' => 'DBD::mysql by Patrick Galbraith' | ||||
35 | }); | ||||
36 | |||||
37 | 1 | 700ns | if (!$methods_are_installed) { | ||
38 | 1 | 54µs | 1 | 42µs | DBD::mysql::db->install_method('mysql_fd'); # spent 42µs making 1 call to DBD::_::common::install_method |
39 | 1 | 18µs | 1 | 14µs | DBD::mysql::db->install_method('mysql_async_result'); # spent 14µs making 1 call to DBD::_::common::install_method |
40 | 1 | 18µs | 1 | 12µs | DBD::mysql::db->install_method('mysql_async_ready'); # spent 12µs making 1 call to DBD::_::common::install_method |
41 | 1 | 26µs | 1 | 17µs | DBD::mysql::st->install_method('mysql_async_result'); # spent 17µs making 1 call to DBD::_::common::install_method |
42 | 1 | 15µs | 1 | 12µs | DBD::mysql::st->install_method('mysql_async_ready'); # spent 12µs making 1 call to DBD::_::common::install_method |
43 | |||||
44 | 1 | 600ns | $methods_are_installed++; | ||
45 | } | ||||
46 | |||||
47 | 1 | 700ns | $drh; | ||
48 | } | ||||
49 | |||||
50 | sub CLONE { | ||||
51 | undef $drh; | ||||
52 | } | ||||
53 | |||||
54 | # spent 54µs (37+18) within DBD::mysql::_OdbcParse which was called:
# once (37µs+18µs) by DBD::mysql::dr::connect at line 135 | ||||
55 | 1 | 700ns | my($class, $dsn, $hash, $args) = @_; | ||
56 | 1 | 400ns | my($var, $val); | ||
57 | 1 | 300ns | if (!defined($dsn)) { | ||
58 | return; | ||||
59 | } | ||||
60 | 1 | 6µs | while (length($dsn)) { | ||
61 | 3 | 23µs | 3 | 12µs | if ($dsn =~ /([^:;]*\[.*]|[^:;]*)[:;](.*)/) { # spent 12µs making 3 calls to DBD::mysql::CORE:match, avg 4µs/call |
62 | 2 | 2µs | $val = $1; | ||
63 | 2 | 1µs | $dsn = $2; | ||
64 | } else { | ||||
65 | 1 | 500ns | $val = $dsn; | ||
66 | 1 | 600ns | $dsn = ''; | ||
67 | } | ||||
68 | 3 | 12µs | 3 | 5µs | if ($val =~ /([^=]*)=(.*)/) { # spent 5µs making 3 calls to DBD::mysql::CORE:match, avg 2µs/call |
69 | 3 | 2µs | $var = $1; | ||
70 | 3 | 1µs | $val = $2; | ||
71 | 3 | 4µs | if ($var eq 'hostname' || $var eq 'host') { | ||
72 | $hash->{'host'} = $val; | ||||
73 | } elsif ($var eq 'db' || $var eq 'dbname') { | ||||
74 | $hash->{'database'} = $val; | ||||
75 | } else { | ||||
76 | 2 | 3µs | $hash->{$var} = $val; | ||
77 | } | ||||
78 | } else { | ||||
79 | foreach $var (@$args) { | ||||
80 | if (!defined($hash->{$var})) { | ||||
81 | $hash->{$var} = $val; | ||||
82 | last; | ||||
83 | } | ||||
84 | } | ||||
85 | } | ||||
86 | } | ||||
87 | } | ||||
88 | |||||
89 | sub _OdbcParseHost ($$) { | ||||
90 | my($class, $dsn) = @_; | ||||
91 | my($hash) = {}; | ||||
92 | $class->_OdbcParse($dsn, $hash, ['host', 'port']); | ||||
93 | ($hash->{'host'}, $hash->{'port'}); | ||||
94 | } | ||||
95 | |||||
96 | sub AUTOLOAD { | ||||
97 | my ($meth) = $DBD::mysql::AUTOLOAD; | ||||
98 | my ($smeth) = $meth; | ||||
99 | $smeth =~ s/(.*)\:\://; | ||||
100 | |||||
101 | my $val = constant($smeth, @_ ? $_[0] : 0); | ||||
102 | if ($! == 0) { eval "sub $meth { $val }"; return $val; } | ||||
103 | |||||
104 | Carp::croak "$meth: Not defined"; | ||||
105 | } | ||||
106 | |||||
107 | 1; | ||||
108 | |||||
109 | |||||
110 | package DBD::mysql::dr; # ====== DRIVER ====== | ||||
111 | 2 | 436µs | 2 | 386µs | # spent 316µs (246+70) within DBD::mysql::dr::BEGIN@111 which was called:
# once (246µs+70µs) by DBI::connect at line 111 # spent 316µs making 1 call to DBD::mysql::dr::BEGIN@111
# spent 70µs making 1 call to strict::import |
112 | 2 | 365µs | 2 | 662µs | # spent 364µs (65+299) within DBD::mysql::dr::BEGIN@112 which was called:
# once (65µs+299µs) by DBI::connect at line 112 # spent 364µs making 1 call to DBD::mysql::dr::BEGIN@112
# spent 299µs making 1 call to Exporter::import |
113 | 2 | 681µs | 2 | 4.59ms | # spent 4.50ms (511µs+3.99) within DBD::mysql::dr::BEGIN@113 which was called:
# once (511µs+3.99ms) by DBI::connect at line 113 # spent 4.50ms making 1 call to DBD::mysql::dr::BEGIN@113
# spent 90µs making 1 call to Exporter::import |
114 | |||||
115 | # spent 1.58ms (63µs+1.52) within DBD::mysql::dr::connect which was called:
# once (63µs+1.52ms) by DBI::connect at line 671 of DBI.pm | ||||
116 | 1 | 1µs | my($drh, $dsn, $username, $password, $attrhash) = @_; | ||
117 | 1 | 300ns | my($port); | ||
118 | my($cWarn); | ||||
119 | 1 | 1µs | my $connect_ref= { 'Name' => $dsn }; | ||
120 | 1 | 200ns | my $dbi_imp_data; | ||
121 | |||||
122 | # Avoid warnings for undefined values | ||||
123 | 1 | 200ns | $username ||= ''; | ||
124 | 1 | 100ns | $password ||= ''; | ||
125 | 1 | 200ns | $attrhash ||= {}; | ||
126 | |||||
127 | # create a 'blank' dbh | ||||
128 | 1 | 500ns | my($this, $privateAttrHash) = (undef, $attrhash); | ||
129 | 1 | 8µs | $privateAttrHash = { %$privateAttrHash, | ||
130 | 'Name' => $dsn, | ||||
131 | 'user' => $username, | ||||
132 | 'password' => $password | ||||
133 | }; | ||||
134 | |||||
135 | 1 | 4µs | 1 | 54µs | DBD::mysql->_OdbcParse($dsn, $privateAttrHash, # spent 54µs making 1 call to DBD::mysql::_OdbcParse |
136 | ['database', 'host', 'port']); | ||||
137 | |||||
138 | |||||
139 | 1 | 2µs | if ($DBI::VERSION >= 1.49) | ||
140 | { | ||||
141 | 1 | 800ns | $dbi_imp_data = delete $attrhash->{dbi_imp_data}; | ||
142 | 1 | 600ns | $connect_ref->{'dbi_imp_data'} = $dbi_imp_data; | ||
143 | } | ||||
144 | |||||
145 | 1 | 32µs | 1 | 26µs | if (!defined($this = DBI::_new_dbh($drh, # spent 26µs making 1 call to DBI::_new_dbh |
146 | $connect_ref, | ||||
147 | $privateAttrHash))) | ||||
148 | { | ||||
149 | return undef; | ||||
150 | } | ||||
151 | |||||
152 | 1 | 1.46ms | 1 | 1.44ms | DBD::mysql::db::_login($this, $dsn, $username, $password) # spent 1.44ms making 1 call to DBD::mysql::db::_login |
153 | or $this = undef; | ||||
154 | |||||
155 | 1 | 12µs | if ($this && ($ENV{MOD_PERL} || $ENV{GATEWAY_INTERFACE})) { | ||
156 | $this->{mysql_auto_reconnect} = 1; | ||||
157 | } | ||||
158 | 1 | 6µs | $this; | ||
159 | } | ||||
160 | |||||
161 | sub data_sources { | ||||
162 | my($self) = shift; | ||||
163 | my($attributes) = shift; | ||||
164 | my($host, $port, $user, $password) = ('', '', '', ''); | ||||
165 | if ($attributes) { | ||||
166 | $host = $attributes->{host} || ''; | ||||
167 | $port = $attributes->{port} || ''; | ||||
168 | $user = $attributes->{user} || ''; | ||||
169 | $password = $attributes->{password} || ''; | ||||
170 | } | ||||
171 | my(@dsn) = $self->func($host, $port, $user, $password, '_ListDBs'); | ||||
172 | my($i); | ||||
173 | for ($i = 0; $i < @dsn; $i++) { | ||||
174 | $dsn[$i] = "DBI:mysql:$dsn[$i]"; | ||||
175 | } | ||||
176 | @dsn; | ||||
177 | } | ||||
178 | |||||
179 | sub admin { | ||||
180 | my($drh) = shift; | ||||
181 | my($command) = shift; | ||||
182 | my($dbname) = ($command eq 'createdb' || $command eq 'dropdb') ? | ||||
183 | shift : ''; | ||||
184 | my($host, $port) = DBD::mysql->_OdbcParseHost(shift(@_) || ''); | ||||
185 | my($user) = shift || ''; | ||||
186 | my($password) = shift || ''; | ||||
187 | |||||
188 | $drh->func(undef, $command, | ||||
189 | $dbname || '', | ||||
190 | $host || '', | ||||
191 | $port || '', | ||||
192 | $user, $password, '_admin_internal'); | ||||
193 | } | ||||
194 | |||||
195 | package DBD::mysql::db; # ====== DATABASE ====== | ||||
196 | 2 | 57µs | 2 | 45µs | # spent 32µs (20+13) within DBD::mysql::db::BEGIN@196 which was called:
# once (20µs+13µs) by DBI::connect at line 196 # spent 32µs making 1 call to DBD::mysql::db::BEGIN@196
# spent 12µs making 1 call to strict::import |
197 | 2 | 2.71ms | 2 | 496µs | # spent 253µs (11+243) within DBD::mysql::db::BEGIN@197 which was called:
# once (11µs+243µs) by DBI::connect at line 197 # spent 253µs making 1 call to DBD::mysql::db::BEGIN@197
# spent 243µs making 1 call to Exporter::import |
198 | |||||
199 | 1 | 4µs | %DBD::mysql::db::db2ANSI = ( | ||
200 | "INT" => "INTEGER", | ||||
201 | "CHAR" => "CHAR", | ||||
202 | "REAL" => "REAL", | ||||
203 | "IDENT" => "DECIMAL" | ||||
204 | ); | ||||
205 | |||||
206 | ### ANSI datatype mapping to MySQL datatypes | ||||
207 | 1 | 12µs | %DBD::mysql::db::ANSI2db = ( | ||
208 | "CHAR" => "CHAR", | ||||
209 | "VARCHAR" => "CHAR", | ||||
210 | "LONGVARCHAR" => "CHAR", | ||||
211 | "NUMERIC" => "INTEGER", | ||||
212 | "DECIMAL" => "INTEGER", | ||||
213 | "BIT" => "INTEGER", | ||||
214 | "TINYINT" => "INTEGER", | ||||
215 | "SMALLINT" => "INTEGER", | ||||
216 | "INTEGER" => "INTEGER", | ||||
217 | "BIGINT" => "INTEGER", | ||||
218 | "REAL" => "REAL", | ||||
219 | "FLOAT" => "REAL", | ||||
220 | "DOUBLE" => "REAL", | ||||
221 | "BINARY" => "CHAR", | ||||
222 | "VARBINARY" => "CHAR", | ||||
223 | "LONGVARBINARY" => "CHAR", | ||||
224 | "DATE" => "CHAR", | ||||
225 | "TIME" => "CHAR", | ||||
226 | "TIMESTAMP" => "CHAR" | ||||
227 | ); | ||||
228 | |||||
229 | # spent 4.26ms (1.45+2.81) within DBD::mysql::db::prepare which was called 166 times, avg 26µs/call:
# 103 times (865µs+1.68ms) by C4::Languages::getTranslatedLanguages at line 382 of C4/Languages.pm, avg 25µs/call
# 50 times (376µs+744µs) by C4::Languages::getTranslatedLanguages at line 389 of C4/Languages.pm, avg 22µs/call
# 3 times (51µs+125µs) by DBD::_::db::prepare_cached at line 1717 of DBI.pm, avg 59µs/call
# once (48µs+32µs) by C4::Members::GetMember at line 449 of C4/Members.pm
# once (38µs+37µs) by C4::NewsChannels::GetNewsToDisplay at line 215 of C4/NewsChannels.pm
# once (12µs+35µs) by DBI::db::prepare at line 123 of C4/Review.pm
# once (12µs+33µs) by DBI::db::prepare at line 417 of C4/Suggestions.pm
# once (12µs+33µs) by DBI::db::prepare at line 1973 of C4/Auth.pm
# once (9µs+21µs) by DBI::db::prepare at line 1948 of C4/Auth.pm
# once (8µs+19µs) by DBI::db::prepare at line 122 of Koha/Borrower/Modifications.pm
# once (8µs+18µs) by DBI::db::prepare at line 120 of C4/Tags.pm
# once (8µs+18µs) by DBI::db::prepare at line 1919 of C4/Auth.pm
# once (8µs+17µs) by DBI::db::prepare at line 1868 of C4/Auth.pm | ||||
230 | 166 | 87µs | my($dbh, $statement, $attribs)= @_; | ||
231 | |||||
232 | 166 | 553µs | 166 | 215µs | return unless $dbh->func('_async_check'); # spent 215µs making 166 calls to DBI::common::func, avg 1µs/call |
233 | |||||
234 | # create a 'blank' dbh | ||||
235 | 166 | 2.75ms | 166 | 2.27ms | my $sth = DBI::_new_sth($dbh, {'Statement' => $statement}); # spent 2.27ms making 166 calls to DBI::_new_sth, avg 14µs/call |
236 | |||||
237 | # Populate internal handle data. | ||||
238 | 166 | 585µs | 166 | 328µs | if (!DBD::mysql::st::_prepare($sth, $statement, $attribs)) { # spent 328µs making 166 calls to DBD::mysql::st::_prepare, avg 2µs/call |
239 | $sth = undef; | ||||
240 | } | ||||
241 | |||||
242 | 166 | 291µs | $sth; | ||
243 | } | ||||
244 | |||||
245 | sub db2ANSI { | ||||
246 | my $self = shift; | ||||
247 | my $type = shift; | ||||
248 | return $DBD::mysql::db::db2ANSI{"$type"}; | ||||
249 | } | ||||
250 | |||||
251 | sub ANSI2db { | ||||
252 | my $self = shift; | ||||
253 | my $type = shift; | ||||
254 | return $DBD::mysql::db::ANSI2db{"$type"}; | ||||
255 | } | ||||
256 | |||||
257 | sub admin { | ||||
258 | my($dbh) = shift; | ||||
259 | my($command) = shift; | ||||
260 | my($dbname) = ($command eq 'createdb' || $command eq 'dropdb') ? | ||||
261 | shift : ''; | ||||
262 | $dbh->{'Driver'}->func($dbh, $command, $dbname, '', '', '', | ||||
263 | '_admin_internal'); | ||||
264 | } | ||||
265 | |||||
266 | sub _SelectDB ($$) { | ||||
267 | die "_SelectDB is removed from this module; use DBI->connect instead."; | ||||
268 | } | ||||
269 | |||||
270 | sub table_info ($) { | ||||
271 | my ($dbh, $catalog, $schema, $table, $type, $attr) = @_; | ||||
272 | $dbh->{mysql_server_prepare}||= 0; | ||||
273 | my $mysql_server_prepare_save= $dbh->{mysql_server_prepare}; | ||||
274 | $dbh->{mysql_server_prepare}= 0; | ||||
275 | my @names = qw(TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS); | ||||
276 | my @rows; | ||||
277 | |||||
278 | my $sponge = DBI->connect("DBI:Sponge:", '','') | ||||
279 | or return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr"); | ||||
280 | |||||
281 | # Return the list of catalogs | ||||
282 | if (defined $catalog && $catalog eq "%" && | ||||
283 | (!defined($schema) || $schema eq "") && | ||||
284 | (!defined($table) || $table eq "")) | ||||
285 | { | ||||
286 | @rows = (); # Empty, because MySQL doesn't support catalogs (yet) | ||||
287 | } | ||||
288 | # Return the list of schemas | ||||
289 | elsif (defined $schema && $schema eq "%" && | ||||
290 | (!defined($catalog) || $catalog eq "") && | ||||
291 | (!defined($table) || $table eq "")) | ||||
292 | { | ||||
293 | my $sth = $dbh->prepare("SHOW DATABASES") | ||||
294 | or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
295 | return undef); | ||||
296 | |||||
297 | $sth->execute() | ||||
298 | or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
299 | return DBI::set_err($dbh, $sth->err(), $sth->errstr())); | ||||
300 | |||||
301 | while (my $ref = $sth->fetchrow_arrayref()) | ||||
302 | { | ||||
303 | push(@rows, [ undef, $ref->[0], undef, undef, undef ]); | ||||
304 | } | ||||
305 | } | ||||
306 | # Return the list of table types | ||||
307 | elsif (defined $type && $type eq "%" && | ||||
308 | (!defined($catalog) || $catalog eq "") && | ||||
309 | (!defined($schema) || $schema eq "") && | ||||
310 | (!defined($table) || $table eq "")) | ||||
311 | { | ||||
312 | @rows = ( | ||||
313 | [ undef, undef, undef, "TABLE", undef ], | ||||
314 | [ undef, undef, undef, "VIEW", undef ], | ||||
315 | ); | ||||
316 | } | ||||
317 | # Special case: a catalog other than undef, "", or "%" | ||||
318 | elsif (defined $catalog && $catalog ne "" && $catalog ne "%") | ||||
319 | { | ||||
320 | @rows = (); # Nothing, because MySQL doesn't support catalogs yet. | ||||
321 | } | ||||
322 | # Uh oh, we actually have a meaty table_info call. Work is required! | ||||
323 | else | ||||
324 | { | ||||
325 | my @schemas; | ||||
326 | # If no table was specified, we want them all | ||||
327 | $table ||= "%"; | ||||
328 | |||||
329 | # If something was given for the schema, we need to expand it to | ||||
330 | # a list of schemas, since it may be a wildcard. | ||||
331 | if (defined $schema && $schema ne "") | ||||
332 | { | ||||
333 | my $sth = $dbh->prepare("SHOW DATABASES LIKE " . | ||||
334 | $dbh->quote($schema)) | ||||
335 | or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
336 | return undef); | ||||
337 | $sth->execute() | ||||
338 | or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
339 | return DBI::set_err($dbh, $sth->err(), $sth->errstr())); | ||||
340 | |||||
341 | while (my $ref = $sth->fetchrow_arrayref()) | ||||
342 | { | ||||
343 | push @schemas, $ref->[0]; | ||||
344 | } | ||||
345 | } | ||||
346 | # Otherwise we want the current database | ||||
347 | else | ||||
348 | { | ||||
349 | push @schemas, $dbh->selectrow_array("SELECT DATABASE()"); | ||||
350 | } | ||||
351 | |||||
352 | # Figure out which table types are desired | ||||
353 | my ($want_tables, $want_views); | ||||
354 | if (defined $type && $type ne "") | ||||
355 | { | ||||
356 | $want_tables = ($type =~ m/table/i); | ||||
357 | $want_views = ($type =~ m/view/i); | ||||
358 | } | ||||
359 | else | ||||
360 | { | ||||
361 | $want_tables = $want_views = 1; | ||||
362 | } | ||||
363 | |||||
364 | for my $database (@schemas) | ||||
365 | { | ||||
366 | my $sth = $dbh->prepare("SHOW /*!50002 FULL*/ TABLES FROM " . | ||||
367 | $dbh->quote_identifier($database) . | ||||
368 | " LIKE " . $dbh->quote($table)) | ||||
369 | or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
370 | return undef); | ||||
371 | |||||
372 | $sth->execute() or | ||||
373 | ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
374 | return DBI::set_err($dbh, $sth->err(), $sth->errstr())); | ||||
375 | |||||
376 | while (my $ref = $sth->fetchrow_arrayref()) | ||||
377 | { | ||||
378 | my $type = (defined $ref->[1] && | ||||
379 | $ref->[1] =~ /view/i) ? 'VIEW' : 'TABLE'; | ||||
380 | next if $type eq 'TABLE' && not $want_tables; | ||||
381 | next if $type eq 'VIEW' && not $want_views; | ||||
382 | push @rows, [ undef, $database, $ref->[0], $type, undef ]; | ||||
383 | } | ||||
384 | } | ||||
385 | } | ||||
386 | |||||
387 | my $sth = $sponge->prepare("table_info", | ||||
388 | { | ||||
389 | rows => \@rows, | ||||
390 | NUM_OF_FIELDS => scalar @names, | ||||
391 | NAME => \@names, | ||||
392 | }) | ||||
393 | or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
394 | return $dbh->DBI::set_err($sponge->err(), $sponge->errstr())); | ||||
395 | |||||
396 | $dbh->{mysql_server_prepare}= $mysql_server_prepare_save; | ||||
397 | return $sth; | ||||
398 | } | ||||
399 | |||||
400 | sub _ListTables { | ||||
401 | my $dbh = shift; | ||||
402 | if (!$DBD::mysql::QUIET) { | ||||
403 | warn "_ListTables is deprecated, use \$dbh->tables()"; | ||||
404 | } | ||||
405 | return map { $_ =~ s/.*\.//; $_ } $dbh->tables(); | ||||
406 | } | ||||
407 | |||||
408 | |||||
409 | sub column_info { | ||||
410 | my ($dbh, $catalog, $schema, $table, $column) = @_; | ||||
411 | |||||
412 | return unless $dbh->func('_async_check'); | ||||
413 | |||||
414 | $dbh->{mysql_server_prepare}||= 0; | ||||
415 | my $mysql_server_prepare_save= $dbh->{mysql_server_prepare}; | ||||
416 | $dbh->{mysql_server_prepare}= 0; | ||||
417 | |||||
418 | # ODBC allows a NULL to mean all columns, so we'll accept undef | ||||
419 | $column = '%' unless defined $column; | ||||
420 | |||||
421 | my $ER_NO_SUCH_TABLE= 1146; | ||||
422 | |||||
423 | my $table_id = $dbh->quote_identifier($catalog, $schema, $table); | ||||
424 | |||||
425 | my @names = qw( | ||||
426 | TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME | ||||
427 | DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS | ||||
428 | NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF | ||||
429 | SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH | ||||
430 | ORDINAL_POSITION IS_NULLABLE CHAR_SET_CAT | ||||
431 | CHAR_SET_SCHEM CHAR_SET_NAME COLLATION_CAT COLLATION_SCHEM COLLATION_NAME | ||||
432 | UDT_CAT UDT_SCHEM UDT_NAME DOMAIN_CAT DOMAIN_SCHEM DOMAIN_NAME | ||||
433 | SCOPE_CAT SCOPE_SCHEM SCOPE_NAME MAX_CARDINALITY | ||||
434 | DTD_IDENTIFIER IS_SELF_REF | ||||
435 | mysql_is_pri_key mysql_type_name mysql_values | ||||
436 | mysql_is_auto_increment | ||||
437 | ); | ||||
438 | my %col_info; | ||||
439 | |||||
440 | local $dbh->{FetchHashKeyName} = 'NAME_lc'; | ||||
441 | # only ignore ER_NO_SUCH_TABLE in internal_execute if issued from here | ||||
442 | my $desc_sth = $dbh->prepare("DESCRIBE $table_id " . $dbh->quote($column)); | ||||
443 | my $desc = $dbh->selectall_arrayref($desc_sth, { Columns=>{} }); | ||||
444 | |||||
445 | #return $desc_sth if $desc_sth->err(); | ||||
446 | if (my $err = $desc_sth->err()) | ||||
447 | { | ||||
448 | # return the error, unless it is due to the table not | ||||
449 | # existing per DBI spec | ||||
450 | if ($err != $ER_NO_SUCH_TABLE) | ||||
451 | { | ||||
452 | $dbh->{mysql_server_prepare}= $mysql_server_prepare_save; | ||||
453 | return undef; | ||||
454 | } | ||||
455 | $dbh->set_err(undef,undef); | ||||
456 | $desc = []; | ||||
457 | } | ||||
458 | |||||
459 | my $ordinal_pos = 0; | ||||
460 | my @fields; | ||||
461 | for my $row (@$desc) | ||||
462 | { | ||||
463 | my $type = $row->{type}; | ||||
464 | $type =~ m/^(\w+)(\((.+)\))?\s?(.*)?$/; | ||||
465 | my $basetype = lc($1); | ||||
466 | my $typemod = $3; | ||||
467 | my $attr = $4; | ||||
468 | |||||
469 | push @fields, $row->{field}; | ||||
470 | my $info = $col_info{ $row->{field} }= { | ||||
471 | TABLE_CAT => $catalog, | ||||
472 | TABLE_SCHEM => $schema, | ||||
473 | TABLE_NAME => $table, | ||||
474 | COLUMN_NAME => $row->{field}, | ||||
475 | NULLABLE => ($row->{null} eq 'YES') ? 1 : 0, | ||||
476 | IS_NULLABLE => ($row->{null} eq 'YES') ? "YES" : "NO", | ||||
477 | TYPE_NAME => uc($basetype), | ||||
478 | COLUMN_DEF => $row->{default}, | ||||
479 | ORDINAL_POSITION => ++$ordinal_pos, | ||||
480 | mysql_is_pri_key => ($row->{key} eq 'PRI'), | ||||
481 | mysql_type_name => $row->{type}, | ||||
482 | mysql_is_auto_increment => ($row->{extra} =~ /auto_increment/i ? 1 : 0), | ||||
483 | }; | ||||
484 | # | ||||
485 | # This code won't deal with a pathological case where a value | ||||
486 | # contains a single quote followed by a comma, and doesn't unescape | ||||
487 | # any escaped values. But who would use those in an enum or set? | ||||
488 | # | ||||
489 | my @type_params= ($typemod && index($typemod,"'")>=0) ? | ||||
490 | ("$typemod," =~ /'(.*?)',/g) # assume all are quoted | ||||
491 | : split /,/, $typemod||''; # no quotes, plain list | ||||
492 | s/''/'/g for @type_params; # undo doubling of quotes | ||||
493 | |||||
494 | my @type_attr= split / /, $attr||''; | ||||
495 | |||||
496 | $info->{DATA_TYPE}= SQL_VARCHAR(); | ||||
497 | if ($basetype =~ /^(char|varchar|\w*text|\w*blob)/) | ||||
498 | { | ||||
499 | $info->{DATA_TYPE}= SQL_CHAR() if $basetype eq 'char'; | ||||
500 | if ($type_params[0]) | ||||
501 | { | ||||
502 | $info->{COLUMN_SIZE} = $type_params[0]; | ||||
503 | } | ||||
504 | else | ||||
505 | { | ||||
506 | $info->{COLUMN_SIZE} = 65535; | ||||
507 | $info->{COLUMN_SIZE} = 255 if $basetype =~ /^tiny/; | ||||
508 | $info->{COLUMN_SIZE} = 16777215 if $basetype =~ /^medium/; | ||||
509 | $info->{COLUMN_SIZE} = 4294967295 if $basetype =~ /^long/; | ||||
510 | } | ||||
511 | } | ||||
512 | elsif ($basetype =~ /^(binary|varbinary)/) | ||||
513 | { | ||||
514 | $info->{COLUMN_SIZE} = $type_params[0]; | ||||
515 | # SQL_BINARY & SQL_VARBINARY are tempting here but don't match the | ||||
516 | # semantics for mysql (not hex). SQL_CHAR & SQL_VARCHAR are correct here. | ||||
517 | $info->{DATA_TYPE} = ($basetype eq 'binary') ? SQL_CHAR() : SQL_VARCHAR(); | ||||
518 | } | ||||
519 | elsif ($basetype =~ /^(enum|set)/) | ||||
520 | { | ||||
521 | if ($basetype eq 'set') | ||||
522 | { | ||||
523 | $info->{COLUMN_SIZE} = length(join ",", @type_params); | ||||
524 | } | ||||
525 | else | ||||
526 | { | ||||
527 | my $max_len = 0; | ||||
528 | length($_) > $max_len and $max_len = length($_) for @type_params; | ||||
529 | $info->{COLUMN_SIZE} = $max_len; | ||||
530 | } | ||||
531 | $info->{"mysql_values"} = \@type_params; | ||||
532 | } | ||||
533 | elsif ($basetype =~ /int/) | ||||
534 | { | ||||
535 | # big/medium/small/tiny etc + unsigned? | ||||
536 | $info->{DATA_TYPE} = SQL_INTEGER(); | ||||
537 | $info->{NUM_PREC_RADIX} = 10; | ||||
538 | $info->{COLUMN_SIZE} = $type_params[0]; | ||||
539 | } | ||||
540 | elsif ($basetype =~ /^decimal/) | ||||
541 | { | ||||
542 | $info->{DATA_TYPE} = SQL_DECIMAL(); | ||||
543 | $info->{NUM_PREC_RADIX} = 10; | ||||
544 | $info->{COLUMN_SIZE} = $type_params[0]; | ||||
545 | $info->{DECIMAL_DIGITS} = $type_params[1]; | ||||
546 | } | ||||
547 | elsif ($basetype =~ /^(float|double)/) | ||||
548 | { | ||||
549 | $info->{DATA_TYPE} = ($basetype eq 'float') ? SQL_FLOAT() : SQL_DOUBLE(); | ||||
550 | $info->{NUM_PREC_RADIX} = 2; | ||||
551 | $info->{COLUMN_SIZE} = ($basetype eq 'float') ? 32 : 64; | ||||
552 | } | ||||
553 | elsif ($basetype =~ /date|time/) | ||||
554 | { | ||||
555 | # date/datetime/time/timestamp | ||||
556 | if ($basetype eq 'time' or $basetype eq 'date') | ||||
557 | { | ||||
558 | #$info->{DATA_TYPE} = ($basetype eq 'time') ? SQL_TYPE_TIME() : SQL_TYPE_DATE(); | ||||
559 | $info->{DATA_TYPE} = ($basetype eq 'time') ? SQL_TIME() : SQL_DATE(); | ||||
560 | $info->{COLUMN_SIZE} = ($basetype eq 'time') ? 8 : 10; | ||||
561 | } | ||||
562 | else | ||||
563 | { | ||||
564 | # datetime/timestamp | ||||
565 | #$info->{DATA_TYPE} = SQL_TYPE_TIMESTAMP(); | ||||
566 | $info->{DATA_TYPE} = SQL_TIMESTAMP(); | ||||
567 | $info->{SQL_DATA_TYPE} = SQL_DATETIME(); | ||||
568 | $info->{SQL_DATETIME_SUB} = $info->{DATA_TYPE} - ($info->{SQL_DATA_TYPE} * 10); | ||||
569 | $info->{COLUMN_SIZE} = ($basetype eq 'datetime') ? 19 : $type_params[0] || 14; | ||||
570 | } | ||||
571 | $info->{DECIMAL_DIGITS}= 0; # no fractional seconds | ||||
572 | } | ||||
573 | elsif ($basetype eq 'year') | ||||
574 | { | ||||
575 | # no close standard so treat as int | ||||
576 | $info->{DATA_TYPE} = SQL_INTEGER(); | ||||
577 | $info->{NUM_PREC_RADIX} = 10; | ||||
578 | $info->{COLUMN_SIZE} = 4; | ||||
579 | } | ||||
580 | else | ||||
581 | { | ||||
582 | Carp::carp("column_info: unrecognized column type '$basetype' of $table_id.$row->{field} treated as varchar"); | ||||
583 | } | ||||
584 | $info->{SQL_DATA_TYPE} ||= $info->{DATA_TYPE}; | ||||
585 | #warn Dumper($info); | ||||
586 | } | ||||
587 | |||||
588 | my $sponge = DBI->connect("DBI:Sponge:", '','') | ||||
589 | or ( $dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
590 | return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr")); | ||||
591 | |||||
592 | my $sth = $sponge->prepare("column_info $table", { | ||||
593 | rows => [ map { [ @{$_}{@names} ] } map { $col_info{$_} } @fields ], | ||||
594 | NUM_OF_FIELDS => scalar @names, | ||||
595 | NAME => \@names, | ||||
596 | }) or | ||||
597 | return ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
598 | $dbh->DBI::set_err($sponge->err(), $sponge->errstr())); | ||||
599 | |||||
600 | $dbh->{mysql_server_prepare}= $mysql_server_prepare_save; | ||||
601 | return $sth; | ||||
602 | } | ||||
603 | |||||
604 | |||||
605 | sub primary_key_info { | ||||
606 | my ($dbh, $catalog, $schema, $table) = @_; | ||||
607 | |||||
608 | return unless $dbh->func('_async_check'); | ||||
609 | |||||
610 | $dbh->{mysql_server_prepare}||= 0; | ||||
611 | my $mysql_server_prepare_save= $dbh->{mysql_server_prepare}; | ||||
612 | |||||
613 | my $table_id = $dbh->quote_identifier($catalog, $schema, $table); | ||||
614 | |||||
615 | my @names = qw( | ||||
616 | TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME | ||||
617 | ); | ||||
618 | my %col_info; | ||||
619 | |||||
620 | local $dbh->{FetchHashKeyName} = 'NAME_lc'; | ||||
621 | my $desc_sth = $dbh->prepare("SHOW KEYS FROM $table_id"); | ||||
622 | my $desc= $dbh->selectall_arrayref($desc_sth, { Columns=>{} }); | ||||
623 | my $ordinal_pos = 0; | ||||
624 | for my $row (grep { $_->{key_name} eq 'PRIMARY'} @$desc) | ||||
625 | { | ||||
626 | $col_info{ $row->{column_name} }= { | ||||
627 | TABLE_CAT => $catalog, | ||||
628 | TABLE_SCHEM => $schema, | ||||
629 | TABLE_NAME => $table, | ||||
630 | COLUMN_NAME => $row->{column_name}, | ||||
631 | KEY_SEQ => $row->{seq_in_index}, | ||||
632 | PK_NAME => $row->{key_name}, | ||||
633 | }; | ||||
634 | } | ||||
635 | |||||
636 | my $sponge = DBI->connect("DBI:Sponge:", '','') | ||||
637 | or | ||||
638 | ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
639 | return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr")); | ||||
640 | |||||
641 | my $sth= $sponge->prepare("primary_key_info $table", { | ||||
642 | rows => [ | ||||
643 | map { [ @{$_}{@names} ] } | ||||
644 | sort { $a->{KEY_SEQ} <=> $b->{KEY_SEQ} } | ||||
645 | values %col_info | ||||
646 | ], | ||||
647 | NUM_OF_FIELDS => scalar @names, | ||||
648 | NAME => \@names, | ||||
649 | }) or | ||||
650 | ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && | ||||
651 | return $dbh->DBI::set_err($sponge->err(), $sponge->errstr())); | ||||
652 | |||||
653 | $dbh->{mysql_server_prepare}= $mysql_server_prepare_save; | ||||
654 | |||||
655 | return $sth; | ||||
656 | } | ||||
657 | |||||
658 | |||||
659 | sub foreign_key_info { | ||||
660 | my ($dbh, | ||||
661 | $pk_catalog, $pk_schema, $pk_table, | ||||
662 | $fk_catalog, $fk_schema, $fk_table, | ||||
663 | ) = @_; | ||||
664 | |||||
665 | return unless $dbh->func('_async_check'); | ||||
666 | |||||
667 | # INFORMATION_SCHEMA.KEY_COLUMN_USAGE was added in 5.0.6 | ||||
668 | # no one is going to be running 5.0.6, taking out the check for $point > .6 | ||||
669 | my ($maj, $min, $point) = _version($dbh); | ||||
670 | return if $maj < 5 ; | ||||
671 | |||||
672 | my $sql = <<'EOF'; | ||||
673 | SELECT NULL AS PKTABLE_CAT, | ||||
674 | A.REFERENCED_TABLE_SCHEMA AS PKTABLE_SCHEM, | ||||
675 | A.REFERENCED_TABLE_NAME AS PKTABLE_NAME, | ||||
676 | A.REFERENCED_COLUMN_NAME AS PKCOLUMN_NAME, | ||||
677 | A.TABLE_CATALOG AS FKTABLE_CAT, | ||||
678 | A.TABLE_SCHEMA AS FKTABLE_SCHEM, | ||||
679 | A.TABLE_NAME AS FKTABLE_NAME, | ||||
680 | A.COLUMN_NAME AS FKCOLUMN_NAME, | ||||
681 | A.ORDINAL_POSITION AS KEY_SEQ, | ||||
682 | NULL AS UPDATE_RULE, | ||||
683 | NULL AS DELETE_RULE, | ||||
684 | A.CONSTRAINT_NAME AS FK_NAME, | ||||
685 | NULL AS PK_NAME, | ||||
686 | NULL AS DEFERABILITY, | ||||
687 | NULL AS UNIQUE_OR_PRIMARY | ||||
688 | FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE A, | ||||
689 | INFORMATION_SCHEMA.TABLE_CONSTRAINTS B | ||||
690 | WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME | ||||
691 | AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE IS NOT NULL | ||||
692 | EOF | ||||
693 | |||||
694 | my @where; | ||||
695 | my @bind; | ||||
696 | |||||
697 | # catalogs are not yet supported by MySQL | ||||
698 | |||||
699 | # if (defined $pk_catalog) { | ||||
700 | # push @where, 'A.REFERENCED_TABLE_CATALOG = ?'; | ||||
701 | # push @bind, $pk_catalog; | ||||
702 | # } | ||||
703 | |||||
704 | if (defined $pk_schema) { | ||||
705 | push @where, 'A.REFERENCED_TABLE_SCHEMA = ?'; | ||||
706 | push @bind, $pk_schema; | ||||
707 | } | ||||
708 | |||||
709 | if (defined $pk_table) { | ||||
710 | push @where, 'A.REFERENCED_TABLE_NAME = ?'; | ||||
711 | push @bind, $pk_table; | ||||
712 | } | ||||
713 | |||||
714 | # if (defined $fk_catalog) { | ||||
715 | # push @where, 'A.TABLE_CATALOG = ?'; | ||||
716 | # push @bind, $fk_schema; | ||||
717 | # } | ||||
718 | |||||
719 | if (defined $fk_schema) { | ||||
720 | push @where, 'A.TABLE_SCHEMA = ?'; | ||||
721 | push @bind, $fk_schema; | ||||
722 | } | ||||
723 | |||||
724 | if (defined $fk_table) { | ||||
725 | push @where, 'A.TABLE_NAME = ?'; | ||||
726 | push @bind, $fk_table; | ||||
727 | } | ||||
728 | |||||
729 | if (@where) { | ||||
730 | $sql .= ' AND '; | ||||
731 | $sql .= join ' AND ', @where; | ||||
732 | } | ||||
733 | $sql .= " ORDER BY A.TABLE_SCHEMA, A.TABLE_NAME, A.ORDINAL_POSITION"; | ||||
734 | |||||
735 | local $dbh->{FetchHashKeyName} = 'NAME_uc'; | ||||
736 | my $sth = $dbh->prepare($sql); | ||||
737 | $sth->execute(@bind); | ||||
738 | |||||
739 | return $sth; | ||||
740 | } | ||||
741 | |||||
742 | |||||
743 | sub _version { | ||||
744 | my $dbh = shift; | ||||
745 | |||||
746 | return | ||||
747 | $dbh->get_info($DBI::Const::GetInfoType::GetInfoType{SQL_DBMS_VER}) | ||||
748 | =~ /(\d+)\.(\d+)\.(\d+)/; | ||||
749 | } | ||||
750 | |||||
751 | |||||
752 | #################### | ||||
753 | # get_info() | ||||
754 | # Generated by DBI::DBD::Metadata | ||||
755 | |||||
756 | # spent 1.18ms (1.07+101µs) within DBD::mysql::db::get_info which was called:
# once (1.07ms+101µs) by DBI::db::get_info at line 1170 of DBIx/Class/Storage/DBI.pm | ||||
757 | 1 | 600ns | my($dbh, $info_type) = @_; | ||
758 | |||||
759 | 1 | 16µs | 1 | 5µs | return unless $dbh->func('_async_check'); # spent 5µs making 1 call to DBI::common::func |
760 | 1 | 150µs | require DBD::mysql::GetInfo; | ||
761 | 1 | 2µs | my $v = $DBD::mysql::GetInfo::info{int($info_type)}; | ||
762 | 1 | 4µs | 1 | 17µs | $v = $v->($dbh) if ref $v eq 'CODE'; # spent 17µs making 1 call to DBD::mysql::GetInfo::__ANON__[DBD/mysql/GetInfo.pm:75] |
763 | 1 | 3µs | return $v; | ||
764 | } | ||||
765 | |||||
766 | # spent 21µs within DBD::mysql::db::BEGIN@766 which was called:
# once (21µs+0s) by DBI::connect at line 779 | ||||
767 | 1 | 2µs | my @needs_async_check = qw/data_sources statistics_info quote_identifier begin_work/; | ||
768 | |||||
769 | 1 | 8µs | foreach my $method (@needs_async_check) { | ||
770 | 2 | 112µs | 2 | 59µs | # spent 37µs (14+23) within DBD::mysql::db::BEGIN@770 which was called:
# once (14µs+23µs) by DBI::connect at line 770 # spent 37µs making 1 call to DBD::mysql::db::BEGIN@770
# spent 23µs making 1 call to strict::unimport |
771 | |||||
772 | 4 | 2µs | my $super = "SUPER::$method"; | ||
773 | *$method = sub { | ||||
774 | my $h = shift; | ||||
775 | return unless $h->func('_async_check'); | ||||
776 | return $h->$super(@_); | ||||
777 | 4 | 12µs | }; | ||
778 | } | ||||
779 | 1 | 61µs | 1 | 21µs | } # spent 21µs making 1 call to DBD::mysql::db::BEGIN@766 |
780 | |||||
781 | |||||
782 | package DBD::mysql::st; # ====== STATEMENT ====== | ||||
783 | 2 | 65µs | 2 | 23µs | # spent 16µs (9+7) within DBD::mysql::st::BEGIN@783 which was called:
# once (9µs+7µs) by DBI::connect at line 783 # spent 16µs making 1 call to DBD::mysql::st::BEGIN@783
# spent 7µs making 1 call to strict::import |
784 | |||||
785 | # spent 40µs within DBD::mysql::st::BEGIN@785 which was called:
# once (40µs+0s) by DBI::connect at line 812 | ||||
786 | 1 | 900ns | my @needs_async_result = qw/fetchrow_hashref fetchall_hashref/; | ||
787 | 1 | 8µs | my @needs_async_check = qw/bind_param_array bind_col bind_columns execute_for_fetch/; | ||
788 | |||||
789 | 1 | 700ns | foreach my $method (@needs_async_result) { | ||
790 | 2 | 116µs | 2 | 17µs | # spent 12µs (8+5) within DBD::mysql::st::BEGIN@790 which was called:
# once (8µs+5µs) by DBI::connect at line 790 # spent 12µs making 1 call to DBD::mysql::st::BEGIN@790
# spent 5µs making 1 call to strict::unimport |
791 | |||||
792 | 2 | 1µs | my $super = "SUPER::$method"; | ||
793 | # spent 5.07ms (1.87+3.19) within DBD::mysql::st::__ANON__[/usr/lib/x86_64-linux-gnu/perl5/5.20/DBD/mysql.pm:799] which was called 293 times, avg 17µs/call:
# 156 times (1.07ms+1.79ms) by C4::Languages::getTranslatedLanguages at line 385 of C4/Languages.pm, avg 18µs/call
# 77 times (325µs+608µs) by DBI::st::fetchrow_hashref at line 1954 of C4/Auth.pm, avg 12µs/call
# 55 times (414µs+669µs) by C4::Languages::getTranslatedLanguages at line 391 of C4/Languages.pm, avg 20µs/call
# 3 times (44µs+89µs) by C4::NewsChannels::GetNewsToDisplay at line 219 of C4/NewsChannels.pm, avg 44µs/call
# once (12µs+19µs) by DBI::st::fetchrow_hashref at line 1928 of C4/Auth.pm
# once (11µs+19µs) by DBI::st::fetchrow_hashref at line 124 of Koha/Borrower/Modifications.pm | ||||
794 | 293 | 89µs | my $sth = shift; | ||
795 | 293 | 1.10ms | 293 | 311µs | if(defined $sth->mysql_async_ready) { # spent 311µs making 293 calls to DBI::st::mysql_async_ready, avg 1µs/call |
796 | return unless $sth->mysql_async_result; | ||||
797 | } | ||||
798 | 293 | 3.95ms | 879 | 3.94ms | return $sth->$super(@_); # spent 2.88ms making 293 calls to DBD::_::st::fetchrow_hashref, avg 10µs/call
# spent 590µs making 293 calls to DBI::common::FETCH, avg 2µs/call
# spent 471µs making 293 calls to DBI::st::fetch, avg 2µs/call |
799 | 2 | 8µs | }; | ||
800 | } | ||||
801 | |||||
802 | 1 | 5µs | foreach my $method (@needs_async_check) { | ||
803 | 2 | 84µs | 2 | 19µs | # spent 14µs (9+5) within DBD::mysql::st::BEGIN@803 which was called:
# once (9µs+5µs) by DBI::connect at line 803 # spent 14µs making 1 call to DBD::mysql::st::BEGIN@803
# spent 5µs making 1 call to strict::unimport |
804 | |||||
805 | 4 | 2µs | my $super = "SUPER::$method"; | ||
806 | # spent 921µs (310+611) within DBD::mysql::st::__ANON__[/usr/lib/x86_64-linux-gnu/perl5/5.20/DBD/mysql.pm:810] which was called 71 times, avg 13µs/call:
# 69 times (279µs+83µs) by DBD::_::st::bind_columns at line 1899 of DBI.pm, avg 5µs/call
# once (23µs+506µs) by DBD::_::st::fetchall_arrayref at line 2064 of DBI.pm
# once (9µs+22µs) by DBI::st::bind_columns at line 128 of DBIx/Class/Storage/DBI/Cursor.pm | ||||
807 | 71 | 10µs | my $h = shift; | ||
808 | 71 | 164µs | 71 | 46µs | return unless $h->func('_async_check'); # spent 46µs making 71 calls to DBI::common::func, avg 652ns/call |
809 | 71 | 285µs | 71 | 564µs | return $h->$super(@_); # spent 523µs making 2 calls to DBD::_::st::bind_columns, avg 262µs/call
# spent 41µs making 69 calls to DBD::_::st::bind_col, avg 593ns/call |
810 | 4 | 16µs | }; | ||
811 | } | ||||
812 | 1 | 46µs | 1 | 40µs | } # spent 40µs making 1 call to DBD::mysql::st::BEGIN@785 |
813 | |||||
814 | 1 | 13µs | 1; | ||
815 | |||||
816 | __END__ | ||||
sub DBD::mysql::CORE:match; # opcode | |||||
# spent 1.44ms within DBD::mysql::db::_login which was called:
# once (1.44ms+0s) by DBD::mysql::dr::connect at line 152 | |||||
# spent 328µs within DBD::mysql::st::_prepare which was called 166 times, avg 2µs/call:
# 166 times (328µs+0s) by DBD::mysql::db::prepare at line 238, avg 2µs/call |