Skip to content

Commit 723f25e

Browse files
committed
Merge branch 'master' into topic/constructor_rewrite
Add some extra code to enforce the assumption that any bind type constant is accessible in _dbi_attrs_for_bind, or in other words that all necessary DBDs are already loaded (concept originally introduced in ad7c50f) Without this the combination of 9930caa (do not recalculate bind attrs on dbh_do retry) and a2f2285 (do not wrap iterators in dbh_do) can result in _dbi_attrs_for_bind being called before DBI/DBD::* has been loaded at all
2 parents 894108b + 048c244 commit 723f25e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+772
-424
lines changed

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ matrix:
8282
- CLEANTEST=false
8383
- BREWOPTS="-Duseithreads"
8484
- BREWVER=5.8.5
85+
- DBIC_TRACE_PROFILE=console
8586

8687
# minimum supported without threads
8788
- perl: 5.8.3_nt
8889
env:
8990
- CLEANTEST=false
9091
- BREWOPTS=""
9192
- BREWVER=5.8.3
93+
- DBIC_TRACE_PROFILE=console_monochrome
9294

9395
# check CLEANTEST of minimum supported
9496
- perl: 5.8.3_nt_mb
@@ -111,6 +113,26 @@ matrix:
111113
- BREWOPTS="-Duseithreads -Dusemorebits"
112114
- BREWVER=5.8.8
113115

116+
# some permutations of tracing and envvar poisoning
117+
- perl: 5.16
118+
env:
119+
- CLEANTEST=false
120+
- POISON_ENV=true
121+
122+
- perl: 5.16
123+
env:
124+
- CLEANTEST=true
125+
- POISON_ENV=true
126+
- DBIC_TRACE=1
127+
- DBIC_TRACE_PROFILE=console
128+
129+
- perl: 5.16
130+
env:
131+
- CLEANTEST=false
132+
- POISON_ENV=true
133+
- DBIC_TRACE=1
134+
- DBIC_TRACE_PROFILE=console_monochrome
135+
114136
# sourcing the files is *EXTREMELY* important - otherwise
115137
# no envvars will survive
116138

Changes

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
Revision history for DBIx::Class
22

3+
* Fixes
4+
- Fix _dbi_attrs_for_bind() being called befor DBI has been loaded
5+
(regression in 0.08210)
6+
- Fix update/delete operations on resultsets *joining* the updated
7+
table failing on MySQL. Resolves oversights in the fixes for
8+
RT#81378 and RT#81897
9+
- Stop Sybase ASE storage from generating invalid SQL in subselects
10+
when a limit without offset is encountered
11+
12+
0.08210 2013-04-04 15:30 (UTC)
13+
* New Features / Changes
14+
- Officially deprecate the 'cols' and 'include_columns' resultset
15+
attributes
16+
- Remove ::Storage::DBI::sth() deprecated in 0.08191
17+
18+
* Fixes
19+
- Work around a *critical* bug with potential for data loss in
20+
DBD::SQLite - RT#79576
21+
- Audit and correct potential bugs associated with braindead reuse
22+
of $1 on unsuccessful matches
23+
- Fix incorrect warning/exception originator reported by carp*() and
24+
throw_exception()
25+
326
0.08242-TRIAL (EXPERIMENTAL BETA RELEASE) 2013-03-10 14:44 (UTC)
427
* New Features / Changes
528
- Prefetch with limit on right-side ordered resultsets now works

