Skip to content

Commit e19b5ab

Browse files
committed
Merge branch 'master' into sponge-PRECISION
2 parents 5b437c2 + 706609e commit e19b5ab

19 files changed

+354
-45
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
language: perl
22
perl:
3+
- "5.20"
4+
- "5.20-extras"
35
- "5.18"
6+
- "5.18-extras"
47
- "5.16"
58
- "5.14"
69
- "5.12"

Changes

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,48 @@ DBI::Changes - List of significant changes to the DBI
66

77
=cut
88

9-
=head2 Changes in DBI 1.632
9+
=head2 Changes in DBI 1.634
1010

11+
Fixed support for DBD prefixes with numbers (Jens Rehsack)
12+
13+
Added extra initializer for DBI::DBD::SqlEngine based DBD's (Jens Rehsack)
14+
15+
=head2 Changes in DBI 1.633 - 11th Jan 2015
16+
17+
Fixed selectrow_*ref to return undef on error in list context
18+
instead if an empty list.
19+
Changed t/42prof_data.t more informative
20+
Changed $sth->{TYPE} to be NUMERIC in DBD::File drivers as per the
21+
DBI docs. Note TYPE_NAME is now also available. [H.Merijn Brand]
22+
Fixed compilation error on bleadperl due DEFSV no longer being an lvalue
23+
[Dagfinn Ilmari Manns�ker]
24+
25+
Added docs for escaping placeholders using a backslash.
26+
Added docs for get_info(9000) indicating ability to escape placeholders.
27+
Added multi_ prefix for DBD::Multi (Dan Wright) and ad2_ prefix for
28+
DBD::AnyData2
29+
30+
=head2 Changes in DBI 1.632 - 9th Nov 2014
31+
32+
Fixed risk of memory corruption with many arguments to methods
33+
originally reported by OSCHWALD for Callbacks but may apply
34+
to other functionality in DBI method dispatch RT#86744.
1135
Fixed DBD::PurePerl to not set $sth->{Active} true by default
1236
drivers are expected to set it true as needed.
1337
Fixed DBI::DBD::SqlEngine to complain loudly when prerequite
1438
driver_prefix is not fulfilled (RT#93204) [Jens Rehsack]
39+
Fixed redundant sprintf argument warning RT#97062 [Reini Urban]
40+
Fixed security issue where DBD::File drivers would open files
41+
from folders other than specifically passed using the
42+
f_dir attribute RT#99508 [H.Merijn Brand]
43+
44+
Changed delete $h->{$key} to work for keys with 'private_' prefix
45+
per request in RT#83156. local $h->{$key} works as before.
46+
47+
Added security notice to DBD::Proxy and DBI::ProxyServer because they
48+
use Storable which is insecure. Thanks to [email protected] RT#90475
49+
Added note to AutoInactiveDestroy docs strongly recommending that it
50+
is enabled in all new code.
1551

1652
=head2 Changes in DBI 1.631 - 20th Jan 2014
1753

DBI.pm

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package DBI;
1111
require 5.008_001;
1212

1313
BEGIN {
14-
our $XS_VERSION = our $VERSION = "1.631"; # ==> ALSO update the version in the pod text below!
14+
our $XS_VERSION = our $VERSION = "1.633"; # ==> ALSO update the version in the pod text below!
1515
$VERSION = eval $VERSION;
1616
}
1717

@@ -144,7 +144,7 @@ sure that your issue isn't related to the driver you're using.
144144
145145
=head2 NOTES
146146
147-
This is the DBI specification that corresponds to DBI version 1.631
147+
This is the DBI specification that corresponds to DBI version 1.633
148148
(see L<DBI::Changes> for details).
149149
150150
The DBI is evolving at a steady pace, so it's good to check that
@@ -328,6 +328,7 @@ sub DBI::var::STORE { Carp::croak("Can't modify \$DBI::${$_[0]} special varia
328328

329329
my $dbd_prefix_registry = {
330330
ad_ => { class => 'DBD::AnyData', },
331+
ad2_ => { class => 'DBD::AnyData2', },
331332
ado_ => { class => 'DBD::ADO', },
332333
amzn_ => { class => 'DBD::Amazon', },
333334
best_ => { class => 'DBD::BestWins', },
@@ -350,6 +351,7 @@ my $dbd_prefix_registry = {
350351
msql_ => { class => 'DBD::mSQL', },
351352
mvsftp_ => { class => 'DBD::MVS_FTPSQL', },
352353
mysql_ => { class => 'DBD::mysql', },
354+
multi_ => { class => 'DBD::Multi' },
353355
mx_ => { class => 'DBD::Multiplex', },
354356
neo_ => { class => 'DBD::Neo4p', },
355357
nullp_ => { class => 'DBD::NullP', },
@@ -411,6 +413,7 @@ my $keeperr = { O=>0x0004 };
411413
'FIRSTKEY' => $keeperr,
412414
'NEXTKEY' => $keeperr,
413415
'STORE' => { O=>0x0418 | 0x4 },
416+
'DELETE' => { O=>0x0404 },
414417
can => { O=>0x0100 }, # special case, see dispatch
415418
debug => { U =>[1,2,'[$debug_level]'], O=>0x0004 }, # old name for trace
416419
dump_handle => { U =>[1,3,'[$message [, $level]]'], O=>0x0004 },
@@ -1388,7 +1391,7 @@ sub _new_sth { # called by DBD::<drivername>::db::prepare)
13881391
unless $class =~ /^DBD::(\w+)::(dr|db|st)$/;
13891392
my ($driver, $subtype) = ($1, $2);
13901393
Carp::croak("invalid method name '$method'")
1391-
unless $method =~ m/^([a-z]+_)\w+$/;
1394+
unless $method =~ m/^([a-z][a-z0-9]*_)\w+$/;
13921395
my $prefix = $1;
13931396
my $reg_info = $dbd_prefix_registry->{$prefix};
13941397
Carp::carp("method name prefix '$prefix' is not associated with a registered driver") unless $reg_info;
@@ -1635,9 +1638,9 @@ sub _new_sth { # called by DBD::<drivername>::db::prepare)
16351638
sub _do_selectrow {
16361639
my ($method, $dbh, $stmt, $attr, @bind) = @_;
16371640
my $sth = ((ref $stmt) ? $stmt : $dbh->prepare($stmt, $attr))
1638-
or return;
1641+
or return undef;
16391642
$sth->execute(@bind)
1640-
or return;
1643+
or return undef;
16411644
my $row = $sth->$method()
16421645
and $sth->finish;
16431646
return $row;
@@ -2417,6 +2420,11 @@ If the C<:>I<N> form of placeholder is supported by the driver you're using,
24172420
then you should be able to use either L</bind_param> or L</execute> to bind
24182421
values. Check your driver documentation.
24192422
2423+
Some drivers allow you to prevent the recognition of a placeholder by placing a
2424+
single backslash character (C<\>) immediately before it. The driver will remove
2425+
the backslash character and ignore the placeholder, passing it unchanged to the
2426+
backend. If the driver supports this then L</get_info>(9000) will return true.
2427+
24202428
With most drivers, placeholders can't be used for any element of a
24212429
statement that would prevent the database server from validating the
24222430
statement and creating a query execution plan for it. For example:
@@ -3689,8 +3697,8 @@ the destruction of inherited handles cause the corresponding handles in the
36893697
parent process to cease working.
36903698
36913699
Either the parent or the child process, but not both, should set
3692-
C<InactiveDestroy> true on all their shared handles. Alternatively the
3693-
L</AutoInactiveDestroy> can be set in the parent on connect.
3700+
C<InactiveDestroy> true on all their shared handles. Alternatively, and
3701+
preferably, the L</AutoInactiveDestroy> can be set in the parent on connect.
36943702
36953703
To help tracing applications using fork the process id is shown in
36963704
the trace log whenever a DBI or handle trace() method is called.
@@ -3703,12 +3711,15 @@ from the DBI's method dispatcher, e.g. >= 9.
37033711
Type: boolean, inherited
37043712
37053713
The L</InactiveDestroy> attribute, described above, needs to be explicitly set
3706-
in the child process after a fork(). This is a problem if the code that performs
3707-
the fork() is not under your control, perhaps in a third-party module.
3708-
Use C<AutoInactiveDestroy> to get around this situation.
3714+
in the child process after a fork(), on every active database and statement handle.
3715+
This is a problem if the code that performs the fork() is not under your
3716+
control, perhaps in a third-party module. Use C<AutoInactiveDestroy> to get
3717+
around this situation.
37093718
37103719
If set true, the DESTROY method will check the process id of the handle and, if
37113720
different from the current process id, it will set the I<InactiveDestroy> attribute.
3721+
It is strongly recommended that C<AutoInactiveDestroy> is enabled on all new code
3722+
(it's only not enabled by default to avoid backwards compatibility problems).
37123723
37133724
This is the example it's designed to deal with:
37143725
@@ -4963,6 +4974,13 @@ of information types to ensure the DBI itself works properly:
49634974
41 SQL_CATALOG_NAME_SEPARATOR '.' '@'
49644975
114 SQL_CATALOG_LOCATION 1 2
49654976
4977+
Values from 9000 to 9999 for get_info are officially reserved for use by Perl DBI.
4978+
Values in that range which have been assigned a meaning are defined here:
4979+
4980+
C<9000>: true if a backslash character (C<\>) before placeholder-like text
4981+
(e.g. C<?>, C<:foo>) will prevent it being treated as a placeholder by the driver.
4982+
The backslash will be removed before the text is passed to the backend.
4983+
49664984
=head3 C<table_info>
49674985
49684986
$sth = $dbh->table_info( $catalog, $schema, $table, $type );
@@ -7078,7 +7096,7 @@ For example:
70787096
my $sth2 = $dbh->prepare( $sth1->{Statement} );
70797097
my $ParamValues = $sth1->{ParamValues} || {};
70807098
my $ParamTypes = $sth1->{ParamTypes} || {};
7081-
$sth2->bind_param($_, $ParamValues->{$_} $ParamTypes->{$_})
7099+
$sth2->bind_param($_, $ParamValues->{$_}, $ParamTypes->{$_})
70827100
for keys %{ {%$ParamValues, %$ParamTypes} };
70837101
$sth2->execute();
70847102

DBI.xs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,7 +2900,7 @@ dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t
29002900
PUSHs( sv_2mortal(newSVpv(method_pv,0)));
29012901
PUTBACK;
29022902
SAVE_DEFSV; /* local($_) = $statement */
2903-
DEFSV = statement_sv;
2903+
DEFSV_set(statement_sv);
29042904
items = call_sv(code_sv, G_ARRAY);
29052905
SPAGAIN;
29062906
SP -= items ;
@@ -3147,6 +3147,7 @@ XS(XS_DBI_dispatch); /* prototype to pass -Wmissing-prototypes */
31473147
XS(XS_DBI_dispatch)
31483148
{
31493149
dXSARGS;
3150+
dORIGMARK;
31503151
dMY_CXT;
31513152

31523153
SV *h = ST(0); /* the DBI handle we are working with */
@@ -3447,6 +3448,7 @@ XS(XS_DBI_dispatch)
34473448
XPUSHs(*hp);
34483449
PUTBACK;
34493450
call_method("DESTROY", G_DISCARD|G_EVAL|G_KEEPERR);
3451+
MSPAGAIN;
34503452
}
34513453
else {
34523454
imp_xxh_t *imp_xxh = dbih_getcom2(aTHX_ *hp, 0);
@@ -3539,8 +3541,8 @@ XS(XS_DBI_dispatch)
35393541
SV *code = SvRV(*hook_svp);
35403542
I32 skip_dispatch = 0;
35413543
if (trace_level)
3542-
PerlIO_printf(DBILOGFP, "%c {{ %s callback %s being invoked\n",
3543-
(PL_dirty?'!':' '), meth_name, neatsvpv(*hook_svp,0));
3544+
PerlIO_printf(DBILOGFP, "%c {{ %s callback %s being invoked with %ld args\n",
3545+
(PL_dirty?'!':' '), meth_name, neatsvpv(*hook_svp,0), (long)items);
35443546

35453547
/* we don't use ENTER,SAVETMPS & FREETMPS,LEAVE because we may need mortal
35463548
* results to live long enough to be returned to our caller
@@ -3552,7 +3554,7 @@ XS(XS_DBI_dispatch)
35523554
*/
35533555
orig_defsv = DEFSV; /* remember the current $_ */
35543556
SAVE_DEFSV; /* local($_) = $method_name */
3555-
DEFSV = sv_2mortal(newSVpv(meth_name,0));
3557+
DEFSV_set(sv_2mortal(newSVpv(meth_name,0)));
35563558

35573559
EXTEND(SP, items+1);
35583560
PUSHMARK(SP);
@@ -3562,14 +3564,14 @@ XS(XS_DBI_dispatch)
35623564
}
35633565
PUTBACK;
35643566
outitems = call_sv(code, G_ARRAY); /* call the callback code */
3565-
SPAGAIN;
3567+
MSPAGAIN;
35663568

35673569
/* The callback code can undef $_ to indicate to skip dispatch */
35683570
skip_dispatch = !SvOK(DEFSV);
35693571
/* put $_ back now, but with an incremented ref count to compensate
35703572
* for the ref count decrement that will happen when we exit the scope.
35713573
*/
3572-
DEFSV = SvREFCNT_inc(orig_defsv);
3574+
DEFSV_set(SvREFCNT_inc(orig_defsv));
35733575

35743576
if (trace_level)
35753577
PerlIO_printf(DBILOGFP, "%c }} %s callback %s returned%s\n",
@@ -3890,7 +3892,7 @@ XS(XS_DBI_dispatch)
38903892
XPUSHs(&PL_sv_yes);
38913893
PUTBACK;
38923894
call_method("STORE", G_DISCARD);
3893-
SPAGAIN;
3895+
MSPAGAIN;
38943896
}
38953897
}
38963898
}
@@ -4047,7 +4049,7 @@ XS(XS_DBI_dispatch)
40474049
XPUSHs( result );
40484050
PUTBACK;
40494051
items = call_sv(*hook_svp, G_SCALAR);
4050-
SPAGAIN;
4052+
MSPAGAIN;
40514053
status = (items) ? POPs : &PL_sv_undef;
40524054
PUTBACK;
40534055
if (trace_level)
@@ -4155,7 +4157,7 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo)
41554157
char rt_comment = '\0';
41564158
char *dest, *start;
41574159
const char *src;
4158-
const char *style = "", *laststyle = '\0';
4160+
const char *style = "", *laststyle = NULL;
41594161
SV *new_stmt_sv;
41604162

41614163
(void)foo;
@@ -5445,6 +5447,19 @@ FETCH(h, keysv)
54455447
ST(0) = dbih_get_attr_k(h, keysv, 0);
54465448
(void)cv;
54475449

5450+
void
5451+
DELETE(h, keysv)
5452+
SV * h
5453+
SV * keysv
5454+
CODE:
5455+
/* only private_* keys can be deleted, for others DELETE acts like FETCH */
5456+
/* because the DBI internals rely on certain handle attributes existing */
5457+
if (strnEQ(SvPV_nolen(keysv),"private_",8))
5458+
ST(0) = hv_delete_ent((HV*)SvRV(h), keysv, 0, 0);
5459+
else
5460+
ST(0) = dbih_get_attr_k(h, keysv, 0);
5461+
(void)cv;
5462+
54485463

54495464
void
54505465
private_data(h)

Makefile.PL

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ my %opts = (
6464
MailingList => 'mailto:[email protected]',
6565
license => 'http://dev.perl.org/licenses/',
6666
homepage => 'http://dbi.perl.org/',
67+
IRC => 'irc://irc.perl.org/#dbi',
6768
},
6869
suggests => {
6970
'RPC::PlServer' => 0.2001,

0 commit comments

Comments
 (0)