[Bast-commits] r7261 - in DBIx-Class/0.08/branches/reduce_pings: . lib/DBIx/Class lib/DBIx/Class/Manual lib/DBIx/Class/ResultSource lib/DBIx/Class/ResultSourceProxy lib/DBIx/Class/Storage/DBI t t/lib/DBICTest/Schema

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sat Aug 8 15:44:39 GMT 2009


Author: ribasushi
Date: 2009-08-08 15:44:39 +0000 (Sat, 08 Aug 2009)
New Revision: 7261

Modified:
   DBIx-Class/0.08/branches/reduce_pings/
   DBIx-Class/0.08/branches/reduce_pings/Changes
   DBIx-Class/0.08/branches/reduce_pings/Makefile.PL
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Manual/Cookbook.pod
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Ordered.pm
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/PK.pm
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource.pm
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource/View.pm
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSourceProxy/Table.pm
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Storage/DBI/mysql.pm
   DBIx-Class/0.08/branches/reduce_pings/t/746mssql.t
   DBIx-Class/0.08/branches/reduce_pings/t/74mssql.t
   DBIx-Class/0.08/branches/reduce_pings/t/87ordered.t
   DBIx-Class/0.08/branches/reduce_pings/t/93storage_replication.t
   DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year1999CDs.pm
   DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year2000CDs.pm
Log:
 r7230 at Thesaurus (orig r7227):  castaway | 2009-08-05 14:57:52 +0200
 Minty's conversion of cookbook "arbitrary sql" to use ResultSource::View, plus some examples in ::View itself.
 Some style tweaks of mine
 
 r7231 at Thesaurus (orig r7228):  ribasushi | 2009-08-05 15:41:28 +0200
 Dynamically load necessary table classes
 r7236 at Thesaurus (orig r7233):  caelum | 2009-08-05 19:49:51 +0200
 fix rounding issues in mssql money tests
 r7237 at Thesaurus (orig r7234):  caelum | 2009-08-05 20:09:03 +0200
 better money value comparison in tests
 r7239 at Thesaurus (orig r7236):  frew | 2009-08-05 20:53:32 +0200
 whitespace jfklds;ajfklds;a
 r7240 at Thesaurus (orig r7237):  frew | 2009-08-05 20:54:41 +0200
 Fix testing bug.  Windows only.
 r7256 at Thesaurus (orig r7253):  ribasushi | 2009-08-07 11:19:35 +0200
  r7232 at Thesaurus (orig r7229):  jnapiorkowski | 2009-08-05 16:56:32 +0200
  added test for the new default force pool behavior in PK->discard_changes and cleaned up the related tests a bit to give more meaningful info
  r7233 at Thesaurus (orig r7230):  jnapiorkowski | 2009-08-05 16:57:45 +0200
  opps typo in test status messages
  r7234 at Thesaurus (orig r7231):  jnapiorkowski | 2009-08-05 17:03:46 +0200
  added the default attrs to solve the failing test recently commited
  r7235 at Thesaurus (orig r7232):  jnapiorkowski | 2009-08-05 17:58:44 +0200
  added test to make sure you can override the default attributes to discard_changes
  r7241 at Thesaurus (orig r7238):  jnapiorkowski | 2009-08-05 22:00:58 +0200
  added replication as an optional feature to make installing it easier
  r7253 at Thesaurus (orig r7250):  ribasushi | 2009-08-07 11:06:41 +0200
  Streamline makefile dep handling
  r7254 at Thesaurus (orig r7251):  ribasushi | 2009-08-07 11:07:14 +0200
  Switch to done_testing
  r7255 at Thesaurus (orig r7252):  ribasushi | 2009-08-07 11:19:13 +0200
  Move discard_changes code to Row.pm, better docs
 
 r7257 at Thesaurus (orig r7254):  ribasushi | 2009-08-07 11:21:35 +0200
 Remove merged branch
 r7259 at Thesaurus (orig r7256):  ribasushi | 2009-08-07 14:16:13 +0200
 Fix bogus POD
 r7261 at Thesaurus (orig r7258):  ribasushi | 2009-08-07 17:22:58 +0200
 per mst: no optional deps
 r7262 at Thesaurus (orig r7259):  ribasushi | 2009-08-08 17:02:39 +0200
 Stop using discard_changes() in Ordered (if I knew it will be *that* complex I would not touch it)



Property changes on: DBIx-Class/0.08/branches/reduce_pings
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:7237
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11788
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_rs:6741
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/grouped_prefetch:6885
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_money_type:7096
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_storage_minor_refactor:7210
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_top_fixes:6971
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mysql_ansi:7175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mystery_join:6589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/new_replication_transaction_fixup:7058
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_connect_call:6854
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle-tweaks:6222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/order_by_refactor:6475
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_limit:6724
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_redux:7206
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rsrc_in_storage:6577
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/search_related_prefetch:6818
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-tweaks:6262
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/syb_connected:6919
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/top_limit_altfix:6429
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/type_aware_update:6619
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/unresolvable_prefetch:6949
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/tags/0.08108_prerelease_please_do_not_pull_into_it:7008
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:7217
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
   + 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:7237
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11788
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_rs:6741
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/discard_changes_replication_fix:7252
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/grouped_prefetch:6885
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_money_type:7096
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_storage_minor_refactor:7210
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_top_fixes:6971
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mysql_ansi:7175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mystery_join:6589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/new_replication_transaction_fixup:7058
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_connect_call:6854
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle-tweaks:6222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/order_by_refactor:6475
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_limit:6724
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_redux:7206
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rsrc_in_storage:6577
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/search_related_prefetch:6818
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-tweaks:6262
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/syb_connected:6919
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/top_limit_altfix:6429
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/type_aware_update:6619
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/unresolvable_prefetch:6949
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/tags/0.08108_prerelease_please_do_not_pull_into_it:7008
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:7259
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
Name: svn:mergeinfo
   + 

Modified: DBIx-Class/0.08/branches/reduce_pings/Changes
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/Changes	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/Changes	2009-08-08 15:44:39 UTC (rev 7261)
@@ -10,6 +10,8 @@
           - Fixed the way we detect transaction to make this more reliable
             and forward looking.
           - Fixed some trouble with the way Moose Types are used.
+          - Made discard_chages/get_from_storage replication aware (they
+            now read from the master storage by default)
         - Refactor of MSSQL storage drivers, with some new features:
           - Support for placeholders for MSSQL via DBD::Sybase with proper
             autodetection

Modified: DBIx-Class/0.08/branches/reduce_pings/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/Makefile.PL	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/Makefile.PL	2009-08-08 15:44:39 UTC (rev 7261)
@@ -18,6 +18,7 @@
 
 test_requires 'File::Temp'          => 0.22;
 
+
 # Core
 requires 'List::Util'               => 0;
 requires 'Scalar::Util'             => 0;
@@ -45,23 +46,17 @@
 
 recommends 'SQL::Translator'        => 0.09004;
 
-install_script (qw|
-    script/dbicadmin
-|);
+my %replication_requires = (
+  'Moose',                    => 0.87,
+  'MooseX::AttributeHelpers'  => 0.21,
+  'MooseX::Types',            => 0.16,
+  'namespace::clean'          => 0.11,
+  'Hash::Merge',              => 0.11,
+);
 
-tests_recursive (qw|
-    t
-|);
+my %force_requires_if_author = (
+  %replication_requires,
 
-resources 'IRC'         => 'irc://irc.perl.org/#dbix-class';
-resources 'license'     => 'http://dev.perl.org/licenses/';
-resources 'repository'  => 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/';
-resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
-
-
-# re-build README and require extra modules for testing if we're in a checkout
-
-my %force_requires_if_author = (
 #  'Module::Install::Pod::Inherit' => 0.01,
   'Test::Pod::Coverage'       => 1.04,
   'SQL::Translator'           => 0.09007,
@@ -85,13 +80,6 @@
   # t/96_is_deteministic_value.t
   'DateTime::Format::Strptime'=> 0,
 
-  # t/93storage_replication.t
-  'Moose',                    => 0.87,
-  'MooseX::AttributeHelpers'  => 0.21,
-  'MooseX::Types',            => 0.16,
-  'namespace::clean'          => 0.11,
-  'Hash::Merge',              => 0.11,
-
   # database-dependent reqs
   #
   $ENV{DBICTEST_PG_DSN}
@@ -115,6 +103,23 @@
   ,
 );
 
+
+install_script (qw|
+    script/dbicadmin
+|);
+
+tests_recursive (qw|
+    t
+|);
+
+resources 'IRC'         => 'irc://irc.perl.org/#dbix-class';
+resources 'license'     => 'http://dev.perl.org/licenses/';
+resources 'repository'  => 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/';
+resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
+
+
+# re-build README and require extra modules for testing if we're in a checkout
+
 if ($Module::Install::AUTHOR) {
   warn <<'EOW';
 ******************************************************************************
@@ -139,8 +144,8 @@
     unlink 'MANIFEST';
   }
 
-#  eval { require Module::Install::Pod::Inherit };
-#  PodInherit() if !$@;
+#  require Module::Install::Pod::Inherit;
+#  PodInherit();
 }
 
 auto_install();

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Manual/Cookbook.pod	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Manual/Cookbook.pod	2009-08-08 15:44:39 UTC (rev 7261)
@@ -19,6 +19,8 @@
 
   return $rs->all(); # all records for page 1
 
