From: Michael G Schwern Date: Wed, 16 Jan 2008 08:19:42 +0000 (+0000) Subject: Merge 'trunk' into 'cdbicompat_integration' X-Git-Tag: v0.08240~541^2~46 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c65da66155b84e36436ba5c514325dba01c29e12;p=dbsrgits%2FDBIx-Class.git Merge 'trunk' into 'cdbicompat_integration' r52127@windhund (orig r3782): ash | 2007-09-25 08:39:52 -0700 Throw if "foreign." and "self." are wrong way round in conditions for relationships r52139@windhund (orig r3794): bricas | 2007-09-27 11:37:15 -0700 ResultSetColumn::func() now returns all results if called in list context r52140@windhund (orig r3795): castaway | 2007-09-28 00:51:40 -0700 Tests from captainL, find_or_new_related fails on belongs_to rels. r52141@windhund (orig r3796): wreis | 2007-09-28 17:35:55 -0700 select for patch from justin r52142@windhund (orig r3797): castaway | 2007-09-29 15:37:07 -0700 Fix "redefined" errors resulting from loading a Schema twice. r52143@windhund (orig r3798): captainL | 2007-10-02 08:38:21 -0700 fixed find_or_new_related bug r52144@windhund (orig r3799): captainL | 2007-10-02 08:43:16 -0700 added comment explaining change r52145@windhund (orig r3800): ash | 2007-10-03 13:00:32 -0700 Many-to-many relationships now warn if the utility methods would clash r52148@windhund (orig r3803): semifor | 2007-10-04 09:29:15 -0700 r1357@titanic: mjm | 2007-10-04 08:48:06 -0700 - Doc patch for using an SQL function on the left side of a comparison. - Which lead to the discovery of a bind args ordering bug. TODO tests added for that. - Fixed =for hidden with =begin hidden / =end hidden elsewhere. - Added myself to the contributors list. r52149@windhund (orig r3804): captainL | 2007-10-04 13:54:08 -0700 fixed search_related from object with unset FK behaviour r52150@windhund (orig r3805): semifor | 2007-10-05 14:30:19 -0700 r1365@titanic: mjm | 2007-10-05 13:49:20 -0700 Fixed warning on uninitialized value. r52154@windhund (orig r3809): ash | 2007-10-07 14:50:33 -0700 Timezone support for InflateColumn::DateTime (sergio) r52158@windhund (orig r3813): ash | 2007-10-12 03:26:55 -0700 Add an add_index method on ResultSource (and proxy classes) r52159@windhund (orig r3814): ash | 2007-10-12 03:32:41 -0700 s/indices/indexes/ to keep Jess happy. r52160@windhund (orig r3815): ash | 2007-10-12 10:46:55 -0700 Remove add_index and replace it with sqlt_deploy_hook r52161@windhund (orig r3816): ash | 2007-10-12 11:20:43 -0700 Test sqlt_deploy_hook on the Schema level r52162@windhund (orig r3817): ash | 2007-10-13 05:33:33 -0700 Add docs about sqlt_deploy_hook, and reorganise/reorder the Cookbook r52166@windhund (orig r3821): nigel | 2007-10-17 08:59:12 -0700 Added reference to RH perl bug at appropriate points r52169@windhund (orig r3824): ash | 2007-10-20 04:01:07 -0700 Added startup checks to warn loudly if we appear to be running on RedHat systems from perl-5.8.8-10 and up that have the bless/overload patch applied (badly) which causes 2x -> 100x performance penalty. (Jon Schutz) r52170@windhund (orig r3825): castaway | 2007-10-21 04:46:56 -0700 Documentation clarifications r52174@windhund (orig r3829): captainL | 2007-10-22 12:45:46 -0700 fixed problem with duplicate related objects for Row::new/insert r52185@windhund (orig r3840): bert | 2007-10-25 03:04:42 -0700 r10510@beetle: bert | 2007-10-25 11:22:07 +0200 Merged with replication branch (fixed wrong object-function calls preventing set_schema to work rev3823). Added myself to contributors. r52186@windhund (orig r3841): captainL | 2007-10-26 03:53:26 -0700 the checks in reverse_relationship_info are less ambiguous r52187@windhund (orig r3842): ash | 2007-10-27 10:53:39 -0700 Reorder Changes file. (New changes go at bottom of block please!) r52188@windhund (orig r3843): tomboh | 2007-10-29 10:19:01 -0700 Improve Documentation. r52189@windhund (orig r3844): captainL | 2007-10-29 13:26:02 -0700 fixed _merge_attr bug r52190@windhund (orig r3845): captainL | 2007-10-29 13:28:45 -0700 spelt Zby's name properly r52197@windhund (orig r3852): castaway | 2007-11-02 19:17:11 -0700 Improve inflatecolumn docs r52198@windhund (orig r3853): matthewt | 2007-11-06 06:53:48 -0800 make belongs_to accept an [] join cond r52217@windhund (orig r3872): castaway | 2007-11-12 13:13:33 -0800 Added cookbook recipe for using dual, thanks Richard r52224@windhund (orig r3879): ash | 2007-11-15 04:49:53 -0800 Fix is_foreign_key_constraint - thanks Jon Schutz r52225@windhund (orig r3880): ash | 2007-11-15 05:02:15 -0800 Adding missing file r52226@windhund (orig r3881): ash | 2007-11-15 05:52:58 -0800 Fix t/82cascade_copy.t r52228@windhund (orig r3883): tomboh | 2007-11-15 07:05:12 -0800 Remove an unneeded requirement. r52230@windhund (orig r3885): ash | 2007-11-16 06:30:51 -0800 Version bump r52231@windhund (orig r3886): ash | 2007-11-19 10:11:53 -0800 Fix END block r52232@windhund (orig r3887): wreis | 2007-11-21 05:57:35 -0800 minor fixes for ResultSet docs r52233@windhund (orig r3888): ash | 2007-11-22 07:27:23 -0800 Fix mistakes r52234@windhund (orig r3889): ash | 2007-11-24 13:24:53 -0800 Sort tables for consistent output r52242@windhund (orig r3897): wreis | 2007-12-10 17:29:51 -0800 minor doc fix r52246@windhund (orig r3901): ash | 2007-12-20 03:02:15 -0800 Add proper thaw hooks so schema gets re-attached r52253@windhund (orig r3908): perigrin | 2008-01-02 12:52:13 -0800 move dbicadmin to JSON::Any r52254@windhund (orig r3909): semifor | 2008-01-02 14:24:23 -0800 Added Storage::DBI subclass for MSSQL auto PK over ODBC. r52255@windhund (orig r3910): nothingmuch | 2008-01-03 05:18:36 -0800 failing test for inflate not being triggerred with copy() r52256@windhund (orig r3911): nothingmuch | 2008-01-03 05:31:49 -0800 test plan r52257@windhund (orig r3912): nothingmuch | 2008-01-03 05:35:20 -0800 introduce set_inflated_columns r52258@windhund (orig r3913): nothingmuch | 2008-01-03 05:36:07 -0800 pod coverage for Storage::DBI::ODBC::Microsoft_SQL_Server r52259@windhund (orig r3914): nothingmuch | 2008-01-03 05:53:00 -0800 dbicadmin printed even when quiet r52260@windhund (orig r3915): nothingmuch | 2008-01-03 05:54:38 -0800 make the dbicadmin test portable to JSON modules that do not support single quotes and bare strings, even on windaz r52261@windhund (orig r3916): nothingmuch | 2008-01-03 06:50:52 -0800 changelog r52263@windhund (orig r3918): tomboh | 2008-01-07 07:23:15 -0800 Fix class name typo r52270@windhund (orig r3925): nigel | 2008-01-11 04:55:17 -0800 Copied documentation for id & discard_charges methods from Pk.pm into Row.pm as few people think to look in Pk.pm. Put reference back to original source. --- c65da66155b84e36436ba5c514325dba01c29e12 diff --cc lib/DBIx/Class/Storage/DBI.pm index d8d918d,874d3a4..74fadd9 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@@ -1103,11 -1122,9 +1122,12 @@@ sub _select } else { $self->throw_exception("rows attribute must be positive if present") if (defined($attrs->{rows}) && !($attrs->{rows} > 0)); + + # MySQL actually recommends this approach. I cringe. + $attrs->{rows} = 2**48 if not defined $attrs->{rows} and defined $attrs->{offset}; push @args, $attrs->{rows}, $attrs->{offset}; } + return $self->_execute(@args); } diff --cc t/84serialize.t index 8940021,c1b67dc..51c7e56 --- a/t/84serialize.t +++ b/t/84serialize.t @@@ -8,29 -8,25 +8,32 @@@ use Storable qw(dclone freeze thaw) my $schema = DBICTest->init_schema(); -plan tests => 6; - -my $artist = $schema->resultset('Artist')->find(1); - -{ - my $copy = $schema->dclone($artist); - is_deeply($copy, $artist, "dclone row object works"); - eval { $copy->discard_changes }; - ok( !$@, "discard_changes okay" ); - is($copy->id, $artist->id, "IDs still match "); -} - -{ - my $ice = $schema->freeze($artist); - my $copy = $schema->thaw($ice); - is_deeply($copy, $artist, 'dclone row object works'); - - eval { $copy->discard_changes }; - ok( !$@, "discard_changes okay" ); - is($copy->id, $artist->id, "IDs still okay"); +my %stores = ( + dclone => sub { return dclone($_[0]) }, + "freeze/thaw" => sub { return thaw(freeze($_[0])) }, +); + - plan tests => (5 * keys %stores); ++plan tests => (7 * keys %stores); + +for my $name (keys %stores) { + my $store = $stores{$name}; + + my $artist = $schema->resultset('Artist')->find(1); + my $copy = eval { $store->($artist) }; + is_deeply($copy, $artist, "serialize row object works: $name"); + + # Test that an object with a related_resultset can be serialized. + my @cds = $artist->related_resultset("cds"); + ok $artist->{related_resultsets}, 'has key: related_resultsets'; + + $copy = eval { $store->($artist) }; + for my $key (keys %$artist) { + next if $key eq 'related_resultsets'; + next if $key eq '_inflated_column'; + is_deeply($copy->{$key}, $artist->{$key}, + qq[serialize with related_resultset "$key"]); + } ++ ++ ok eval { $copy->discard_changes; 1 }; ++ is($copy->id, $artist->id, "IDs still match "); } -