lib/DBIx/Class.pm

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ sub _attr_cache {
9595

9696
1;
9797

98+
__END__
99+
100+
=encoding UTF-8
101+
98102
=head1 NAME
99103
100104
DBIx::Class - Extensible and flexible object <-> relational mapper.
@@ -131,41 +135,11 @@ list below is sorted by "fastest response time":
131135
132136
=back
133137
134-
=head1 HOW TO CONTRIBUTE
135-
136-
Contributions are always welcome, in all usable forms (we especially
137-
welcome documentation improvements). The delivery methods include git-
138-
or unified-diff formatted patches, GitHub pull requests, or plain bug
139-
reports either via RT or the Mailing list. Contributors are generally
140-
granted full access to the official repository after their first patch
141-
passes successful review.
142-
143-
=for comment
144-
FIXME: Getty, frew and jnap need to get off their asses and finish the contrib section so we can link it here ;)
145-
146-
This project is maintained in a git repository. The code and related tools are
147-
accessible at the following locations:
148-
149-
=over
150-
151-
=item * Official repo: L<git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git>
152-
153-
=item * Official gitweb: L<http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git>
154-
155-
=item * GitHub mirror: L<https://github.com/dbsrgits/DBIx-Class>
156-
157-
=item * Authorized committers: L<ssh://dbsrgits@git.shadowcat.co.uk/DBIx-Class.git>
158-
159-
=item * Travis-CI log: L<https://travis-ci.org/dbsrgits/dbix-class/builds>
160-
161-
=for html
162-
<br>&#x21AA; Stable branch CI status: <img src="https://secure.travis-ci.org/dbsrgits/dbix-class.png?branch=master"></img>
163-
164-
=back
165-
166138
=head1 SYNOPSIS
167139
168-
Create a schema class called MyApp/Schema.pm:
140+
=head2 Schema classes preparation
141+
142+
Create a schema class called F<MyApp/Schema.pm>:
169143
170144
package MyApp::Schema;
171145
use base qw/DBIx::Class::Schema/;
@@ -175,7 +149,7 @@ Create a schema class called MyApp/Schema.pm:
175149
1;
176150
177151
Create a result class to represent artists, who have many CDs, in
178-
MyApp/Schema/Result/Artist.pm:
152+
F<MyApp/Schema/Result/Artist.pm>:
179153
180154
See L<DBIx::Class::ResultSource> for docs on defining result classes.
181155
@@ -190,7 +164,7 @@ See L<DBIx::Class::ResultSource> for docs on defining result classes.
190164
1;
191165
192166
A result class to represent a CD, which belongs to an artist, in
193-
MyApp/Schema/Result/CD.pm:
167+
F<MyApp/Schema/Result/CD.pm>:
194168
195169
package MyApp::Schema::Result::CD;
196170
use base qw/DBIx::Class::Core/;
@@ -203,6 +177,8 @@ MyApp/Schema/Result/CD.pm:
203177
204178
1;
205179
180+
=head2 API usage
181+
206182
Then you can use these classes in your application's code:
207183
208184
# Connect to your database.
@@ -271,7 +247,8 @@ that allows abstract encapsulation of database operations. It aims to make
271247
representing queries in your code as perl-ish as possible while still
272248
providing access to as many of the capabilities of the database as possible,
273249
including retrieving related records from multiple tables in a single query,
274-
JOIN, LEFT JOIN, COUNT, DISTINCT, GROUP BY, ORDER BY and HAVING support.
250+
C<JOIN>, C<LEFT JOIN>, C<COUNT>, C<DISTINCT>, C<GROUP BY>, C<ORDER BY> and
251+
C<HAVING> support.
275252
276253
DBIx::Class can handle multi-column primary and foreign keys, complex
277254
queries and database-level paging, and does its best to only query the
@@ -284,8 +261,8 @@ and thread-safe out of the box (although
284261
L<your DBD may not be|DBI/Threads and Thread Safety>).
285262
286263
This project is still under rapid development, so large new features may be
287-
marked EXPERIMENTAL - such APIs are still usable but may have edge bugs.
288-
Failing test cases are *always* welcome and point releases are put out rapidly
264+
marked B<experimental> - such APIs are still usable but may have edge bugs.
265+
Failing test cases are I<always> welcome and point releases are put out rapidly
289266
as bugs are found and fixed.
290267
291268
We do our best to maintain full backwards compatibility for published
@@ -297,6 +274,38 @@ The test suite is quite substantial, and several developer releases
297274
are generally made to CPAN before the branch for the next release is
298275
merged back to trunk for a major release.
299276
277+
=head1 HOW TO CONTRIBUTE
278+
279+
Contributions are always welcome, in all usable forms (we especially
280+
welcome documentation improvements). The delivery methods include git-
281+
or unified-diff formatted patches, GitHub pull requests, or plain bug
282+
reports either via RT or the Mailing list. Contributors are generally
283+
granted full access to the official repository after their first patch
284+
passes successful review.
285+
286+
=for comment
287+
FIXME: Getty, frew and jnap need to get off their asses and finish the contrib section so we can link it here ;)
288+
289+
This project is maintained in a git repository. The code and related tools are
290+
accessible at the following locations:
291+
292+
=over
293+
294+
=item * Official repo: L<git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git>
295+
296+
=item * Official gitweb: L<http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git>
297+
298+
=item * GitHub mirror: L<https://github.com/dbsrgits/DBIx-Class>
299+
300+
=item * Authorized committers: L<ssh://dbsrgits@git.shadowcat.co.uk/DBIx-Class.git>
301+
302+
=item * Travis-CI log: L<https://travis-ci.org/dbsrgits/dbix-class/builds>
303+
304+
=for html
305+
&#x21AA; Stable branch CI status: <img src="https://secure.travis-ci.org/dbsrgits/dbix-class.png?branch=master"></img>
306+
307+
=back
308+
300309
=head1 AUTHOR
301310
302311
mst: Matt S. Trout <mst@shadowcatsystems.co.uk>
@@ -362,8 +371,12 @@ clkao: CL Kao
362371
363372
da5id: David Jack Olrik <djo@cpan.org>
364373
374+
dariusj: Darius Jokilehto <dariusjokilehto@yahoo.co.uk>
375+
365376
davewood: David Schmidt <davewood@gmx.at>
366377
378+
daxim: Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 <daxim@cpan.org>
379+
367380
debolaz: Anders Nor Berle <berle@cpan.org>
368381
369382
dew: Dan Thomas <dan@godders.org>
@@ -563,5 +576,3 @@ as listed above.
563576
564577
This library is free software and may be distributed under the same terms
565578
as perl itself.
566-
567-
=cut