+  return $rs->page(2); # records for page 2
+
 You can get a L<Data::Page> object for the resultset (suitable for use
 in e.g. a template) using the C<pager> method:
 
@@ -59,12 +61,12 @@
 
 =head2 Retrieve one and only one row from a resultset
 
-Sometimes you need only the first "top" row of a resultset. While this can be
-easily done with L<< $rs->first|DBIx::Class::ResultSet/first >>, it is suboptimal,
-as a full blown cursor for the resultset will be created and then immediately
-destroyed after fetching the first row object.
-L<< $rs->single|DBIx::Class::ResultSet/single >> is
-designed specifically for this case - it will grab the first returned result
+Sometimes you need only the first "top" row of a resultset. While this
+can be easily done with L<< $rs->first|DBIx::Class::ResultSet/first
+>>, it is suboptimal, as a full blown cursor for the resultset will be
+created and then immediately destroyed after fetching the first row
+object.  L<< $rs->single|DBIx::Class::ResultSet/single >> is designed
+specifically for this case - it will grab the first returned result
 without even instantiating a cursor.
 
 Before replacing all your calls to C<first()> with C<single()> please observe the
@@ -73,14 +75,16 @@
 =over
 
 =item *
+
 While single() takes a search condition just like search() does, it does
 _not_ accept search attributes. However one can always chain a single() to
 a search():
 
-  my $top_cd = $cd_rs -> search({}, { order_by => 'rating' }) -> single;
+  my $top_cd = $cd_rs->search({}, { order_by => 'rating' })->single;
 
 
 =item *
+
 Since single() is the engine behind find(), it is designed to fetch a
 single row per database query. Thus a warning will be issued when the
 underlying SELECT returns more than one row. Sometimes however this usage
@@ -88,7 +92,7 @@
 at the top of the charts at any given time. If you know what you are doing,
 you can silence the warning by explicitly limiting the resultset size:
 
-  my $top_cd = $cd_rs -> search ({}, { order_by => 'rating', rows => 1 }) -> single;
+  my $top_cd = $cd_rs->search ({}, { order_by => 'rating', rows => 1 })->single;
 
 =back
 
@@ -98,80 +102,45 @@
 (e.g. it contains Unions, Sub-Selects, Stored Procedures, etc.) or has to
 be optimized for your database in a special way, but you still want to
 get the results as a L<DBIx::Class::ResultSet>.
-The recommended way to accomplish this is by defining a separate ResultSource
-for your query. You can then inject complete SQL statements using a scalar
-reference (this is a feature of L<SQL::Abstract>).
 
-Say you want to run a complex custom query on your user data, here's what
-you have to add to your User class:
+The recommended way to accomplish this is by defining a separate
+L<ResultSource::View|DBIx::Class::ResultSource::View> for your query.
 
-  package My::Schema::Result::User;
-
+  package My::Schema::Result::UserFriendsComplex;
+  use strict;
+  use warnings;
   use base qw/DBIx::Class/;
 
-  # ->load_components, ->table, ->add_columns, etc.
+  __PACKAGE__->load_components('Core');
+  __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 
-  # Make a new ResultSource based on the User class
-  my $source = __PACKAGE__->result_source_instance();
-  my $new_source = $source->new( $source );
-  $new_source->source_name( 'UserFriendsComplex' );
+  # ->table, ->add_columns, etc.
 
-  # Hand in your query as a scalar reference
-  # It will be added as a sub-select after FROM,
-  # so pay attention to the surrounding brackets!
-  $new_source->name( \<<SQL );
-  ( SELECT u.* FROM user u
-  INNER JOIN user_friends f ON u.id = f.user_id
-  WHERE f.friend_user_id = ?
-  UNION
-  SELECT u.* FROM user u
-  INNER JOIN user_friends f ON u.id = f.friend_user_id
-  WHERE f.user_id = ? )
-  SQL
+  __PACKAGE__->result_source_instance->is_virtual(1);
+  __PACKAGE__->result_source_instance->view_definition(q[
+    SELECT u.* FROM user u
+    INNER JOIN user_friends f ON u.id = f.user_id
+    WHERE f.friend_user_id = ?
+    UNION
+    SELECT u.* FROM user u
+    INNER JOIN user_friends f ON u.id = f.friend_user_id
+    WHERE f.user_id = ?
+  ]);
 
-  # Finally, register your new ResultSource with your Schema
-  My::Schema->register_extra_source( 'UserFriendsComplex' => $new_source );
-
 Next, you can execute your complex query using bind parameters like this:
 
-  my $friends = [ $schema->resultset( 'UserFriendsComplex' )->search( {},
+  my $friends = $schema->resultset( 'UserFriendsComplex' )->search( {},
     {
       bind  => [ 12345, 12345 ]
     }
-  ) ];
+  );
 
 ... and you'll get back a perfect L<DBIx::Class::ResultSet> (except, of course,
 that you cannot modify the rows it contains, ie. cannot call L</update>,
 L</delete>, ...  on it).
 
-If you prefer to have the definitions of these custom ResultSources in separate
-files (instead of stuffing all of them into the same ResultSource class), you
-can achieve the same with subclassing the ResultSource class and defining the
-new ResultSource there:
+Note that you cannot have bind parameters unless is_virtual is set to true.
 
-  package My::Schema::Result::UserFriendsComplex;
-
-  use base qw/My::Schema::Result::User/;
-
-  __PACKAGE__->table('dummy');  # currently must be called before anything else
-
-  # Hand in your query as a scalar reference
-  # It will be added as a sub-select after FROM,
-  # so pay attention to the surrounding brackets!
-  __PACKAGE__->result_source_instance->name( \<<SQL );
-  ( SELECT u.* FROM user u
-  INNER JOIN user_friends f ON u.id = f.user_id
-  WHERE f.friend_user_id = ?
-  UNION
-  SELECT u.* FROM user u
-  INNER JOIN user_friends f ON u.id = f.friend_user_id
-  WHERE f.user_id = ? )
-  SQL
-
-  1;
-
-TIMTOWDI.
-
 =head2 Using specific columns
 
 When you only want specific columns from a table, you can use

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Ordered.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Ordered.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Ordered.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -362,38 +362,58 @@
     my( $self, $to_position ) = @_;
     return 0 if ( $to_position < 1 );
 
-    my $from_position = $self->_position;
-    return 0 if ( $from_position == $to_position );
-
     my $position_column = $self->position_column;
 
-    {
-        my $guard = $self->result_source->schema->txn_scope_guard;
+    my $guard;
 
-        my ($direction, @between);
-        if ( $from_position < $to_position ) {
-            $direction = -1;
-            @between = map { $self->_position_value ($_) } ( $from_position + 1, $to_position );
-        }
-        else {
-            $direction = 1;
-            @between = map { $self->_position_value ($_) } ( $to_position, $from_position - 1 );
-        }
+    if ($self->is_column_changed ($position_column) ) {
+      # something changed our position, we have no idea where we
+      # used to be - requery without using discard_changes
+      # (we need only a specific column back)
 
-        my $new_pos_val = $self->_position_value ($to_position);                              # record this before the shift
+      $guard = $self->result_source->schema->txn_scope_guard;
 
-        # we need to null-position the moved row if the position column is part of a constraint
-        if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $self->result_source->unique_constraints }} ) ) ) {
-            $self->_ordered_internal_update({ $position_column => $self->null_position_value });
-        }
+      my $cursor = $self->result_source->resultset->search(
+        $self->ident_condition,
+        { select => $position_column },
+      )->cursor;
 
-        $self->_shift_siblings ($direction, @between);
-        $self->_ordered_internal_update({ $position_column => $new_pos_val });
+      my ($pos) = $cursor->next;
+      $self->$position_column ($pos);
+      delete $self->{_dirty_columns}{$position_column};
+    }
 
-        $guard->commit;
+    my $from_position = $self->_position;
 
-        return 1;
+    if ( $from_position == $to_position ) {   # FIXME this will not work for non-numeric order
+      $guard->commit if $guard;
+      return 0;
     }
+
+    $guard ||= $self->result_source->schema->txn_scope_guard;
+
+    my ($direction, @between);
+    if ( $from_position < $to_position ) {
+      $direction = -1;
+      @between = map { $self->_position_value ($_) } ( $from_position + 1, $to_position );
+    }
+    else {
+      $direction = 1;
+      @between = map { $self->_position_value ($_) } ( $to_position, $from_position - 1 );
+    }
+
+    my $new_pos_val = $self->_position_value ($to_position);  # record this before the shift
+
+    # we need to null-position the moved row if the position column is part of a constraint
+    if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $self->result_source->unique_constraints }} ) ) ) {
+      $self->_ordered_internal_update({ $position_column => $self->null_position_value });
+    }
+
+    $self->_shift_siblings ($direction, @between);
+    $self->_ordered_internal_update({ $position_column => $new_pos_val });
+
+    $guard->commit;
+    return 1;
 }
 
 =head2 move_to_group
@@ -428,43 +448,71 @@
     my $position_column = $self->position_column;
 
     return 0 if ( defined($to_position) and $to_position < 1 );
+
+    # check if someone changed the _grouping_columns - this will
+    # prevent _is_in_group working, so we need to requery the db
+    # for the original values
+    my (@dirty_cols, %values, $guard);
+    for ($self->_grouping_columns) {
+      $values{$_} = $self->get_column ($_);
+      push @dirty_cols, $_ if $self->is_column_changed ($_);
+    }
+
+    # re-query only the dirty columns, and restore them on the
+    # object (subsequent code will update them to the correct
+    # after-move values)
+    if (@dirty_cols) {
+      $guard = $self->result_source->schema->txn_scope_guard;
+
+      my $cursor = $self->result_source->resultset->search(
+        $self->ident_condition,
+        { select => \@dirty_cols },
+      )->cursor;
+
+      my @original_values = $cursor->next;
+      $self->set_inflated_columns ({ %values, map { $_ => shift @original_values } (@dirty_cols) });
+    }
+
     if ($self->_is_in_group ($to_group) ) {
-        return 0 if not defined $to_position;
-        return $self->move_to ($to_position);
+      my $ret;
+      if (defined $to_position) {
+        $ret = $self->move_to ($to_position);
+      }
+
+      $guard->commit if $guard;
+      return $ret||0;
     }
 
-    {
-        my $guard = $self->result_source->schema->txn_scope_guard;
+    $guard ||= $self->result_source->schema->txn_scope_guard;
 
-        # Move to end of current group to adjust siblings
-        $self->move_last;
+    # Move to end of current group to adjust siblings
+    $self->move_last;
 
-        $self->set_inflated_columns({ %$to_group, $position_column => undef });
-        my $new_group_last_posval = $self->_last_sibling_posval;
-        my $new_group_last_position = $self->_position_from_value (
-          $new_group_last_posval
-        );
+    $self->set_inflated_columns({ %$to_group, $position_column => undef });
+    my $new_group_last_posval = $self->_last_sibling_posval;
+    my $new_group_last_position = $self->_position_from_value (
+      $new_group_last_posval
+    );
 
-        if ( not defined($to_position) or $to_position > $new_group_last_position) {
-            $self->set_column(
-                $position_column => $new_group_last_position
-                    ? $self->_next_position_value ( $new_group_last_posval )
-                    : $self->_initial_position_value
-            );
-        }
-        else {
-            my $bumped_pos_val = $self->_position_value ($to_position);
-            my @between = ($to_position, $new_group_last_position);
-            $self->_shift_siblings (1, @between);   #shift right
-            $self->set_column( $position_column => $bumped_pos_val );
-        }
+    if ( not defined($to_position) or $to_position > $new_group_last_position) {
+      $self->set_column(
+        $position_column => $new_group_last_position
+          ? $self->_next_position_value ( $new_group_last_posval )
+          : $self->_initial_position_value
+      );
+    }
+    else {
+      my $bumped_pos_val = $self->_position_value ($to_position);
+      my @between = ($to_position, $new_group_last_position);
+      $self->_shift_siblings (1, @between);   #shift right
+      $self->set_column( $position_column => $bumped_pos_val );
+    }
 
-        $self->_ordered_internal_update;
+    $self->_ordered_internal_update;
 
-        $guard->commit;
+    $guard->commit;
 
-        return 1;
-    }
+    return 1;
 }
 
 =head2 insert
@@ -508,16 +556,47 @@
     # this is set by _ordered_internal_update()
     return $self->next::method(@_) if $self->{_ORDERED_INTERNAL_UPDATE};
 
-    my $upd = shift;
-    $self->set_inflated_columns($upd) if $upd;
-    my %changes = $self->get_dirty_columns;
-    $self->discard_changes;
-
     my $position_column = $self->position_column;
+    my @ordering_columns = ($self->_grouping_columns, $position_column);
 
+
+    # these steps are necessary to keep the external appearance of
+    # ->update($upd) so that other things overloading update() will
+    # work properly
+    my %original_values = $self->get_inflated_columns;
+    my %existing_changes = $self->get_dirty_columns;
+
+    # See if any of the *supplied* changes would affect the ordering
+    # The reason this is so contrived, is that we want to leverage
+    # the datatype aware value comparing, while at the same time
+    # keep the original value intact (it will be updated later by the
+    # corresponding routine)
+
+    my %upd = %{shift || {}};
+    my %changes = %existing_changes;
+
+    for (@ordering_columns) {
+        next unless exists $upd{$_};
+
+        # we do not want to keep propagating this to next::method
+        # as it will be a done deal by the time get there
+        my $value = delete $upd{$_};
+        $self->set_inflated_columns ({ $_ => $value });
+
+        # see if an update resulted in a dirty column
+        # it is important to preserve the old value, as it
+        # will be needed to carry on a successfull move()
+        # operation without re-querying the database
+        if ($self->is_column_changed ($_) && not exists $existing_changes{$_}) {
+            $changes{$_} = $value;
+            $self->set_inflated_columns ({ $_ => $original_values{$_} });
+            delete $self->{_dirty_columns}{$_};
+        }
+    }
+
     # if nothing group/position related changed - short circuit