lib/DBIx/Class/CDBICompat/Constraints.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sub constrain_column {
1616
} elsif (ref $how eq "Regexp") {
1717
$class->add_constraint(regexp => $col => sub { shift =~ $how });
1818
} else {
19-
$how =~ m/([^:]+)$/;
19+
$how =~ m/([^:]+)$/; # match is safe - we throw above on empty $how
2020
my $try_method = sprintf '_constrain_by_%s', lc $1; # $how->moniker;
2121
if (my $dispatch = $class->can($try_method)) {
2222
$class->$dispatch($col => ($how, @_));

lib/DBIx/Class/CDBICompat/ImaDBI.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ sub set_sql {
8888
sub {
8989
my $sql = $sql;
9090
my $class = shift;
91-
return $class->storage->_sth($class->transform_sql($sql, @_));
91+
return $class->storage->dbh_do(
92+
_prepare_sth => $class->transform_sql($sql, @_)
93+
);
9294
};
9395
if ($sql =~ /select/i) {
9496
my $search_name = "search_${name}";

lib/DBIx/Class/Carp.pm

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ BEGIN {
1818
use Carp ();
1919
use namespace::clean ();
2020

21+
$Carp::Internal{ (__PACKAGE__) }++;
22+
2123
sub __find_caller {
2224
my ($skip_pattern, $class) = @_;
2325

@@ -28,8 +30,21 @@ sub __find_caller {
2830
if $skip_class_data;
2931

3032
my $fr_num = 1; # skip us and the calling carp*
31-
my @f;
33+
34+
my (@f, $origin);
3235
while (@f = caller($fr_num++)) {
36+
37+
next if
38+
( $f[3] eq '(eval)' or $f[3] =~ /::__ANON__$/ );
39+
40+
$origin ||= (
41+
$f[3] =~ /^ (.+) :: ([^\:]+) $/x
42+
and
43+
! $Carp::Internal{$1}
44+
and
45+
$2 !~ /^(?: throw_exception | carp | carp_unique | carp_once )$/x
46+
) ? $f[3] : undef;
47+
3348
if (
3449
$f[0]->can('_skip_namespace_frames')
3550
and
@@ -41,14 +56,15 @@ sub __find_caller {
4156
last if $f[0] !~ $skip_pattern;
4257
}
4358

44-
my ($ln, $calling) = @f # if empty - nothing matched - full stack
45-
? ( "at $f[1] line $f[2]", $f[3] )
46-
: ( Carp::longmess(), '{UNKNOWN}' )
59+
my $site = @f # if empty - nothing matched - full stack
60+
? "at $f[1] line $f[2]"
61+
: Carp::longmess()
4762
;
63+
$origin ||= '{UNKNOWN}';
4864

4965
return (
50-
$ln,
51-
$calling =~ /::/ ? "$calling(): " : "$calling: ", # cargo-cult from Carp::Clan
66+
$site,
67+
$origin =~ /::/ ? "$origin(): " : "$origin: ", # cargo-cult from Carp::Clan
5268
);
5369
};
5470

lib/DBIx/Class/Exception.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use strict;
44
use warnings;
55

66
use DBIx::Class::Carp ();
7+
$Carp::Internal{ (__PACKAGE__) }++;
78

89
use overload
910
'""' => sub { shift->{msg} },

lib/DBIx/Class/Manual/Cookbook.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,9 +1357,9 @@ row.
13571357
});
13581358
} catch {
13591359
$exception = $_;
1360-
}
1360+
};
13611361

1362-
if ($caught) {
1362+
if ($exception) {
13631363
# There was an error while handling the $job. Rollback all changes
13641364
# since the transaction started, including the already committed
13651365
# ('released') savepoints. There will be neither a new $job nor any

lib/DBIx/Class/Relationship/HasMany.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ sub has_many {
3636
$f_key = $cond;
3737
$guess = "caller specified foreign key '$f_key'";
3838
} else {
39-
$class =~ /([^\:]+)$/;
39+
$class =~ /([^\:]+)$/; # match is safe - $class can't be ''
4040
$f_key = lc $1; # go ahead and guess; best we can do
4141
$guess = "using our class name '$class' as foreign key";
4242
}

0 commit comments

Comments
 (0)