-    if (not grep { exists $changes{$_} } ($self->_grouping_columns, $position_column) ) {
-        return $self->next::method( \%changes, @_ );
+    if (not grep { exists $changes{$_} } ( @ordering_columns ) ) {
+        return $self->next::method( \%upd, @_ );
     }
 
     {
@@ -529,37 +608,37 @@
             # create new_group by taking the current group and inserting changes
             my $new_group = {$self->_grouping_clause};
             foreach my $col (keys %$new_group) {
-                if (exists $changes{$col}) {
-                    $new_group->{$col} = delete $changes{$col}; # don't want to pass this on to next::method
-                }
+                $new_group->{$col} = $changes{$col} if exists $changes{$col};
             }
 
             $self->move_to_group(
                 $new_group,
                 (exists $changes{$position_column}
-                    # The FIXME bit contradicts the documentation: when changing groups without supplying explicit
-                    # positions in move_to_group(), we push the item to the end of the group.
-                    # However when I was rewriting this, the position from the old group was clearly passed to the new one
+                    # The FIXME bit contradicts the documentation: POD states that
+                    # when changing groups without supplying explicit positions in
+                    # move_to_group(), we push the item to the end of the group.
+                    # However when I was rewriting this, the position from the old
+                    # group was clearly passed to the new one
                     # Probably needs to go away (by ribasushi)
-                    ? delete $changes{$position_column}     # means there was a position change supplied with the update too
-                    : $self->_position                      # FIXME!
+                    ? $changes{$position_column}    # means there was a position change supplied with the update too
+                    : $self->_position              # FIXME! (replace with undef)
                 ),
             );
         }
         elsif (exists $changes{$position_column}) {
-            $self->move_to(delete $changes{$position_column});
+            $self->move_to($changes{$position_column});
         }
 
         my @res;
         my $want = wantarray();
         if (not defined $want) {
-            $self->next::method( \%changes, @_ );
+            $self->next::method( \%upd, @_ );
         }
         elsif ($want) {
-            @res = $self->next::method( \%changes, @_ );
+            @res = $self->next::method( \%upd, @_ );
         }
         else {
-            $res[0] = $self->next::method( \%changes, @_ );
+            $res[0] = $self->next::method( \%upd, @_ );
         }
 
         $guard->commit;
@@ -790,8 +869,8 @@
 =head2 _grouping_clause
 
 This method returns one or more name=>value pairs for limiting a search
-by the grouping column(s).  If the grouping column is not
-defined then this will return an empty list.
+by the grouping column(s).  If the grouping column is not defined then 
+this will return an empty list.
 
 =cut
 sub _grouping_clause {

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/PK.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/PK.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/PK.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -20,45 +20,6 @@
 
 =cut
 
-sub _ident_values {
-  my ($self) = @_;
-  return (map { $self->{_column_data}{$_} } $self->primary_columns);
-}
-
-=head2 discard_changes ($attrs)
-
-Re-selects the row from the database, losing any changes that had
-been made.
-
-This method can also be used to refresh from storage, retrieving any
-changes made since the row was last read from storage.
-
-$attrs is expected to be a hashref of attributes suitable for passing as the
-second argument to $resultset->search($cond, $attrs);
-
-=cut
-
-sub discard_changes {
-  my ($self, $attrs) = @_;
-  delete $self->{_dirty_columns};
-  return unless $self->in_storage; # Don't reload if we aren't real!
-
-  if( my $current_storage = $self->get_from_storage($attrs)) {
-
-    # Set $self to the current.
-  	%$self = %$current_storage;
-
-    # Avoid a possible infinite loop with
-    # sub DESTROY { $_[0]->discard_changes }
-    bless $current_storage, 'Do::Not::Exist';
-
-    return $self;  	
-  } else {
-    $self->in_storage(0);
-    return $self;  	
-  }
-}
-
 =head2 id
 
 Returns the primary key(s) for a row. Can't be called as
@@ -74,12 +35,28 @@
   return (wantarray ? @pk : $pk[0]);
 }
 
+sub _ident_values {
+  my ($self) = @_;
+  return (map { $self->{_column_data}{$_} } $self->primary_columns);
+}
+
 =head2 ID
 
 Returns a unique id string identifying a row object by primary key.
 Used by L<DBIx::Class::CDBICompat::LiveObjectIndex> and
 L<DBIx::Class::ObjectCache>.
 
+=over
+
+=item WARNING
+
+The default C<_create_ID> method used by this function orders the returned
+values by the alphabetical order of the primary column names, B<unlike>
+the L</id> method, which follows the same order in which columns were fed
+to L<DBIx::Class::ResultSource/set_primary_key>.
+
+=back
+
 =cut
 
 sub ID {

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource/View.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource/View.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource/View.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -19,7 +19,7 @@
 
   package MyDB::Schema::Result::Year2000CDs;
 
-  use DBIx::Class::ResultSource::View;
+  use base qw/DBIx::Class/;
 
   __PACKAGE__->load_components('Core');
   __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
@@ -28,17 +28,30 @@
   __PACKAGE__->result_source_instance->is_virtual(1);
   __PACKAGE__->result_source_instance->view_definition(
       "SELECT cdid, artist, title FROM cd WHERE year ='2000'"
-      );
+  );
+  __PACKAGE__->add_columns(
+    'cdid' => {
+      data_type => 'integer',
+      is_auto_increment => 1,
+    },
+    'artist' => {
+      data_type => 'integer',
+    },
+    'title' => {
+      data_type => 'varchar',
+      size      => 100,
+    },
+  );
 
 =head1 DESCRIPTION
 
 View object that inherits from L<DBIx::Class::ResultSource>
 
-This class extends ResultSource to add basic view support. 
+This class extends ResultSource to add basic view support.
 
-A view has a L</view_definition>, which contains an SQL query. The
-query cannot have parameters. It may contain JOINs, sub selects and
-any other SQL your database supports.
+A view has a L</view_definition>, which contains a SQL query. The query can
+only have parameters if L</is_virtual> is set to true. It may contain JOINs,
+sub selects and any other SQL your database supports.
 
 View definition SQL is deployed to your database on
 L<DBIx::Class::Schema/deploy> unless you set L</is_virtual> to true.
@@ -50,6 +63,37 @@
 exist in your database as a real view. The L</view_definition> in this
 case replaces the view name in a FROM clause in a subselect.
 
+=head1 EXAMPLES
+
+Having created the MyDB::Schema::Year2000CDs schema as shown in the SYNOPSIS
+above, you can then:
+
+  $2000_cds = $schema->resultset('Year2000CDs')
+                     ->search()
+                     ->all();
+  $count    = $schema->resultset('Year2000CDs')
+                     ->search()
+                     ->count();
+
+If you modified the schema to include a placeholder
+
+  __PACKAGE__->result_source_instance->view_definition(
+      "SELECT cdid, artist, title FROM cd WHERE year ='?'"
+  );
+
+and ensuring you have is_virtual set to true:
+
+  __PACKAGE__->result_source_instance->is_virtual(1);
+
+You could now say:
+
+  $2001_cds = $schema->resultset('Year2000CDs')
+                     ->search({}, { bind => [2001] })
+                     ->all();
+  $count    = $schema->resultset('Year2000CDs')
+                     ->search({}, { bind => [2001] })
+                     ->count();
+
 =head1 SQL EXAMPLES
 
 =over

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSource.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -40,8 +40,6 @@
   # Create a query (view) based result source, in a result class
   package MyDB::Schema::Result::Year2000CDs;
 
-  use DBIx::Class::ResultSource::View;
-
   __PACKAGE__->load_components('Core');
   __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSourceProxy/Table.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSourceProxy/Table.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/ResultSourceProxy/Table.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -5,8 +5,6 @@
 
 use base qw/DBIx::Class::ResultSourceProxy/;
 
-use DBIx::Class::ResultSource::Table;
-
 __PACKAGE__->mk_classdata(table_class => 'DBIx::Class::ResultSource::Table');
 
 __PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do
@@ -22,8 +20,11 @@
     my $class_has_table_instance = ($table and $table->result_class eq $class);
     return $table if $class_has_table_instance;
 
+    my $table_class = $class->table_class;
+    $class->ensure_class_loaded($table_class);
+
     if( $table ) {
-        $table = $class->table_class->new({
+        $table = $table_class->new({
             %$table,
             result_class => $class,
             source_name => undef,
@@ -31,7 +32,7 @@
         });
     }
     else {
-        $table = $class->table_class->new({
+        $table = $table_class->new({
             name            => undef,
             result_class    => $class,
             source_name     => undef,
@@ -76,7 +77,11 @@
   my ($class, $table) = @_;
   return $class->result_source_instance->name unless $table;
   unless (ref $table) {
-    $table = $class->table_class->new({
+
+    my $table_class = $class->table_class;
+    $class->ensure_class_loaded($table_class);
+
+    $table = $table_class->new({
         $class->can('result_source_instance') ?
           %{$class->result_source_instance||{}} : (),
         name => $table,

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Row.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Row.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -1277,12 +1277,51 @@
     my $resultset = $self->result_source->resultset;
 
     if(defined $attrs) {
-    	$resultset = $resultset->search(undef, $attrs);
+      $resultset = $resultset->search(undef, $attrs);
     }
 
     return $resultset->find($self->{_orig_ident} || $self->ident_condition);
 }
 
+=head2 discard_changes ($attrs)
+
+Re-selects the row from the database, losing any changes that had
+been made.
+
+This method can also be used to refresh from storage, retrieving any
+changes made since the row was last read from storage.
+
+$attrs is expected to be a hashref of attributes suitable for passing as the
+second argument to $resultset->search($cond, $attrs);
+
+=cut
+
+sub discard_changes {
+  my ($self, $attrs) = @_;
+  delete $self->{_dirty_columns};
+  return unless $self->in_storage; # Don't reload if we aren't real!
+
+  # add a replication default to read from the master only
+  $attrs = { force_pool => 'master', %{$attrs||{}} };
+
+  if( my $current_storage = $self->get_from_storage($attrs)) {
+
+    # Set $self to the current.
+    %$self = %$current_storage;
+
+    # Avoid a possible infinite loop with
+    # sub DESTROY { $_[0]->discard_changes }
+    bless $current_storage, 'Do::Not::Exist';
+
+    return $self;
+  }
+  else {
+    $self->in_storage(0);
+    return $self;
+  }
+}
+
+
 =head2 throw_exception
 
 See L<DBIx::Class::Schema/throw_exception>.

Modified: DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Storage/DBI/mysql.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Storage/DBI/mysql.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/lib/DBIx/Class/Storage/DBI/mysql.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -81,7 +81,7 @@
 Storage::DBI autodetects the underlying MySQL database, and re-blesses the
 C<$storage> object into this class.
 
-  my $schema = MyDb::Schema->connect( $dsn, $user, $pass, { set_strict_mode => 1 } );
+  my $schema = MyDb::Schema->connect( $dsn, $user, $pass, { on_connect_call => 'set_strict_mode' } );
 
 =head1 DESCRIPTION
 

Modified: DBIx-Class/0.08/branches/reduce_pings/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/t/746mssql.t	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/t/746mssql.t	2009-08-08 15:44:39 UTC (rev 7261)
@@ -161,13 +161,14 @@
   $row = $rs->create({ amount => 100 });
 } 'inserted a money value';
 
-is $rs->find($row->id)->amount, '100.00', 'money value round-trip';
+cmp_ok $rs->find($row->id)->amount, '==', 100, 'money value round-trip';
 
 lives_ok {
   $row->update({ amount => 200 });
 } 'updated a money value';
 
-is $rs->find($row->id)->amount, '200.00', 'updated money value round-trip';
+cmp_ok $rs->find($row->id)->amount, '==', 200,
+  'updated money value round-trip';
 
 lives_ok {
   $row->update({ amount => undef });

Modified: DBIx-Class/0.08/branches/reduce_pings/t/74mssql.t
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/t/74mssql.t	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/t/74mssql.t	2009-08-08 15:44:39 UTC (rev 7261)
@@ -103,12 +103,10 @@
       my ($storage, $dbh) = @_;
       eval { $dbh->do("DROP TABLE money_test") };
       $dbh->do(<<'SQL');
-
   CREATE TABLE money_test (
      id INT IDENTITY PRIMARY KEY,
      amount MONEY NULL
   )
-
 SQL
 
   });
@@ -120,19 +118,21 @@
     $row = $rs->create({ amount => 100 });
   } 'inserted a money value';
 
-  is $rs->find($row->id)->amount, 100, 'money value round-trip';
+  cmp_ok $rs->find($row->id)->amount, '==', 100, 'money value round-trip';
 
   lives_ok {
     $row->update({ amount => 200 });
   } 'updated a money value';
 
-  is $rs->find($row->id)->amount, 200, 'updated money value round-trip';
+  cmp_ok $rs->find($row->id)->amount, '==', 200,
+    'updated money value round-trip';
 
   lives_ok {
     $row->update({ amount => undef });
   } 'updated a money value to NULL';
 
-  is $rs->find($row->id)->amount, undef,'updated money value to NULL round-trip';
+  is $rs->find($row->id)->amount,
+    undef, 'updated money value to NULL round-trip';
 }
 
 # clean up our mess

Modified: DBIx-Class/0.08/branches/reduce_pings/t/87ordered.t
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/t/87ordered.t	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/t/87ordered.t	2009-08-08 15:44:39 UTC (rev 7261)
@@ -10,8 +10,6 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 1269;
-
 my $employees = $schema->resultset('Employee');
 $employees->delete();
 
@@ -42,11 +40,9 @@
 my $group_3 = $employees->search({group_id=>3});
 my $to_group = 1;
 my $to_pos = undef;
-# now that we have transactions we need to work around stupid sqlite
 {
   my @empl = $group_3->all;
   while (my $employee = shift @empl) {
-    $employee->discard_changes;     # since we are effective shift()ing the $rs while doing this
     $employee->move_to_group($to_group, $to_pos);
     $to_pos++;
     $to_group = $to_group==1 ? 2 : 1;
@@ -54,7 +50,6 @@
 }
 foreach my $group_id (1..4) {
     my $group_employees = $employees->search({group_id=>$group_id});
-    $group_employees->all();
     ok( check_rs($group_employees), "group positions after move_to_group" );
 }
 
@@ -129,7 +124,6 @@
 my $to_group_2 = 1;
 $to_pos = undef;
 
-# now that we have transactions we need to work around stupid sqlite
 {
   my @empl = $group_3->all;
   while (my $employee = shift @empl) {
@@ -143,7 +137,6 @@
 foreach my $group_id_2 (1..4) {
     foreach my $group_id_3 (1..4) {
         my $group_employees = $employees->search({group_id_2=>$group_id_2,group_id_3=>$group_id_3});
-        $group_employees->all();
         ok( check_rs($group_employees), "group positions after move_to_group" );
     }
 }
@@ -275,3 +268,4 @@
     return 1;
 }
 
+done_testing;

Modified: DBIx-Class/0.08/branches/reduce_pings/t/93storage_replication.t
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/t/93storage_replication.t	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/t/93storage_replication.t	2009-08-08 15:44:39 UTC (rev 7261)
@@ -11,9 +11,7 @@
 
 BEGIN {
     eval "use DBIx::Class::Storage::DBI::Replicated; use Test::Moose";
-    plan $@
-        ? ( skip_all => "Deps not installed: $@" )
-        : ( tests => 126 );
+    plan skip_all => "Deps not installed: $@" if $@;
 }
 
 use_ok 'DBIx::Class::Storage::DBI::Replicated::Pool';
@@ -33,7 +31,7 @@
     will try to test those.  If you do that, it will assume the setup is properly
     replicating.  Your results may vary, but I have demonstrated this to work with
     mysql native replication.
-    
+
 =cut
 
 
@@ -46,26 +44,26 @@
     ## --------------------------------------------------------------------- ##
     ## Create an object to contain your replicated stuff.
     ## --------------------------------------------------------------------- ##
-    
+
     package DBIx::Class::DBI::Replicated::TestReplication;
-   
+
     use DBICTest;
     use base qw/Class::Accessor::Fast/;
-    
+
     __PACKAGE__->mk_accessors( qw/schema/ );
 
     ## Initialize the object
-    
-	sub new {
-	    my ($class, $schema_method) = (shift, shift);
-	    my $self = $class->SUPER::new(@_);
-	
-	    $self->schema( $self->init_schema($schema_method) );
-	    return $self;
-	}
-    
+
+    sub new {
+        my ($class, $schema_method) = (shift, shift);
+        my $self = $class->SUPER::new(@_);
+
+        $self->schema( $self->init_schema($schema_method) );
+        return $self;
+    }
+
     ## Get the Schema and set the replication storage type
-    
+
     sub init_schema {
         # current SQLT SQLite producer does not handle DROP TABLE IF EXISTS, trap warnings here
         local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /no such table.+DROP TABLE/ };
@@ -86,7 +84,7 @@
             balancer_type=>'::Random',
             balancer_args=>{
               auto_validate_every=>100,
-	      master_read_weight => 1
+          master_read_weight => 1
             },
           }
         },
@@ -103,7 +101,7 @@
         balancer_type=>'::Random',
         balancer_args=> {
           auto_validate_every=>100,
-	  master_read_weight => 1
+      master_read_weight => 1
         },
         deploy_args=>{
           add_drop_table => 1,
@@ -135,50 +133,50 @@
 
     no Moose;
     }
-  
+
     ## --------------------------------------------------------------------- ##
     ## Subclass for when you are using SQLite for testing, this provides a fake
     ## replication support.
     ## --------------------------------------------------------------------- ##
-        
+
     package DBIx::Class::DBI::Replicated::TestReplication::SQLite;
 
     use DBICTest;
-    use File::Copy;    
+    use File::Copy;
     use base 'DBIx::Class::DBI::Replicated::TestReplication';
-    
+
     __PACKAGE__->mk_accessors(qw/master_path slave_paths/);
-    
+
     ## Set the master path from DBICTest
-    
-	sub new {
-	    my $class = shift @_;
-	    my $self = $class->SUPER::new(@_);
-	
-	    $self->master_path( DBICTest->_sqlite_dbfilename );
-	    $self->slave_paths([
-			File::Spec->catfile(qw/t var DBIxClass_slave1.db/),
-			File::Spec->catfile(qw/t var DBIxClass_slave2.db/),
-		]);
-        
-	    return $self;
-	}    
-	
+
+    sub new {
+        my $class = shift @_;
+        my $self = $class->SUPER::new(@_);
+
+        $self->master_path( DBICTest->_sqlite_dbfilename );
+        $self->slave_paths([
+            File::Spec->catfile(qw/t var DBIxClass_slave1.db/),
+            File::Spec->catfile(qw/t var DBIxClass_slave2.db/),
+        ]);
+
+        return $self;
+    }
+
     ## Return an Array of ArrayRefs where each ArrayRef is suitable to use for
     ## $storage->connect_info to be used for connecting replicants.
-    
+
     sub generate_replicant_connect_info {
         my $self = shift @_;
         my @dsn = map {
             "dbi:SQLite:${_}";
         } @{$self->slave_paths};
-        
+
         my @connect_infos = map { [$_,'','',{AutoCommit=>1}] } @dsn;
 
-		## Make sure nothing is left over from a failed test
-		$self->cleanup;
+        ## Make sure nothing is left over from a failed test
+        $self->cleanup;
 
-		## try a hashref too
+        ## try a hashref too
         my $c = $connect_infos[0];
         $connect_infos[0] = {
           dsn => $c->[0],
@@ -193,25 +191,25 @@
     ## Do a 'good enough' replication by copying the master dbfile over each of
     ## the slave dbfiles.  If the master is SQLite we do this, otherwise we
     ## just do a one second pause to let the slaves catch up.
-    
+
     sub replicate {
         my $self = shift @_;
         foreach my $slave (@{$self->slave_paths}) {
             copy($self->master_path, $slave);
         }
     }
-    
+
     ## Cleanup after ourselves.  Unlink all gthe slave paths.
-    
+
     sub cleanup {
         my $self = shift @_;
         foreach my $slave (@{$self->slave_paths}) {
-			if(-e $slave) {
-				unlink $slave;
-			}
-        }     
+            if(-e $slave) {
+                unlink $slave;
+            }
+        }
     }
-    
+
     ## --------------------------------------------------------------------- ##
     ## Subclass for when you are setting the databases via custom export vars
     ## This is for when you have a replicating database setup that you are
@@ -219,25 +217,25 @@
     ## two slave databases to test against, as well as a replication system
     ## that will replicate in less than 1 second.
     ## --------------------------------------------------------------------- ##
-        
-    package DBIx::Class::DBI::Replicated::TestReplication::Custom; 
+
+    package DBIx::Class::DBI::Replicated::TestReplication::Custom;
     use base 'DBIx::Class::DBI::Replicated::TestReplication';
-    
+
     ## Return an Array of ArrayRefs where each ArrayRef is suitable to use for
     ## $storage->connect_info to be used for connecting replicants.
-    
-    sub generate_replicant_connect_info { 
+
+    sub generate_replicant_connect_info {
         return (
             [$ENV{"DBICTEST_SLAVE0_DSN"}, $ENV{"DBICTEST_SLAVE0_DBUSER"}, $ENV{"DBICTEST_SLAVE0_DBPASS"}, {AutoCommit => 1}],
-            [$ENV{"DBICTEST_SLAVE1_DSN"}, $ENV{"DBICTEST_SLAVE1_DBUSER"}, $ENV{"DBICTEST_SLAVE1_DBPASS"}, {AutoCommit => 1}],           
+            [$ENV{"DBICTEST_SLAVE1_DSN"}, $ENV{"DBICTEST_SLAVE1_DBUSER"}, $ENV{"DBICTEST_SLAVE1_DBPASS"}, {AutoCommit => 1}],
         );
     }
-    
-    ## pause a bit to let the replication catch up 
-    
+
+    ## pause a bit to let the replication catch up
+
     sub replicate {
-    	sleep 1;
-    } 
+        sleep 1;
+    }
 }
 
 ## ----------------------------------------------------------------------------
@@ -253,12 +251,13 @@
 my $replicated;
 
 for my $method (qw/by_connect_info by_storage_type/) {
+  undef $replicated;
   ok $replicated = $replicated_class->new($method)
       => "Created a replication object $method";
-      
+
   isa_ok $replicated->schema
       => 'DBIx::Class::Schema';
-      
+
   isa_ok $replicated->schema->storage
       => 'DBIx::Class::Storage::DBI::Replicated';
 
@@ -269,15 +268,15 @@
 
 ok $replicated->schema->storage->meta
     => 'has a meta object';
-    
+
 isa_ok $replicated->schema->storage->master
     => 'DBIx::Class::Storage::DBI';
-    
+
 isa_ok $replicated->schema->storage->pool
     => 'DBIx::Class::Storage::DBI::Replicated::Pool';
-    
+
 does_ok $replicated->schema->storage->balancer
-    => 'DBIx::Class::Storage::DBI::Replicated::Balancer'; 
+    => 'DBIx::Class::Storage::DBI::Replicated::Balancer';
 
 ok my @replicant_connects = $replicated->generate_replicant_connect_info
     => 'got replication connect information';
@@ -288,14 +287,14 @@
 our %debug;
 $replicated->schema->storage->debug(1);
 $replicated->schema->storage->debugcb(sub {
-	my ($op, $info) = @_;
-	##warn "\n$op, $info\n";
-	%debug = (
-		op => $op,
-		info => $info,
-		dsn => ($info=~m/\[(.+)\]/)[0],
-		storage_type => $info=~m/REPLICANT/ ? 'REPLICANT' : 'MASTER',
-	);
+    my ($op, $info) = @_;
+    ##warn "\n$op, $info\n";
+    %debug = (
+        op => $op,
+        info => $info,
+        dsn => ($info=~m/\[(.+)\]/)[0],
+        storage_type => $info=~m/REPLICANT/ ? 'REPLICANT' : 'MASTER',
+    );
 });
 
 ok my @all_storages = $replicated->schema->storage->all_storages
@@ -316,7 +315,7 @@
 is ((grep $_->{master_option}, @all_storage_opts),
     3
     => 'connect_info was merged from master to replicants');
- 
+
 my @replicant_names = keys %{ $replicated->schema->storage->replicants };
 
 ok @replicant_names, "found replicant names @replicant_names";
@@ -325,29 +324,29 @@
 ## sqlite dbs.
 $replicated->schema->storage->debugobj->silence(1)
   if first { m{^t/} } @replicant_names;
-   
+
 isa_ok $replicated->schema->storage->balancer->current_replicant
-    => 'DBIx::Class::Storage::DBI'; 
+    => 'DBIx::Class::Storage::DBI';
 
 $replicated->schema->storage->debugobj->silence(0);
 
 ok $replicated->schema->storage->pool->has_replicants
-    => 'does have replicants';     
+    => 'does have replicants';
 
 is $replicated->schema->storage->pool->num_replicants => 2
     => 'has two replicants';
-       
+
 does_ok $replicated_storages[0]
     => 'DBIx::Class::Storage::DBI::Replicated::Replicant';
 
 does_ok $replicated_storages[1]
     => 'DBIx::Class::Storage::DBI::Replicated::Replicant';
-    
+
 does_ok $replicated->schema->storage->replicants->{$replicant_names[0]}
     => 'DBIx::Class::Storage::DBI::Replicated::Replicant';
 
 does_ok $replicated->schema->storage->replicants->{$replicant_names[1]}
-    => 'DBIx::Class::Storage::DBI::Replicated::Replicant';  
+    => 'DBIx::Class::Storage::DBI::Replicated::Replicant';
 
 ## Add some info to the database
 
@@ -358,11 +357,11 @@
         [ 4, "Ozric Tentacles"],
     ]);
 
-	is $debug{storage_type}, 'MASTER', 
-		"got last query from a master: $debug{dsn}";
-	
-	like $debug{info}, qr/INSERT/, 'Last was an insert';
-                
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
+
+    like $debug{info}, qr/INSERT/, 'Last was an insert';
+
 ## Make sure all the slaves have the table definitions
 
 $replicated->replicate;
@@ -373,7 +372,7 @@
 ## sqlite dbs.
 $replicated->schema->storage->debugobj->silence(1)
   if first { m{^t/} } @replicant_names;
- 
+
 $replicated->schema->storage->pool->validate_replicants;
 
 $replicated->schema->storage->debugobj->silence(0);
@@ -385,12 +384,12 @@
 
 ## We removed testing here since master read weight is on, so we can't tell in
 ## advance what storage to expect.  We turn master read weight off a bit lower
-## is $debug{storage_type}, 'REPLICANT' 
-## 	=> "got last query from a replicant: $debug{dsn}, $debug{info}";
+## is $debug{storage_type}, 'REPLICANT'
+##     => "got last query from a replicant: $debug{dsn}, $debug{info}";
 
 isa_ok $artist1
     => 'DBICTest::Artist';
-    
+
 is $artist1->name, 'Ozric Tentacles'
     => 'Found expected name for first result';
 
@@ -400,7 +399,7 @@
 
     local
     *DBIx::Class::Storage::DBI::Replicated::Balancer::Random::_random_number =
-	sub { 999 };
+    sub { 999 };
 
     $replicated->schema->storage->balancer->increment_storage;
 
@@ -426,11 +425,11 @@
         [ 7, "Watergate"],
     ]);
 
-	is $debug{storage_type}, 'MASTER', 
-		"got last query from a master: $debug{dsn}";
-	
-	like $debug{info}, qr/INSERT/, 'Last was an insert';
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
 
+    like $debug{info}, qr/INSERT/, 'Last was an insert';
+
 ## Make sure all the slaves have the table definitions
 $replicated->replicate;
 
@@ -439,12 +438,12 @@
 ok my $artist2 = $replicated->schema->resultset('Artist')->find(5)
     => 'Sync succeed';
 
-is $debug{storage_type}, 'REPLICANT' 
-	=> "got last query from a replicant: $debug{dsn}";
-	    
+is $debug{storage_type}, 'REPLICANT'
+    => "got last query from a replicant: $debug{dsn}";
+
 isa_ok $artist2
     => 'DBICTest::Artist';
-    
+
 is $artist2->name, "Doom's Children"
     => 'Found expected name for first result';
 
@@ -452,7 +451,7 @@
 
 is $replicated->schema->storage->pool->connected_replicants => 2
     => "both replicants are connected";
-    
+
 $replicated->schema->storage->replicants->{$replicant_names[0]}->disconnect;
 $replicated->schema->storage->replicants->{$replicant_names[1]}->disconnect;
 
@@ -464,51 +463,51 @@
 ok my $artist3 = $replicated->schema->resultset('Artist')->find(6)
     => 'Still finding stuff.';
 
-is $debug{storage_type}, 'REPLICANT' 
-	=> "got last query from a replicant: $debug{dsn}";
-	    
+is $debug{storage_type}, 'REPLICANT'
+    => "got last query from a replicant: $debug{dsn}";
+
 isa_ok $artist3
     => 'DBICTest::Artist';
-    
+
 is $artist3->name, "Dead On Arrival"
     => 'Found expected name for first result';
 
 is $replicated->schema->storage->pool->connected_replicants => 1
     => "At Least One replicant reconnected to handle the job";
-    
+
 ## What happens when we try to select something that doesn't exist?
 
 ok ! $replicated->schema->resultset('Artist')->find(666)
     => 'Correctly failed to find something.';
 
-is $debug{storage_type}, 'REPLICANT' 
-	=> "got last query from a replicant: $debug{dsn}";
-		    
+is $debug{storage_type}, 'REPLICANT'
+    => "got last query from a replicant: $debug{dsn}";
+
 ## test the reliable option
 
 TESTRELIABLE: {
-	
-	$replicated->schema->storage->set_reliable_storage;
-	
-	ok $replicated->schema->resultset('Artist')->find(2)
-	    => 'Read from master 1';
 
-	is $debug{storage_type}, 'MASTER', 
-		"got last query from a master: $debug{dsn}";
-			
-	ok $replicated->schema->resultset('Artist')->find(5)
-	    => 'Read from master 2';
+    $replicated->schema->storage->set_reliable_storage;
 
-	is $debug{storage_type}, 'MASTER', 
-		"got last query from a master: $debug{dsn}";
-			    
-    $replicated->schema->storage->set_balanced_storage;	    
-	    
-	ok $replicated->schema->resultset('Artist')->find(3)
+    ok $replicated->schema->resultset('Artist')->find(2)
+        => 'Read from master 1';
+
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
+
+    ok $replicated->schema->resultset('Artist')->find(5)
+        => 'Read from master 2';
+
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
+
+    $replicated->schema->storage->set_balanced_storage;
+
+    ok $replicated->schema->resultset('Artist')->find(3)
         => 'Read from replicant';
 
-	is $debug{storage_type}, 'REPLICANT', 
-		"got last query from a replicant: $debug{dsn}";
+    is $debug{storage_type}, 'REPLICANT',
+        "got last query from a replicant: $debug{dsn}";
 }
 
 ## Make sure when reliable goes out of scope, we are using replicants again
@@ -516,14 +515,14 @@
 ok $replicated->schema->resultset('Artist')->find(1)
     => 'back to replicant 1.';
 
-	is $debug{storage_type}, 'REPLICANT', 
-		"got last query from a replicant: $debug{dsn}";
-		    
+    is $debug{storage_type}, 'REPLICANT',
+        "got last query from a replicant: $debug{dsn}";
+
 ok $replicated->schema->resultset('Artist')->find(2)
     => 'back to replicant 2.';
 
-	is $debug{storage_type}, 'REPLICANT', 
-		"got last query from a replicant: $debug{dsn}";
+    is $debug{storage_type}, 'REPLICANT',
+        "got last query from a replicant: $debug{dsn}";
 
 ## set all the replicants to inactive, and make sure the balancer falls back to
 ## the master.
@@ -538,13 +537,13 @@
     $replicated->schema->storage->debugfh($debugfh);
 
     ok $replicated->schema->resultset('Artist')->find(2)
-		=> 'Fallback to master';
+        => 'Fallback to master';
 
-	is $debug{storage_type}, 'MASTER', 
-		"got last query from a master: $debug{dsn}";
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
 
     like $fallback_warning, qr/falling back to master/
-		=> 'emits falling back to master warning';
+        => 'emits falling back to master warning';
 
     $replicated->schema->storage->debugfh($oldfh);
 }
@@ -556,7 +555,7 @@
 ## sqlite dbs.
 $replicated->schema->storage->debugobj->silence(1)
   if first { m{^t/} } @replicant_names;
- 
+
 $replicated->schema->storage->pool->validate_replicants;
 
 $replicated->schema->storage->debugobj->silence(0);
@@ -564,89 +563,89 @@
 ok $replicated->schema->resultset('Artist')->find(2)
     => 'Returned to replicates';
 
-is $debug{storage_type}, 'REPLICANT', 
-	"got last query from a replicant: $debug{dsn}";
-    
+is $debug{storage_type}, 'REPLICANT',
+    "got last query from a replicant: $debug{dsn}";
+
 ## Getting slave status tests
 
 SKIP: {
     ## We skip this tests unless you have a custom replicants, since the default
     ## sqlite based replication tests don't support these functions.
-    
-    skip 'Cannot Test Replicant Status on Non Replicating Database', 10 
+
+    skip 'Cannot Test Replicant Status on Non Replicating Database', 10
      unless DBICTest->has_custom_dsn && $ENV{"DBICTEST_SLAVE0_DSN"};
 
     $replicated->replicate; ## Give the slaves a chance to catchup.
 
-	ok $replicated->schema->storage->replicants->{$replicant_names[0]}->is_replicating
-	    => 'Replicants are replicating';
-	    
-	is $replicated->schema->storage->replicants->{$replicant_names[0]}->lag_behind_master, 0
-	    => 'Replicant is zero seconds behind master';
-	    
-	## Test the validate replicants
-	
-	$replicated->schema->storage->pool->validate_replicants;
-	
-	is $replicated->schema->storage->pool->active_replicants, 2
-	    => 'Still have 2 replicants after validation';
-	    
-	## Force the replicants to fail the validate test by required their lag to
-	## be negative (ie ahead of the master!)
-	
+    ok $replicated->schema->storage->replicants->{$replicant_names[0]}->is_replicating
+        => 'Replicants are replicating';
+
+    is $replicated->schema->storage->replicants->{$replicant_names[0]}->lag_behind_master, 0
+        => 'Replicant is zero seconds behind master';
+
+    ## Test the validate replicants
+
+    $replicated->schema->storage->pool->validate_replicants;
+
+    is $replicated->schema->storage->pool->active_replicants, 2
+        => 'Still have 2 replicants after validation';
+
+    ## Force the replicants to fail the validate test by required their lag to
+    ## be negative (ie ahead of the master!)
+
     $replicated->schema->storage->pool->maximum_lag(-10);
     $replicated->schema->storage->pool->validate_replicants;
-    
+
     is $replicated->schema->storage->pool->active_replicants, 0
         => 'No way a replicant be be ahead of the master';
-        
+
     ## Let's be fair to the replicants again.  Let them lag up to 5
-	
+
     $replicated->schema->storage->pool->maximum_lag(5);
     $replicated->schema->storage->pool->validate_replicants;
-    
+
     is $replicated->schema->storage->pool->active_replicants, 2
-        => 'Both replicants in good standing again';	
-        
-	## Check auto validate
-	
-	is $replicated->schema->storage->balancer->auto_validate_every, 100
-	    => "Got the expected value for auto validate";
-	    
-		## This will make sure we auto validatge everytime
-		$replicated->schema->storage->balancer->auto_validate_every(0);
-		
-		## set all the replicants to inactive, and make sure the balancer falls back to
-		## the master.
-		
-		$replicated->schema->storage->replicants->{$replicant_names[0]}->active(0);
-		$replicated->schema->storage->replicants->{$replicant_names[1]}->active(0);
-		
-		## Ok, now when we go to run a query, autovalidate SHOULD reconnect
-	
-	is $replicated->schema->storage->pool->active_replicants => 0
-	    => "both replicants turned off";
-	    	
-	ok $replicated->schema->resultset('Artist')->find(5)
-	    => 'replicant reactivated';
+        => 'Both replicants in good standing again';
 
-	is $debug{storage_type}, 'REPLICANT',
-		"got last query from a replicant: $debug{dsn}";
-	    
-	is $replicated->schema->storage->pool->active_replicants => 2
-	    => "both replicants reactivated";        
+    ## Check auto validate
+
+    is $replicated->schema->storage->balancer->auto_validate_every, 100
+        => "Got the expected value for auto validate";
+
+        ## This will make sure we auto validatge everytime
+        $replicated->schema->storage->balancer->auto_validate_every(0);
+
+        ## set all the replicants to inactive, and make sure the balancer falls back to
+        ## the master.
+
+        $replicated->schema->storage->replicants->{$replicant_names[0]}->active(0);
+        $replicated->schema->storage->replicants->{$replicant_names[1]}->active(0);
+
+        ## Ok, now when we go to run a query, autovalidate SHOULD reconnect
+
+    is $replicated->schema->storage->pool->active_replicants => 0
+        => "both replicants turned off";
+
+    ok $replicated->schema->resultset('Artist')->find(5)
+        => 'replicant reactivated';
+
+    is $debug{storage_type}, 'REPLICANT',
+        "got last query from a replicant: $debug{dsn}";
+
+    is $replicated->schema->storage->pool->active_replicants => 2
+        => "both replicants reactivated";
 }
 
 ## Test the reliably callback
 
 ok my $reliably = sub {
-	
+
     ok $replicated->schema->resultset('Artist')->find(5)
         => 'replicant reactivated';
 
-	is $debug{storage_type}, 'MASTER',
-		"got last query from a master: $debug{dsn}";
-	
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
+
 } => 'created coderef properly';
 
 $replicated->schema->storage->execute_reliably($reliably);
@@ -654,95 +653,95 @@
 ## Try something with an error
 
 ok my $unreliably = sub {
-    
+
     ok $replicated->schema->resultset('ArtistXX')->find(5)
-        => 'replicant reactivated'; 
-    
+        => 'replicant reactivated';
+
 } => 'created coderef properly';
 
-throws_ok {$replicated->schema->storage->execute_reliably($unreliably)} 
+throws_ok {$replicated->schema->storage->execute_reliably($unreliably)}
     qr/Can't find source for ArtistXX/
     => 'Bad coderef throws proper error';
-    
+
 ## Make sure replication came back
 
 ok $replicated->schema->resultset('Artist')->find(3)
     => 'replicant reactivated';
 
 is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}";
-    
+
 ## make sure transactions are set to execute_reliably
 
 ok my $transaction = sub {
-	
-	my $id = shift @_;
-	
-	$replicated
-	    ->schema
-	    ->populate('Artist', [
-	        [ qw/artistid name/ ],
-	        [ $id, "Children of the Grave"],
-	    ]);
-	    
+
+    my $id = shift @_;
+
+    $replicated
+        ->schema
+        ->populate('Artist', [
+            [ qw/artistid name/ ],
+            [ $id, "Children of the Grave"],
+        ]);
+
     ok my $result = $replicated->schema->resultset('Artist')->find($id)
         => "Found expected artist for $id";
 
-	is $debug{storage_type}, 'MASTER',
-		"got last query from a master: $debug{dsn}";
-			        
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
+
     ok my $more = $replicated->schema->resultset('Artist')->find(1)
         => 'Found expected artist again for 1';
 
-	is $debug{storage_type}, 'MASTER',
-		"got last query from a master: $debug{dsn}";
-			        
+    is $debug{storage_type}, 'MASTER',
+        "got last query from a master: $debug{dsn}";
+
    return ($result, $more);
-   
+
 } => 'Created a coderef properly';
 
 ## Test the transaction with multi return
 {
-	ok my @return = $replicated->schema->txn_do($transaction, 666)
-	    => 'did transaction';
-	    
-	    is $return[0]->id, 666
-	        => 'first returned value is correct';
+    ok my @return = $replicated->schema->txn_do($transaction, 666)
+        => 'did transaction';
 
-		is $debug{storage_type}, 'MASTER',
-		    "got last query from a master: $debug{dsn}";
-	        
-	    is $return[1]->id, 1
-	        => 'second returned value is correct';
+        is $return[0]->id, 666
+            => 'first returned value is correct';
 
-		is $debug{storage_type}, 'MASTER',
-		     "got last query from a master: $debug{dsn}";
+        is $debug{storage_type}, 'MASTER',
+            "got last query from a master: $debug{dsn}";
 
+        is $return[1]->id, 1
+            => 'second returned value is correct';
+
+        is $debug{storage_type}, 'MASTER',
+             "got last query from a master: $debug{dsn}";
+
 }
 
 ## Test that asking for single return works
 {
-	ok my @return = $replicated->schema->txn_do($transaction, 777)
-	    => 'did transaction';
-	    
-	    is $return[0]->id, 777
-	        => 'first returned value is correct';
-	        
-	    is $return[1]->id, 1
-	        => 'second returned value is correct';
+    ok my @return = $replicated->schema->txn_do($transaction, 777)
+        => 'did transaction';
+
+        is $return[0]->id, 777
+            => 'first returned value is correct';
+
+        is $return[1]->id, 1
+            => 'second returned value is correct';
 }
 
 ## Test transaction returning a single value
 
 {
-	ok my $result = $replicated->schema->txn_do(sub {
-		ok my $more = $replicated->schema->resultset('Artist')->find(1)
-		=> 'found inside a transaction';
-		is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
-		return $more;
-	}) => 'successfully processed transaction';
-	
-	is $result->id, 1
-	   => 'Got expected single result from transaction';
+    ok my $result = $replicated->schema->txn_do(sub {
+        ok my $more = $replicated->schema->resultset('Artist')->find(1)
+        => 'found inside a transaction';
+        is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+        return $more;
+    }) => 'successfully processed transaction';
+
+    is $result->id, 1
+       => 'Got expected single result from transaction';
 }
 
 ## Make sure replication came back
@@ -751,88 +750,104 @@
     => 'replicant reactivated';
 
 is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}";
-    
+
 ## Test Discard changes
 
 {
-	ok my $artist = $replicated->schema->resultset('Artist')->find(2)
-	    => 'got an artist to test discard changes';
+    ok my $artist = $replicated->schema->resultset('Artist')->find(2)
+        => 'got an artist to test discard changes';
 
-	is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}";
+    is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}";
 
-	ok $artist->get_from_storage({force_pool=>'master'})
-	   => 'properly discard changes';
+    ok $artist->get_from_storage({force_pool=>'master'})
+       => 'properly discard changes';
 
-	is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+    is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
 
+    ok $artist->discard_changes({force_pool=>'master'})
+       => 'properly called discard_changes against master (manual attrs)';
+
+    is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+
+    ok $artist->discard_changes()
+       => 'properly called discard_changes against master (default attrs)';
+
+    is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+
+    ok $artist->discard_changes({force_pool=>$replicant_names[0]})
+       => 'properly able to override the default attributes';
+
+    is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}"
 }
 
 ## Test some edge cases, like trying to do a transaction inside a transaction, etc
 
 {
     ok my $result = $replicated->schema->txn_do(sub {
-    	return $replicated->schema->txn_do(sub {
-	        ok my $more = $replicated->schema->resultset('Artist')->find(1)
-	        => 'found inside a transaction inside a transaction';
-			is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
-	        return $more;    		
-    	});
+        return $replicated->schema->txn_do(sub {
+            ok my $more = $replicated->schema->resultset('Artist')->find(1)
+            => 'found inside a transaction inside a transaction';
+            is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+            return $more;
+        });
     }) => 'successfully processed transaction';
-    
+
     is $result->id, 1
-       => 'Got expected single result from transaction';	  
+       => 'Got expected single result from transaction';
 }
 
 {
     ok my $result = $replicated->schema->txn_do(sub {
-    	return $replicated->schema->storage->execute_reliably(sub {
-	    	return $replicated->schema->txn_do(sub {
-	    		return $replicated->schema->storage->execute_reliably(sub {
-			        ok my $more = $replicated->schema->resultset('Artist')->find(1)
-			          => 'found inside crazy deep transactions and execute_reliably';
-					is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
-			        return $more; 	    			
-	    		});
-	    	});    	
-    	});
+        return $replicated->schema->storage->execute_reliably(sub {
+            return $replicated->schema->txn_do(sub {
+                return $replicated->schema->storage->execute_reliably(sub {
+                    ok my $more = $replicated->schema->resultset('Artist')->find(1)
+                      => 'found inside crazy deep transactions and execute_reliably';
+                    is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+                    return $more;
+                });
+            });
+        });
     }) => 'successfully processed transaction';
-    
+
     is $result->id, 1
-       => 'Got expected single result from transaction';	  
-}     
+       => 'Got expected single result from transaction';
+}
 
 ## Test the force_pool resultset attribute.
 
 {
-	ok my $artist_rs = $replicated->schema->resultset('Artist')
+    ok my $artist_rs = $replicated->schema->resultset('Artist')
         => 'got artist resultset';
-	   
-	## Turn on Forced Pool Storage
-	ok my $reliable_artist_rs = $artist_rs->search(undef, {force_pool=>'master'})
+
+    ## Turn on Forced Pool Storage
+    ok my $reliable_artist_rs = $artist_rs->search(undef, {force_pool=>'master'})
         => 'Created a resultset using force_pool storage';
-	   
-    ok my $artist = $reliable_artist_rs->find(2) 
+
+    ok my $artist = $reliable_artist_rs->find(2)
         => 'got an artist result via force_pool storage';
 
-	is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
+    is $debug{storage_type}, 'MASTER', "got last query from a master: $debug{dsn}";
 }
 
 ## Test the force_pool resultset attribute part two.
 
 {
-	ok my $artist_rs = $replicated->schema->resultset('Artist')
+    ok my $artist_rs = $replicated->schema->resultset('Artist')
         => 'got artist resultset';
-	   
-	## Turn on Forced Pool Storage
-	ok my $reliable_artist_rs = $artist_rs->search(undef, {force_pool=>$replicant_names[0]})
+
+    ## Turn on Forced Pool Storage
+    ok my $reliable_artist_rs = $artist_rs->search(undef, {force_pool=>$replicant_names[0]})
         => 'Created a resultset using force_pool storage';
-	   
-    ok my $artist = $reliable_artist_rs->find(2) 
+
+    ok my $artist = $reliable_artist_rs->find(2)
         => 'got an artist result via force_pool storage';
 
-	is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}";
+    is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{dsn}";
 }
 ## Delete the old database files
 $replicated->cleanup;
 
+done_testing;
+
 # vim: sw=4 sts=4 :

Modified: DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year1999CDs.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year1999CDs.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year1999CDs.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -3,7 +3,6 @@
 ## Used in 104view.t
 
 use base qw/DBICTest::BaseResult/;
-use DBIx::Class::ResultSource::View;
 
 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 

Modified: DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year2000CDs.pm
===================================================================
--- DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year2000CDs.pm	2009-08-08 15:40:19 UTC (rev 7260)
+++ DBIx-Class/0.08/branches/reduce_pings/t/lib/DBICTest/Schema/Year2000CDs.pm	2009-08-08 15:44:39 UTC (rev 7261)
@@ -3,7 +3,6 @@
 ## Used in 104view.t
 
 use base qw/DBICTest::BaseResult/;
-use DBIx::Class::ResultSource::View;
 
 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 




More information about the Bast-commits mailing list