[Bast-commits] r5178 - in DBIx-Class/0.08/branches/views_support: . lib/DBIx/Class lib/DBIx/Class/CDBICompat lib/DBIx/Class/InflateColumn lib/DBIx/Class/Manual lib/DBIx/Class/Relationship lib/DBIx/Class/ResultSourceProxy lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/ODBC lib/DBIx/Class/Storage/DBI/Oracle lib/DBIx/Class/Storage/DBI/Replicated lib/DBIx/Class/Storage/DBI/Role lib/SQL/Translator/Parser/DBIx maint t t/cdbi-t t/lib t/lib/DBICTest t/lib/DBICTest/Schema t/testlib

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Sat Nov 22 18:56:26 GMT 2008


Author: groditi
Date: 2008-11-22 18:56:26 +0000 (Sat, 22 Nov 2008)
New Revision: 5178

Added:
   DBIx-Class/0.08/branches/views_support/t/cdbi-t/mk_group_accessors.t
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artwork.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Image.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/LyricVersion.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Lyrics.pm
Modified:
   DBIx-Class/0.08/branches/views_support/
   DBIx-Class/0.08/branches/views_support/Changes
   DBIx-Class/0.08/branches/views_support/TODO
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/CDBICompat/AccessorMapping.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/InflateColumn/DateTime.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Manual/Cookbook.pod
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Relationship/BelongsTo.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSet.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSetColumn.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSource.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSourceProxy/Table.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Schema.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Role/QueryCounter.pm
   DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/SQLite.pm
   DBIx-Class/0.08/branches/views_support/lib/SQL/Translator/Parser/DBIx/Class.pm
   DBIx-Class/0.08/branches/views_support/maint/gen-schema.pl
   DBIx-Class/0.08/branches/views_support/t/19quotes_newstyle.t
   DBIx-Class/0.08/branches/views_support/t/32connect_code_ref.t
   DBIx-Class/0.08/branches/views_support/t/50fork.t
   DBIx-Class/0.08/branches/views_support/t/51threads.t
   DBIx-Class/0.08/branches/views_support/t/51threadtxn.t
   DBIx-Class/0.08/branches/views_support/t/60core.t
   DBIx-Class/0.08/branches/views_support/t/66relationship.t
   DBIx-Class/0.08/branches/views_support/t/68inflate_resultclass_hashrefinflator.t
   DBIx-Class/0.08/branches/views_support/t/71mysql.t
   DBIx-Class/0.08/branches/views_support/t/73oracle.t
   DBIx-Class/0.08/branches/views_support/t/746mssql.t
   DBIx-Class/0.08/branches/views_support/t/74mssql.t
   DBIx-Class/0.08/branches/views_support/t/76select.t
   DBIx-Class/0.08/branches/views_support/t/77prefetch.t
   DBIx-Class/0.08/branches/views_support/t/86sqlt.t
   DBIx-Class/0.08/branches/views_support/t/88result_set_column.t
   DBIx-Class/0.08/branches/views_support/t/91debug.t
   DBIx-Class/0.08/branches/views_support/t/93nobindvars.t
   DBIx-Class/0.08/branches/views_support/t/96multi_create.t
   DBIx-Class/0.08/branches/views_support/t/97result_class.t
   DBIx-Class/0.08/branches/views_support/t/98savepoints.t
   DBIx-Class/0.08/branches/views_support/t/99dbic_sqlt_parser.t
   DBIx-Class/0.08/branches/views_support/t/bindtype_columns.t
   DBIx-Class/0.08/branches/views_support/t/cdbi-t/02-Film.t
   DBIx-Class/0.08/branches/views_support/t/cdbi-t/15-accessor.t
   DBIx-Class/0.08/branches/views_support/t/cdbi-t/23-cascade.t
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artist.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Bookmark.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/CD.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Event.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/ForceForeign.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Producer.pm
   DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Track.pm
   DBIx-Class/0.08/branches/views_support/t/lib/sqlite.sql
   DBIx-Class/0.08/branches/views_support/t/testlib/MyBase.pm
Log:
 r23680 at martha (orig r5051):  schwern | 2008-11-04 13:26:09 -0500
 normalize the indentation and detabify
 r23681 at martha (orig r5052):  schwern | 2008-11-04 13:26:19 -0500
 And now really untabify
 r23682 at martha (orig r5053):  schwern | 2008-11-04 13:26:29 -0500
 Normalize indentation
 r23683 at martha (orig r5054):  schwern | 2008-11-04 13:26:41 -0500
 [rt.cpan.org 36863]
 Fix mk_group_accessors() to handle [$field, $name].  It ignores
 accessor/mutator_name_for() because if you pass in your own accessor
 name you probably mean it.
 r23692 at martha (orig r5063):  schwern | 2008-11-06 07:44:27 -0500
 mk_group_accessor() is sometimes called internally when inflating a column
 and with an array ref field spec, but the accessor and column names are
 the same.  Special case that to go through the usual accessor_name_for stuff.
 r23693 at martha (orig r5064):  schwern | 2008-11-06 07:44:36 -0500
 A little indentation clean up
 
 Test the result of an eval directly.
 
 discard the changes to $sandl to quiet an "object destroyed with changes"
 warning.
 r23695 at martha (orig r5066):  renormalist | 2008-11-06 15:23:22 -0500
 - pod documentation for SQL::Translator::Parser::DBIx::Class
 
 r23696 at martha (orig r5067):  renormalist | 2008-11-06 16:59:42 -0500
 - unhide SQL::Translator::Parser::DBIx::Class from pause indexer
 
 r23700 at martha (orig r5071):  ribasushi | 2008-11-07 02:29:21 -0500
 Final insanification of the multicreate test
 r23701 at martha (orig r5072):  ribasushi | 2008-11-07 02:30:49 -0500
 Fix loss of objects on multicreate over several 1:M relations
 r23702 at martha (orig r5073):  ribasushi | 2008-11-07 04:42:48 -0500
 One extra multicreate test and some cleanup
 r23718 at martha (orig r5081):  ribasushi | 2008-11-09 08:35:57 -0500
 More TODO items
 r23719 at martha (orig r5082):  ribasushi | 2008-11-09 10:27:40 -0500
 SQLT behaves sanely in scalar context, no need for stupid version detections (ribasushi--)
 r23720 at martha (orig r5083):  ribasushi | 2008-11-09 10:29:34 -0500
 Some testdb changes and alignment, preparing for test refactor branch
 r23721 at martha (orig r5084):  ribasushi | 2008-11-09 10:35:30 -0500
 Fix detection of multiple rows being returned for single(): calling fetchrow_array in scalar context leads to indefined results (http://search.cpan.org/~timb/DBI/DBI.pm#fetchrow_array)
 r23722 at martha (orig r5085):  ribasushi | 2008-11-09 11:02:05 -0500
 Don't rely on connect_info(), instead fetch the dsn from _dbi_connect_info (which is stable no matter which connect_info() flavor is used)
 todo: ping jnpiorkowski about Replicated::Pool and Replicated::Replicant - it blindly assumes that connect_info->[0] contains the dsn, which might not be the case. Even when using _dbi_connect_info, the first element might be a coderef
 r23723 at martha (orig r5086):  ribasushi | 2008-11-09 15:19:39 -0500
 Switch schema management version calls from VERSION() to schema_version()
 r23727 at martha (orig r5090):  jnapiorkowski | 2008-11-10 11:12:28 -0500
 changed the way we get the DSN for debugging in replication
 r23729 at martha (orig r5092):  ribasushi | 2008-11-10 17:46:45 -0500
 Switch out one more reliance on connect_info
 r23734 at martha (orig r5097):  ribasushi | 2008-11-10 18:09:23 -0500
 belongs_to relationships are explicitly flagged by default, to aid the DBIC SQLT parser (by abraxxa)
 r23735 at martha (orig r5098):  ribasushi | 2008-11-10 18:18:01 -0500
 Clarify attributes argument of find()
 r23921 at martha (orig r5113):  plu | 2008-11-12 11:42:44 -0500
 fixed 73oracle.t, added charfield
 r23925 at martha (orig r5117):  ribasushi | 2008-11-13 02:34:26 -0500
 result_class goodies by Caelum:
 - result_class can now be specified as a search attribute, attaching it to the returned resultset
 - the specified class is now autoloaded via ensure_loaded()
 
 r23927 at martha (orig r5119):  ribasushi | 2008-11-13 13:34:29 -0500
 resultset attribute from can now take a scalarref and use it verbatim
 r23936 at martha (orig r5128):  ribasushi | 2008-11-14 04:46:00 -0500
 Document the new from usage
 r23942 at martha (orig r5134):  ribasushi | 2008-11-14 12:44:25 -0500
 we use register_extra_source() now
 r23948 at martha (orig r5140):  castaway | 2008-11-15 16:08:30 -0500
 Added failing create-multi test
 
 r23949 at martha (orig r5141):  ribasushi | 2008-11-16 04:53:07 -0500
 whops
 r23950 at martha (orig r5142):  norbi | 2008-11-16 14:12:42 -0500
  r5165 at vger:  mendel | 2008-11-16 20:11:42 +0100
   * Merged in changes from 'resultsetcolumn_custom_columns' branch,
 
 r23957 at martha (orig r5149):  ribasushi | 2008-11-16 17:14:13 -0500
 Revert castaway's test - mildly bogus
 r23958 at martha (orig r5150):  ribasushi | 2008-11-16 17:16:31 -0500
 Add new test relationship - a track can have a relates single_cd
 r23959 at martha (orig r5151):  ribasushi | 2008-11-16 17:23:38 -0500
 might_have test for castaway to break
 r23960 at martha (orig r5152):  ribasushi | 2008-11-16 19:33:51 -0500
 rip away a horribly wrong create_via_update test (will pass when multicreate is merged)
 r23961 at martha (orig r5153):  ribasushi | 2008-11-16 20:00:28 -0500
 One more (passing) multicreate test and a bit of cleanup
 r23962 at martha (orig r5154):  ribasushi | 2008-11-16 20:59:53 -0500
 Two more sets of might_have - has_many relationships for extra tests
 r23963 at martha (orig r5155):  ribasushi | 2008-11-16 21:09:18 -0500
 Two failing multicreate tests (the root cause of castaway's problem)
 r23964 at martha (orig r5156):  ribasushi | 2008-11-16 21:48:57 -0500
 Silence cdbi tests like everything else
 r23965 at martha (orig r5157):  ribasushi | 2008-11-16 22:01:39 -0500
 Failing tests by zby, showing that recursing insert() gets in the way of some exotic insert scenarious - waiting for mst to decide course of action
 r23966 at martha (orig r5158):  ribasushi | 2008-11-17 06:04:54 -0500
 Extend might_have test with ideas from zby
 r23969 at martha (orig r5161):  ribasushi | 2008-11-20 05:25:32 -0500
 Trunk passes tests again - todoify everything multicreate related to branch it out, as the task turned out to be more complex (no indentation to aid future merging)
 r23972 at martha (orig r5164):  ribasushi | 2008-11-20 06:01:14 -0500
 CDBI-compat tests by Dave Horwoth:
 
     OK. I've attached a patch to t/cdbi-t/15-accessor.t that does several
     things:
 
     (1) Fixes the way the arguments are built so the sheep argument is
     correct in the tests.
 
     (2) Adds explicit tests for the number of sheep so we can be sure which
     database record is actually returned.
 
     (3) Adds tests for find_or_create() with modified accessor names.
 
     (4) Fixes the test for search() to report all errors
 
     I still don't fully understand what's going on in the output below but I
     think they are genuine test failures. I'd appreciate it if somebody else
     could run the tests to make sure the results are not some artefact of my
     test environment. I also attached a copy of the modified test script so
     you don't even have to apply the patch first :)
 
     I don't know what the DestroyWarning at the end is all about.
 
 
 r23973 at martha (orig r5165):  ribasushi | 2008-11-20 06:09:11 -0500
 Minor doc patch by Caelum
 r23976 at martha (orig r5168):  castaway | 2008-11-20 08:49:39 -0500
 Fix pod errors so that some storage subclasses show up in cpan properly
 



Property changes on: DBIx-Class/0.08/branches/views_support
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
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
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
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_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
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:/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/trunk:5165
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
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
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_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
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/trunk:5168
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

Modified: DBIx-Class/0.08/branches/views_support/Changes
===================================================================
--- DBIx-Class/0.08/branches/views_support/Changes	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/Changes	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1,4 +1,8 @@
 Revision history for DBIx::Class
+        - Allow a scalarref to be supplied to the 'from' resultset attribute
+        - Classes submitted as result_class for a resultsource are now
+          automatically loaded via ensure_loaded()
+        - 'result_class' resultset attribute, identical to result_class()
 
 0.08099_05 2008-10-30 21:30:00 (UTC)
         - Rewritte of Storage::DBI::connect_info(), extended with an

Modified: DBIx-Class/0.08/branches/views_support/TODO
===================================================================
--- DBIx-Class/0.08/branches/views_support/TODO	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/TODO	2008-11-22 18:56:26 UTC (rev 5178)
@@ -55,3 +55,10 @@
   - Automatically infer quote_char/name_sep from $schema->storage
   - Finally incorporate View support (needs real tests)
   - Fix and properly test chained search attribute merging
+
+2008-11-07 by ribasushi
+  - Be loud when a relationship resolution fails because we did not select/as
+    a neccessary pk
+  - Recursive update() (all code seems to be already available)
+  - $rs->populate changes its syntax depending on wantarray context (BAD)
+    Also the interface differs from $schema->populate (not so good)

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/CDBICompat/AccessorMapping.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/CDBICompat/AccessorMapping.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/CDBICompat/AccessorMapping.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1,26 +1,35 @@
 package # hide from PAUSE Indexer
-    DBIx::Class::CDBICompat::AccessorMapping;
+  DBIx::Class::CDBICompat::AccessorMapping;
 
 use strict;
 use warnings;
 
 sub mk_group_accessors {
-  my ($class, $group, @cols) = @_;
+    my ($class, $group, @cols) = @_;
 
-  foreach my $col (@cols) {
-    my $ro_meth = $class->accessor_name_for($col);
-    my $wo_meth = $class->mutator_name_for($col);
+    foreach my $col (@cols) {
+        my($accessor, $col) = ref $col ? @$col : (undef, $col);
 
-    # warn "class: $class / col: $col / ro: $ro_meth / wo: $wo_meth\n";
-    if ($ro_meth eq $wo_meth or     # they're the same
-        $wo_meth eq $col)           # or only the accessor is custom
-    {
-      $class->next::method($group => [ $ro_meth => $col ]);
-    } else {
-      $class->mk_group_ro_accessors($group => [ $ro_meth => $col ]);
-      $class->mk_group_wo_accessors($group => [ $wo_meth => $col ]);
+        my($ro_meth, $wo_meth);
+        if( defined $accessor and ($accessor ne $col)) {
+            $ro_meth = $wo_meth = $accessor;
+        }
+        else {
+            $ro_meth = $class->accessor_name_for($col);
+            $wo_meth = $class->mutator_name_for($col);
+        }
+
+        # warn "class: $class / col: $col / ro: $ro_meth / wo: $wo_meth\n";
+        if ($ro_meth eq $wo_meth or # they're the same
+            $wo_meth eq $col)     # or only the accessor is custom
+        {
+            $class->next::method($group => [ $ro_meth => $col ]);
+        }
+        else {
+            $class->mk_group_ro_accessors($group => [ $ro_meth => $col ]);
+            $class->mk_group_wo_accessors($group => [ $wo_meth => $col ]);
+        }
     }
-  }
 }
 
 
@@ -44,16 +53,16 @@
 
 
 sub new {
-  my ($class, $attrs, @rest) = @_;
-  $class->throw_exception( "create needs a hashref" ) unless ref $attrs eq 'HASH';
-  foreach my $col ($class->columns) {
-      my $acc = $class->accessor_name_for($col);
-      $attrs->{$col} = delete $attrs->{$acc} if exists $attrs->{$acc};
+    my ($class, $attrs, @rest) = @_;
+    $class->throw_exception( "create needs a hashref" ) unless ref $attrs eq 'HASH';
+    foreach my $col ($class->columns) {
+        my $acc = $class->accessor_name_for($col);
+        $attrs->{$col} = delete $attrs->{$acc} if exists $attrs->{$acc};
 
-      my $mut = $class->mutator_name_for($col);
-      $attrs->{$col} = delete $attrs->{$mut} if exists $attrs->{$mut};
-  }
-  return $class->next::method($attrs, @rest);
+        my $mut = $class->mutator_name_for($col);
+        $attrs->{$col} = delete $attrs->{$mut} if exists $attrs->{$mut};
+    }
+    return $class->next::method($attrs, @rest);
 }
 
 1;

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/InflateColumn/DateTime.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/InflateColumn/DateTime.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -19,6 +19,9 @@
     starts_when => { data_type => 'datetime' }
   );
 
+NOTE: You B<must> load C<InflateColumn::DateTime> B<before> C<Core>. See
+L<DBIx::Class::Manual::Component> for details.
+
 Then you can treat the specified column as a L<DateTime> object.
 
   print "This event starts the month of ".

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Manual/Cookbook.pod	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Manual/Cookbook.pod	2008-11-22 18:56:26 UTC (rev 5178)
@@ -141,7 +141,7 @@
   SQL 
 
   # Finally, register your new ResultSource with your Schema
-  My::Schema->register_source( 'UserFriendsComplex' => $new_source );
+  My::Schema->register_extra_source( 'UserFriendsComplex' => $new_source );
 
 Next, you can execute your complex query using bind parameters like this:
 

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Relationship/BelongsTo.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Relationship/BelongsTo.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Relationship/BelongsTo.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -9,6 +9,11 @@
 
 sub belongs_to {
   my ($class, $rel, $f_class, $cond, $attrs) = @_;
+
+  # assume a foreign key contraint unless defined otherwise
+  $attrs->{is_foreign_key_constraint} = 1 
+    if not exists $attrs->{is_foreign_key_constraint};
+
   # no join condition or just a column name
   if (!ref $cond) {
     $class->ensure_class_loaded($f_class);

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSet.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSet.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -15,7 +15,7 @@
 use Scalar::Util ();
 use base qw/DBIx::Class/;
 
-__PACKAGE__->mk_group_accessors('simple' => qw/result_class _source_handle/);
+__PACKAGE__->mk_group_accessors('simple' => qw/_result_class _source_handle/);
 
 =head1 NAME
 
@@ -108,7 +108,6 @@
   # see https://bugzilla.redhat.com/show_bug.cgi?id=196836
   my $self = {
     _source_handle => $source,
-    result_class => $attrs->{result_class} || $source->resolve->result_class,
     cond => $attrs->{where},
     count => undef,
     pager => undef,
@@ -117,6 +116,10 @@
 
   bless $self, $class;
 
+  $self->result_class(
+    $attrs->{result_class} || $source->resolve->result_class
+  );
+
   return $self;
 }
 
@@ -341,6 +344,9 @@
 If your table does not have a primary key, you B<must> provide a value for the
 C<key> attribute matching one of the unique constraints on the source.
 
+In addition to C<key>, L</find> recognizes and applies standard
+L<resultset attributes|/ATTRIBUTES> in the same way as L</search> does.
+
 Note: If your query does not return only one row, a warning is generated:
 
   Query returned more than one row
@@ -985,6 +991,14 @@
 
 =cut
 
+sub result_class {
+  my ($self, $result_class) = @_;
+  if ($result_class) {
+    $self->ensure_class_loaded($result_class);
+    $self->_result_class($result_class);
+  }
+  $self->_result_class;
+}
 
 =head2 count
 
@@ -2784,6 +2798,58 @@
     # SELECT child.* FROM person child
     # INNER JOIN person father ON child.father_id = father.id
 
+If you need to express really complex joins or you need a subselect, you
+can supply literal SQL to C<from> via a scalar reference. In this case
+the contents of the scalar will replace the table name asscoiated with the
+resultsource.
+
+WARNING: This technique might very well not work as expected on chained
+searches - you have been warned.
+
+    # Assuming the Event resultsource is defined as:
+
+        MySchema::Event->add_columns (
+            sequence => {
+                data_type => 'INT',
+                is_auto_increment => 1,
+            },
+            location => {
+                data_type => 'INT',
+            },
+            type => {
+                data_type => 'INT',
+            },
+        );
+        MySchema::Event->set_primary_key ('sequence');
+
+    # This will get back the latest event for every location. The column
+    # selector is still provided by DBIC, all we do is add a JOIN/WHERE
+    # combo to limit the resultset
+
+    $rs = $schema->resultset('Event');
+    $table = $rs->result_source->name;
+    $latest = $rs->search (
+        undef,
+        { from => \ " 
+            (SELECT e1.* FROM $table e1 
+                JOIN $table e2 
+                    ON e1.location = e2.location 
+                    AND e1.sequence < e2.sequence 
+                WHERE e2.sequence is NULL 
+            ) me",
+        },
+    );
+
+    # Equivalent SQL (with the DBIC chunks added):
+
+    SELECT me.sequence, me.location, me.type FROM
+       (SELECT e1.* FROM events e1
+           JOIN events e2
+               ON e1.location = e2.location
+               AND e1.sequence < e2.sequence
+           WHERE e2.sequence is NULL
+       ) me;
+
 =head2 for
 
 =over 4

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSetColumn.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSetColumn.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSetColumn.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use base 'DBIx::Class';
+use List::Util;
 
 =head1 NAME
 
@@ -36,8 +37,19 @@
   my ($class, $rs, $column) = @_;
   $class = ref $class if ref $class;
   my $new_parent_rs = $rs->search_rs; # we don't want to mess up the original, so clone it
-  $new_parent_rs->{attrs}->{prefetch} = undef; # prefetch causes additional columns to be fetched
-  my $new = bless { _column => $column, _parent_resultset => $new_parent_rs }, $class;
+  my $attrs = $new_parent_rs->_resolved_attrs;
+  $new_parent_rs->{attrs}->{$_} = undef for qw(prefetch include_columns +select +as); # prefetch, include_columns, +select, +as cause additional columns to be fetched
+
+  # If $column can be found in the 'as' list of the parent resultset, use the
+  # corresponding element of its 'select' list (to keep any custom column
+  # definition set up with 'select' or '+select' attrs), otherwise use $column
+  # (to create a new column definition on-the-fly).
+  my $as_list = $attrs->{as} || [];
+  my $select_list = $attrs->{select} || [];
+  my $as_index = List::Util::first { ($as_list->[$_] || "") eq $column } 0..$#$as_list;
+  my $select = defined $as_index ? $select_list->[$as_index] : $column;
+
+  my $new = bless { _select => $select, _as => $column, _parent_resultset => $new_parent_rs }, $class;
   $new->throw_exception("column must be supplied") unless $column;
   return $new;
 }
@@ -62,8 +74,7 @@
 
 sub next {
   my $self = shift;
-  $self->{_resultset} = $self->{_parent_resultset}->search(undef, {select => [$self->{_column}], as => [$self->{_column}]}) unless ($self->{_resultset});
-  my ($row) = $self->{_resultset}->cursor->next;
+  my ($row) = $self->_resultset->cursor->next;
   return $row;
 }
 
@@ -87,9 +98,55 @@
 
 sub all {
   my $self = shift;
-  return map {$_->[0]} $self->{_parent_resultset}->search(undef, {select => [$self->{_column}], as => [$self->{_column}]})->cursor->all;
+  return map { $_->[0] } $self->_resultset->cursor->all;
 }
 
+=head2 reset
+
+=over 4
+
+=item Arguments: none
+
+=item Return Value: $self
+
+=back
+
+Resets the underlying resultset's cursor, so you can iterate through the
+elements of the column again.
+
+Much like L<DBIx::Class::ResultSet/reset>.
+
+=cut
+
+sub reset {
+  my $self = shift;
+  $self->_resultset->cursor->reset;
+  return $self;
+}
+
+=head2 first
+
+=over 4
+
+=item Arguments: none
+
+=item Return Value: $value
+
+=back
+
+Resets the underlying resultset and returns the next value of the column in the
+resultset (or C<undef> if there is none).
+
+Much like L<DBIx::Class::ResultSet/first> but just returning the one value.
+
+=cut
+
+sub first {
+  my $self = shift;
+  my ($row) = $self->_resultset->cursor->reset->next;
+  return $row;
+}
+
 =head2 min
 
 =over 4
@@ -175,7 +232,7 @@
 
 sub func {
   my ($self,$function) = @_;
-  my $cursor = $self->{_parent_resultset}->search(undef, {select => {$function => $self->{_column}}, as => [$self->{_column}]})->cursor;
+  my $cursor = $self->{_parent_resultset}->search(undef, {select => {$function => $self->{_select}}, as => [$self->{_as}]})->cursor;
   
   if( wantarray ) {
     return map { $_->[ 0 ] } $cursor->all;
@@ -184,6 +241,44 @@
   return ( $cursor->next )[ 0 ];
 }
 
+=head2 throw_exception
+
+See L<DBIx::Class::Schema/throw_exception> for details.
+  
+=cut 
+    
+sub throw_exception {
+  my $self=shift;
+  if (ref $self && $self->{_parent_resultset}) {
+    $self->{_parent_resultset}->throw_exception(@_)
+  } else {
+    croak(@_);
+  }
+}
+
+# _resultset
+#
+# Arguments: none
+#
+# Return Value: $resultset
+#
+#  $year_col->_resultset->next
+#
+# Returns the underlying resultset. Creates it from the parent resultset if
+# necessary.
+# 
+sub _resultset {
+  my $self = shift;
+
+  return $self->{_resultset} ||= $self->{_parent_resultset}->search(undef,
+    {
+      select => [$self->{_select}],
+      as => [$self->{_as}]
+    }
+  );
+}
+
+
 1;
 
 =head1 AUTHORS

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSource.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSource.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -855,7 +855,7 @@
         #warn "$self $k $for $v";
         unless ($for->has_column_loaded($v)) {
           if ($for->in_storage) {
-            $self->throw_exception("Column ${v} not loaded on ${for} trying to reolve relationship");
+            $self->throw_exception("Column ${v} not loaded on ${for} trying to resolve relationship");
           }
           return $UNRESOLVABLE_CONDITION;
         }

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSourceProxy/Table.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSourceProxy/Table.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/ResultSourceProxy/Table.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -40,7 +40,7 @@
 
     $class->result_source_instance($table);
 
-    if ($class->can('schema_instance')) {
+    if ($class->can('schema_instance') && $class->schema_instance) {
         $class =~ m/([^:]+)$/;
         $class->schema_instance->register_class($class, $class);
     }

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Row.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Row.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -302,7 +302,7 @@
         my $reverse = $source->reverse_relationship_info($relname);
         foreach my $obj (@cands) {
           $obj->set_from_related($_, $self) for keys %$reverse;
-          my $them = { $obj->get_inflated_columns };
+          my $them = { %{$obj->{_relationship_data} || {} }, $obj->get_inflated_columns };
           if ($self->__their_pk_needs_us($relname, $them)) {
             $obj = $self->find_or_create_related($relname, $them);
           } else {
@@ -761,24 +761,17 @@
       {
         my $rel = delete $upd->{$key};
         $self->set_from_related($key => $rel);
-        $self->{_relationship_data}{$key} = $rel;          
+        $self->{_relationship_data}{$key} = $rel;
       } elsif ($info && $info->{attrs}{accessor}
-        && $info->{attrs}{accessor} eq 'multi'
-        && ref $upd->{$key} eq 'ARRAY') {
-        my $others = delete $upd->{$key};
-        foreach my $rel_obj (@$others) {
-          if(!Scalar::Util::blessed($rel_obj)) {
-            $rel_obj = $self->create_related($key, $rel_obj);
-          }
-        }
-        $self->{_relationship_data}{$key} = $others; 
-#            $related->{$key} = $others;
-        next;
+        && $info->{attrs}{accessor} eq 'multi') {
+          $self->throw_exception(
+            "Recursive update is not supported over relationships of type multi ($key)"
+          );
       }
       elsif ($self->has_column($key)
         && exists $self->column_info($key)->{_inflate_info})
       {
-        $self->set_inflated_column($key, delete $upd->{$key});          
+        $self->set_inflated_column($key, delete $upd->{$key});
       }
     }
   }

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Schema.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Schema.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1054,7 +1054,7 @@
 
 =item databases  - ['MySQL', 'SQLite', 'PostgreSQL']
 
-=item version    - $schema->VERSION
+=item version    - $schema->schema_version
 
 =item directory  - './'
 

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -54,7 +54,7 @@
 
 =head1 NAME
 
-DBIx::Class::Storage::ODBC::ACCESS - Support specific to MS Access over ODBC
+DBIx::Class::Storage::DBI::ODBC::ACCESS - Support specific to MS Access over ODBC
 
 =head1 WARNING
 

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -6,7 +6,7 @@
 
 =head1 NAME
 
-DBIx::Class::Storage::DBI::Oracle - Automatic primary key class for Oracle
+DBIx::Class::Storage::DBI::Oracle::Generic - Automatic primary key class for Oracle
 
 =head1 SYNOPSIS
 

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -60,7 +60,7 @@
 
 around '_query_start' => sub {
   my ($method, $self, $sql, @bind) = @_;
-  my $dsn = $self->connect_info->[0];
+  my $dsn = $self->_dbi_connect_info->[0];
   $self->$method("DSN: $dsn SQL: $sql", @bind);
 };
 

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Role/QueryCounter.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Role/QueryCounter.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/Role/QueryCounter.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -5,7 +5,7 @@
 
 =head1 NAME
 
-DBIx::Class::Storage::DBI::Role::QueryCounter; Role to add a query counter
+DBIx::Class::Storage::DBI::Role::QueryCounter - Role to add a query counter
 
 =head1 SYNOPSIS
 
@@ -78,4 +78,4 @@
 =cut
 
 
-1;
\ No newline at end of file
+1;

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/SQLite.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI/SQLite.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -19,7 +19,7 @@
   $dir ||= './';
 
   ## Where is the db file?
-  my $dsn = $self->connect_info()->[0];
+  my $dsn = $self->_dbi_connect_info()->[0];
 
   my $dbname = $1 if($dsn =~ /dbname=([^;]+)/);
   if(!$dbname)

Modified: DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/DBIx/Class/Storage/DBI.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -86,7 +86,12 @@
 
 sub select {
   my ($self, $table, $fields, $where, $order, @rest) = @_;
-  $table = $self->_quote($table) unless ref($table);
+  if (ref $table eq 'SCALAR') {
+    $table = $$table;
+  }
+  elsif (not ref $table) {
+    $table = $self->_quote($table);
+  }
   local $self->{rownum_hack_count} = 1
     if (defined $rest[0] && $self->{limit_dialect} eq 'RowNum');
   @rest = (-1) unless defined $rest[0];
@@ -1406,7 +1411,8 @@
   my $self = shift;
   my ($rv, $sth, @bind) = $self->_select(@_);
   my @row = $sth->fetchrow_array;
-  if(@row && $sth->fetchrow_array) {
+  my @nextrow = $sth->fetchrow_array if @row;
+  if(@row && @nextrow) {
     carp "Query returned more than one row.  SQL that returns multiple rows is DEPRECATED for ->find and ->single";
   }
   # Need to call finish() to work round broken DBDs
@@ -1578,7 +1584,10 @@
   }
   $databases ||= ['MySQL', 'SQLite', 'PostgreSQL'];
   $databases = [ $databases ] if(ref($databases) ne 'ARRAY');
-  $version ||= $schema->VERSION || '1.x';
+
+  my $schema_version = $schema->schema_version || '1.x';
+  $version ||= $schema_version;
+
   $sqltargs = {
     add_drop_table => 1, 
     ignore_constraint_names => 1,
@@ -1603,7 +1612,7 @@
 
     my $file;
     my $filename = $schema->ddl_filename($db, $version, $dir);
-    if (-e $filename && (!$version || ($version == $schema->schema_version()))) {
+    if (-e $filename && ($version eq $schema_version )) {
       # if we are dumping the current version, overwrite the DDL
       warn "Overwriting existing DDL file - $filename";
       unlink($filename);
@@ -1720,7 +1729,7 @@
   # Need to be connected to get the correct sqlt_type
   $self->ensure_connected() unless $type;
   $type ||= $self->sqlt_type;
-  $version ||= $schema->VERSION || '1.x';
+  $version ||= $schema->schema_version || '1.x';
   $dir ||= './';
   my $filename = $schema->ddl_filename($type, $dir, $version);
   if(-f $filename)

Modified: DBIx-Class/0.08/branches/views_support/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/lib/SQL/Translator/Parser/DBIx/Class.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/lib/SQL/Translator/Parser/DBIx/Class.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1,5 +1,4 @@
-package # hide from PAUSE
-    SQL::Translator::Parser::DBIx::Class;
+package SQL::Translator::Parser::DBIx::Class;
 
 # AUTHOR: Jess Robinson
 
@@ -45,7 +44,7 @@
     my $schema      = $tr->schema;
     my $table_no    = 0;
 
-    $schema->name( ref($dbicschema) . " v" . ($dbicschema->VERSION || '1.x'))
+    $schema->name( ref($dbicschema) . " v" . ($dbicschema->schema_version || '1.x'))
       unless ($schema->name);
 
     my %seen_tables;
@@ -258,3 +257,38 @@
 }
 
 1;
+
+=head1 NAME
+
+SQL::Translator::Parser::DBIx::Class - Create a SQL::Translator schema
+from a DBIx::Class::Schema instance
+
+=head1 SYNOPSIS
+
+ use MyApp::Schema;
+ use SQL::Translator;
+ 
+ my $schema = MyApp::Schema->connect;
+ my $trans  = SQL::Translator->new (
+      parser      => 'SQL::Translator::Parser::DBIx::Class',
+      parser_args => { package => $schema },
+      producer    => 'SQLite',
+     ) or die SQL::Translator->error;
+ my $out = $trans->translate() or die $trans->error;
+
+=head1 DESCRIPTION
+
+C<SQL::Translator::Parser::DBIx::Class> reads a DBIx::Class schema,
+interrogates the columns, and stuffs it all in an $sqlt_schema object.
+
+=head1 SEE ALSO
+
+SQL::Translator.
+
+=head1 AUTHORS
+
+Jess Robinson
+
+Matt S Trout
+
+Ash Berlin

Modified: DBIx-Class/0.08/branches/views_support/maint/gen-schema.pl
===================================================================
--- DBIx-Class/0.08/branches/views_support/maint/gen-schema.pl	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/maint/gen-schema.pl	2008-11-22 18:56:26 UTC (rev 5178)
@@ -7,13 +7,5 @@
 use DBICTest::Schema;
 use SQL::Translator;
 
-my $sql_join_str = '';
-if (SQL::Translator->VERSION >= 0.09001) {
-    $sql_join_str .= ";";
-}
-if (SQL::Translator->VERSION >= 0.09) {
-    $sql_join_str .= "\n";
-}
-
 my $schema = DBICTest::Schema->connect;
-print join ($sql_join_str,$schema->storage->deployment_statements($schema, 'SQLite') );
+print scalar ($schema->storage->deployment_statements($schema, 'SQLite'));

Modified: DBIx-Class/0.08/branches/views_support/t/19quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/19quotes_newstyle.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/19quotes_newstyle.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -21,7 +21,7 @@
 
 diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
 
-my $dsn = $schema->storage->connect_info->[0];
+my $dsn = $schema->storage->_dbi_connect_info->[0];
 $schema->connection(
   $dsn,
   undef,

Modified: DBIx-Class/0.08/branches/views_support/t/32connect_code_ref.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/32connect_code_ref.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/32connect_code_ref.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -11,7 +11,7 @@
 my $normal_schema = DBICTest->init_schema( sqlite_use_file => 1 );
 
 # Steal the dsn, which should be like 'dbi:SQLite:t/var/DBIxClass.db'
-my $normal_dsn = $normal_schema->storage->connect_info->[0];
+my $normal_dsn = $normal_schema->storage->_dbi_connect_info->[0];
 
 # Make sure we have no active connection
 $normal_schema->storage->disconnect;

Modified: DBIx-Class/0.08/branches/views_support/t/50fork.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/50fork.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/50fork.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -34,7 +34,7 @@
     {
         local $SIG{__WARN__} = sub {};
         eval { $dbh->do("DROP TABLE cd") };
-        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER);");
+        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER, single_track INTEGER);");
     }
 
     $schema->resultset('CD')->create({ title => 'vacation in antarctica', artist => 123, year => 1901 });

Modified: DBIx-Class/0.08/branches/views_support/t/51threads.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/51threads.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/51threads.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -44,7 +44,7 @@
     {
         local $SIG{__WARN__} = sub {};
         eval { $dbh->do("DROP TABLE cd") };
-        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER);");
+        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER, single_track INTEGER);");
     }
 
     $schema->resultset('CD')->create({ title => 'vacation in antarctica', artist => 123, year => 1901 });

Modified: DBIx-Class/0.08/branches/views_support/t/51threadtxn.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/51threadtxn.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/51threadtxn.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -44,7 +44,7 @@
     {
         local $SIG{__WARN__} = sub {};
         eval { $dbh->do("DROP TABLE cd") };
-        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER);");
+        $dbh->do("CREATE TABLE cd (cdid serial PRIMARY KEY, artist INTEGER NOT NULL UNIQUE, title VARCHAR(100) NOT NULL UNIQUE, year VARCHAR(100) NOT NULL, genreid INTEGER, single_track INTEGER);");
     }
 
     $schema->resultset('CD')->create({ title => 'vacation in antarctica', artist => 123, year => 1901 });

Modified: DBIx-Class/0.08/branches/views_support/t/60core.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/60core.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/60core.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -153,7 +153,7 @@
 my $cd = $schema->resultset("CD")->find(1);
 my %cols = $cd->get_columns;
 
-cmp_ok(keys %cols, '==', 5, 'get_columns number of columns ok');
+cmp_ok(keys %cols, '==', 6, 'get_columns number of columns ok');
 
 is($cols{title}, 'Spoonful of bees', 'get_columns values ok');
 
@@ -169,7 +169,7 @@
 # check whether ResultSource->columns returns columns in order originally supplied
 my @cd = $schema->source("CD")->columns;
 
-is_deeply( \@cd, [qw/cdid artist title year genreid/], 'column order');
+is_deeply( \@cd, [qw/cdid artist title year genreid single_track/], 'column order');
 
 $cd = $schema->resultset("CD")->search({ title => 'Spoonful of bees' }, { columns => ['title'] })->next;
 is($cd->title, 'Spoonful of bees', 'subset of columns returned correctly');
@@ -335,9 +335,9 @@
 
 # test remove_columns
 {
-  is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year genreid/]);
+  is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year genreid single_track/]);
   $schema->source('CD')->remove_columns('year');
-  is_deeply([$schema->source('CD')->columns], [qw/cdid artist title genreid/]);
+  is_deeply([$schema->source('CD')->columns], [qw/cdid artist title genreid single_track/]);
   ok(! exists $schema->source('CD')->_columns->{'year'}, 'year still exists in _columns');
 }
 

Modified: DBIx-Class/0.08/branches/views_support/t/66relationship.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/66relationship.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/66relationship.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1,13 +1,14 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 67;
+plan tests => 72;
 
 # has_a test
 my $cd = $schema->resultset("CD")->find(4);
@@ -117,19 +118,16 @@
 is( $cd->title, 'Greatest Hits 2: Louder Than Ever', 'find_or_new_related new record ok' );
 ok( ! $cd->in_storage, 'find_or_new_related on a new record: not in_storage' );
 
-# print STDERR Data::Dumper::Dumper($cd->get_columns);
-# $cd->result_source->schema->storage->debug(1);
 $cd->artist(undef);
 my $newartist = $cd->find_or_new_related( 'artist', {
   name => 'Random Boy Band Two',
   artistid => 200,
 } );
-# $cd->result_source->schema->storage->debug(0);
 is($newartist->name, 'Random Boy Band Two', 'find_or_new_related new artist record with id');
 is($newartist->id, 200, 'find_or_new_related new artist id set');
 
-SKIP: {
-  skip "relationship checking needs fixing", 1;
+TODO: {
+  local $TODO = "relationship checking needs fixing";
   # try to add a bogus relationship using the wrong cols
   eval {
       DBICTest::Schema::Artist->add_relationship(
@@ -263,3 +261,30 @@
 is ($@, '', 'Staged insertion successful');
 ok($new_artist->in_storage, 'artist inserted');
 ok($new_related_cd->in_storage, 'new_related_cd inserted');
+
+TODO: {
+local $TODO = "TODOify for multicreate branch";
+my $new_cd = $schema->resultset("CD")->new_result({});
+my $new_related_artist = $new_cd->new_related('artist', { 'name' => 'Marillion',});
+lives_ok (
+    sub {
+       $new_related_artist->insert;
+       $new_cd->title( 'Misplaced Childhood' );
+       $new_cd->year ( 1985 );
+#       $new_cd->artist( $new_related_artist );  # For exact backward compatibility     # not sure what this means
+       $new_cd->insert;
+    },
+    'Reversed staged insertion successful'
+);
+ok($new_related_artist->in_storage, 'related artist inserted');
+ok($new_cd->in_storage, 'cd inserted');
+
+# check if is_foreign_key_constraint attr is set
+my $rs_normal = $schema->source('Track');
+my $relinfo = $rs_normal->relationship_info ('cd');
+cmp_ok($relinfo->{attrs}{is_foreign_key_constraint}, '==', 1, "is_foreign_key_constraint defined for belongs_to relationships.");
+
+my $rs_overridden = $schema->source('ForceForeign');
+my $relinfo_with_attr = $rs_overridden->relationship_info ('cd_3');
+cmp_ok($relinfo_with_attr->{attrs}{is_foreign_key_constraint}, '==', 0, "is_foreign_key_constraint defined for belongs_to relationships with attr.");
+}

Modified: DBIx-Class/0.08/branches/views_support/t/68inflate_resultclass_hashrefinflator.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/68inflate_resultclass_hashrefinflator.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/68inflate_resultclass_hashrefinflator.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -4,7 +4,6 @@
 use Test::More qw(no_plan);
 use lib qw(t/lib);
 use DBICTest;
-use DBIx::Class::ResultClass::HashRefInflator;
 my $schema = DBICTest->init_schema();
 
 
@@ -62,6 +61,7 @@
 $schema->resultset('CD')->create({ title => 'Silence is golden', artist => 3, year => 2006 });
 
 # order_by to ensure both resultsets have the rows in the same order
+# also check result_class-as-an-attribute syntax
 my $rs_dbic = $schema->resultset('CD')->search(undef,
     {
         prefetch    => [ qw/ artist tracks / ],
@@ -72,9 +72,9 @@
     {
         prefetch    => [ qw/ artist tracks / ],
         order_by    => [ 'me.cdid', 'tracks.position' ],
+        result_class => 'DBIx::Class::ResultClass::HashRefInflator',
     }
 );
-$rs_hashrefinf->result_class('DBIx::Class::ResultClass::HashRefInflator');
 
 my @dbic        = $rs_dbic->all;
 my @hashrefinf  = $rs_hashrefinf->all;
@@ -98,8 +98,8 @@
     select   => [qw/name   tracks.title      tracks.cd       /],
     as       => [qw/name   cds.tracks.title  cds.tracks.cd   /],
     order_by => [qw/cds.cdid tracks.trackid/],
+    result_class => 'DBIx::Class::ResultClass::HashRefInflator',
 });
-$rs_hashrefinf->result_class('DBIx::Class::ResultClass::HashRefInflator');
 
 @dbic = map { $_->tracks->all } ($rs_dbic->first->cds->all);
 @hashrefinf  = $rs_hashrefinf->all;

Modified: DBIx-Class/0.08/branches/views_support/t/71mysql.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/71mysql.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/71mysql.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -21,7 +21,7 @@
 
 $dbh->do("DROP TABLE IF EXISTS artist;");
 
-$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));");
+$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));");
 
 #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
 
@@ -57,7 +57,7 @@
     'name' => {
         'data_type' => 'VARCHAR',
         'is_nullable' => 1,
-        'size' => 255,
+        'size' => 100,
         'default_value' => undef,
     },
     'rank' => {

Modified: DBIx-Class/0.08/branches/views_support/t/73oracle.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/73oracle.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/73oracle.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -32,7 +32,7 @@
 $dbh->do("CREATE SEQUENCE pkid1_seq START WITH 1 MAXVALUE 999999 MINVALUE 0");
 $dbh->do("CREATE SEQUENCE pkid2_seq START WITH 10 MAXVALUE 999999 MINVALUE 0");
 $dbh->do("CREATE SEQUENCE nonpkid_seq START WITH 20 MAXVALUE 999999 MINVALUE 0");
-$dbh->do("CREATE TABLE artist (artistid NUMBER(12), name VARCHAR(255), rank NUMBER(38))");
+$dbh->do("CREATE TABLE artist (artistid NUMBER(12), name VARCHAR(255), rank NUMBER(38), charfield VARCHAR2(10))");
 $dbh->do("CREATE TABLE sequence_test (pkid1 NUMBER(12), pkid2 NUMBER(12), nonpkid NUMBER(12), name VARCHAR(255))");
 $dbh->do("CREATE TABLE cd (cdid NUMBER(12), artist NUMBER(12), title VARCHAR(255), year VARCHAR(4))");
 $dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE)");

Modified: DBIx-Class/0.08/branches/views_support/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/746mssql.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/746mssql.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -24,7 +24,7 @@
     $dbh->do(<<'');
 CREATE TABLE artist (
    artistid INT IDENTITY NOT NULL,
-   name VARCHAR(255),
+   name VARCHAR(100),
    rank INT NOT NULL DEFAULT '13',
    charfield CHAR(10) NULL,
    primary key(artistid)

Modified: DBIx-Class/0.08/branches/views_support/t/74mssql.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/74mssql.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/74mssql.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -29,8 +29,8 @@
 $dbh->do("IF OBJECT_ID('cd', 'U') IS NOT NULL
     DROP TABLE cd");
 
-$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(255), rank INT DEFAULT '13');");
-$dbh->do("CREATE TABLE cd (cdid INT IDENTITY PRIMARY KEY, artist INT,  title VARCHAR(100), year VARCHAR(100), genreid INT NULL);");
+$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(100), rank INT DEFAULT '13', charfield CHAR(10) NULL);");
+$dbh->do("CREATE TABLE cd (cdid INT IDENTITY PRIMARY KEY, artist INT,  title VARCHAR(100), year VARCHAR(100), genreid INT NULL, single_track INT NULL);");
 # Just to test compat shim, Auto is in Core
 $schema->class('Artist')->load_components('PK::Auto::MSSQL');
 

Modified: DBIx-Class/0.08/branches/views_support/t/76select.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/76select.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/76select.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -8,7 +8,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 7;
+plan tests => 11;
 
 my $rs = $schema->resultset('CD')->search({},
     {
@@ -42,3 +42,22 @@
 lives_ok(sub { $rs->first->get_column('count') }, '+select/+as chained search 1st rscolumn present');
 lives_ok(sub { $rs->first->get_column('addedtitle') }, '+select/+as chained search 1st rscolumn present');
 lives_ok(sub { $rs->first->get_column('addedtitle2') }, '+select/+as chained search 3rd rscolumn present');
+
+
+# test the from search attribute (gets between the FROM and WHERE keywords, allows arbitrary subselects)
+# also shows that outer select attributes are ok (i.e. order_by)
+#
+# from doesn't seem to be useful without using a scalarref - there were no initial tests >:(
+#
+my $cds = $schema->resultset ('CD')->search ({}, { order_by => 'me.cdid'}); # make sure order is consistent
+cmp_ok ($cds->count, '>', 2, 'Initially populated with more than 2 CDs');
+
+my $table = $cds->result_source->name;
+my $subsel = $cds->search ({}, {
+    columns => [qw/cdid title/],
+    from => \ "(SELECT cdid, title FROM $table LIMIT 2) me",
+});
+
+is ($subsel->count, 2, 'Subselect correctly limited the rs to 2 cds');
+is ($subsel->next->title, $cds->next->title, 'First CD title match');
+is ($subsel->next->title, $cds->next->title, 'Second CD title match');

Modified: DBIx-Class/0.08/branches/views_support/t/77prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/77prefetch.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/77prefetch.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -348,7 +348,6 @@
 # (the TODO block itself contains tests ensuring that the warns are removed)
 TODO: {
     local $TODO = 'Prefetch of multiple has_many rels at the same level (currently warn to protect the clueless git)';
-    use DBIx::Class::ResultClass::HashRefInflator;
 
     #( 1 -> M + M )
     my $cd_rs = $schema->resultset('CD')->search ({ 'me.title' => 'Forkful of bees' });

Modified: DBIx-Class/0.08/branches/views_support/t/86sqlt.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/86sqlt.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/86sqlt.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -126,7 +126,7 @@
       'name' => 'cd_fk_artist', 'index_name' => 'cd_idx_artist',
       'selftable' => 'cd', 'foreigntable' => 'artist', 
       'selfcols'  => ['artist'], 'foreigncols' => ['artistid'],
-      on_delete => '', on_update => 'SET NULL', deferrable => 1,
+      on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1,
     },
   ],
 

Modified: DBIx-Class/0.08/branches/views_support/t/88result_set_column.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/88result_set_column.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/88result_set_column.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -2,15 +2,16 @@
 use warnings;  
 
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 14;
+plan tests => 18;
 
 my $cd;
-my $rs = $cd = $schema->resultset("CD")->search({});
+my $rs = $cd = $schema->resultset("CD")->search({}, { order_by => 'cdid' });
 
 my $rs_title = $rs->get_column('title');
 my $rs_year = $rs->get_column('year');
@@ -28,23 +29,40 @@
 
 cmp_ok($rs_year->sum, '==', 9996, "three artists returned");
 
+$rs_year->reset;
+is($rs_year->next, 1999, "reset okay");
+
+is($rs_year->first, 1999, "first okay");
+
+# test +select/+as for single column
 my $psrs = $schema->resultset('CD')->search({},
     {
         '+select'   => \'COUNT(*)',
         '+as'       => 'count'
     }
 );
-ok(defined($psrs->get_column('count')), '+select/+as count');
+lives_ok(sub { $psrs->get_column('count')->next }, '+select/+as additional column "count" present (scalar)');
+dies_ok(sub { $psrs->get_column('noSuchColumn')->next }, '+select/+as nonexistent column throws exception');
 
+# test +select/+as for multiple columns
 $psrs = $schema->resultset('CD')->search({},
     {
         '+select'   => [ \'COUNT(*)', 'title' ],
         '+as'       => [ 'count', 'addedtitle' ]
     }
 );
-ok(defined($psrs->get_column('count')), '+select/+as arrayref count');
-ok(defined($psrs->get_column('addedtitle')), '+select/+as title');
+lives_ok(sub { $psrs->get_column('count')->next }, '+select/+as multiple additional columns, "count" column present');
+lives_ok(sub { $psrs->get_column('addedtitle')->next }, '+select/+as multiple additional columns, "addedtitle" column present');
 
+# test +select/+as for overriding a column
+$psrs = $schema->resultset('CD')->search({},
+    {
+        'select'   => \"'The Final Countdown'",
+        'as'       => 'title'
+    }
+);
+is($psrs->get_column('title')->next, 'The Final Countdown', '+select/+as overridden column "title"');
+
 {
   my $rs = $schema->resultset("CD")->search({}, { prefetch => 'artist' });
   my $rsc = $rs->get_column('year');

Modified: DBIx-Class/0.08/branches/views_support/t/91debug.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/91debug.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/91debug.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -55,7 +55,7 @@
     my @cds = $schema->resultset('CD')->search( { artist => 1, cdid => { -between => [ 1, 3 ] }, } );
     like(
         $sql,
-        qr/\QSELECT me.cdid, me.artist, me.title, me.year, me.genreid FROM cd me WHERE ( artist = ? AND cdid BETWEEN ? AND ? ): '1', '1', '3'\E/,
+        qr/\QSELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE ( artist = ? AND cdid BETWEEN ? AND ? ): '1', '1', '3'\E/,
         'got correct SQL with all bind parameters'
     );
 }

Modified: DBIx-Class/0.08/branches/views_support/t/93nobindvars.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/93nobindvars.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/93nobindvars.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -40,7 +40,7 @@
 
 $dbh->do("DROP TABLE IF EXISTS artist;");
 
-$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));");
+$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));");
 
 $schema->class('Artist')->load_components('PK::Auto');
 

Modified: DBIx-Class/0.08/branches/views_support/t/96multi_create.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/96multi_create.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/96multi_create.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -2,16 +2,17 @@
 use warnings;
 
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 51;
+plan tests => 89;
 
 my $schema = DBICTest->init_schema();
 
-# simple create + belongs_to
+# simple create + parent (the stuff $rs belongs_to)
 eval {
-  my $cd2 = $schema->resultset('CD')->create({
+  my $cd = $schema->resultset('CD')->create({
     artist => { 
       name => 'Fred Bloggs' 
     },
@@ -19,49 +20,248 @@
     year => 1996
   });
 
-  isa_ok($cd2, 'DBICTest::CD', 'Created CD object');
-  isa_ok($cd2->artist, 'DBICTest::Artist', 'Created related Artist');
-  is($cd2->artist->name, 'Fred Bloggs', 'Artist created correctly');
+  isa_ok($cd, 'DBICTest::CD', 'Created CD object');
+  isa_ok($cd->artist, 'DBICTest::Artist', 'Created related Artist');
+  is($cd->artist->name, 'Fred Bloggs', 'Artist created correctly');
 };
 diag $@ if $@;
 
+# same as above but the child and parent have no values,
+# except for an explicit parent pk
+eval {
+  my $bm_rs = $schema->resultset('Bookmark');
+  my $bookmark = $bm_rs->create({
+    link => {
+      id => 66,
+    },
+  });
+
+  isa_ok($bookmark, 'DBICTest::Bookmark', 'Created Bookrmark object');
+  isa_ok($bookmark->link, 'DBICTest::Link', 'Created related Link');
+  is (
+    $bm_rs->search (
+      { 'link.title' => $bookmark->link->title },
+      { join => 'link' },
+    )->count,
+    1,
+    'Bookmark and link made it to the DB',
+  );
+};
+diag $@ if $@;
+
 # create over > 1 levels of has_many create (A => { has_many => { B => has_many => C } } )
 eval {
-  my $artist = $schema->resultset('Artist')->create(
-    { name => 'Fred 2',
+  my $artist = $schema->resultset('Artist')->first;
+  my $cd = $artist->create_related (cds => {
+    title => 'Music to code by',
+    year => 2007,
+    tags => [
+      { 'tag' => 'rock' },
+    ],
+  });
+
+  isa_ok($cd, 'DBICTest::CD', 'Created CD');
+  is($cd->title, 'Music to code by', 'CD created correctly');
+  is($cd->tags->count, 1, 'One tag created for CD');
+  is($cd->tags->first->tag, 'rock', 'Tag created correctly');
+
+};
+diag $@ if $@;
+
+throws_ok (
+  sub {
+    # Create via update - add a new CD <--- THIS SHOULD HAVE NEVER WORKED!
+    $schema->resultset('Artist')->first->update({
       cds => [
-        { title => 'Music to code by',
-          year => 2007,
-          tags => [
-            { 'tag' => 'rock' },
-          ],
+        { title => 'Yet another CD',
+          year => 2006,
         },
-    ],
+      ],
+    });
+  },
+  qr/Recursive update is not supported over relationships of type multi/,
+  'create via update of multi relationships throws an exception'
+);
+
+# Create m2m while originating in the linker table
+eval {
+  my $artist = $schema->resultset('Artist')->first;
+  my $c2p = $schema->resultset('CD_to_Producer')->create ({
+    cd => {
+      artist => $artist,
+      title => 'Bad investment',
+      year => 2008,
+      tracks => [
+        { position => 1, title => 'Just buy' },
+        { position => 2, title => 'Why did we do it' },
+        { position => 3, title => 'Burn baby burn' },
+      ],
+    },
+    producer => {
+      name => 'Lehman Bros.',
+    },
   });
 
-  isa_ok($artist, 'DBICTest::Artist', 'Created Artist');
-  is($artist->name, 'Fred 2', 'Artist created correctly');
-  is($artist->cds->count, 1, 'One CD created for artist');
-  is($artist->cds->first->title, 'Music to code by', 'CD created correctly');
-  is($artist->cds->first->tags->count, 1, 'One tag created for CD');
-  is($artist->cds->first->tags->first->tag, 'rock', 'Tag created correctly');
+  isa_ok ($c2p, 'DBICTest::CD_to_Producer', 'Linker object created');
+  my $prod = $schema->resultset ('Producer')->find ({ name => 'Lehman Bros.' });
+  isa_ok ($prod, 'DBICTest::Producer', 'Producer row found');
+  is ($prod->cds->count, 1, 'Producer has one production');
+  my $cd = $prod->cds->first;
+  is ($cd->title, 'Bad investment', 'CD created correctly');
+  is ($cd->tracks->count, 3, 'CD has 3 tracks');
 
-  # Create via update - add a new CD
-  $artist->update({
-    cds => [ $artist->cds,
-      { title => 'Yet another CD',
-        year => 2006,
+};
+diag $@ if $@;
+
+# create over > 1 levels of might_have (A => { might_have => { B => has_many => C } } )
+eval {
+  my $artist = $schema->resultset('Artist')->first;
+  my $cd = $schema->resultset('CD')->create ({
+    artist => $artist,
+    title => 'Music to code by at night',
+    year => 2008,
+    tracks => [
+      {
+        position => 1,
+        title => 'Off by one again',
       },
+      {
+        position => 2,
+        title => 'The dereferencer',
+        cd_single => {
+          artist => $artist,
+          year => 2008,
+          title => 'Was that a null (Single)',
+          tracks => [
+            { title => 'The dereferencer', position => 1 },
+            { title => 'The dereferencer II', position => 2 },
+          ],
+          cd_to_producer => [
+            {
+              producer => {
+                name => 'K&R',
+              }
+            }
+          ]
+        },
+      },
     ],
   });
-  is(($artist->cds->search({}, { order_by => 'year' }))[0]->title, 'Yet another CD', 'Updated and added another CD');
 
-  my $newartist = $schema->resultset('Artist')->find_or_create({ name => 'Fred 2'});
+  isa_ok ($cd, 'DBICTest::CD', 'Main CD object created');
+  is ($cd->title, 'Music to code by at night', 'Correct CD title');
+  is ($cd->tracks->count, 2, 'Two tracks on main CD');
 
-  is($newartist->name, 'Fred 2', 'Retrieved the artist');
+  my ($t1, $t2) = $cd->tracks->all;
+  is ($t1->title, 'Off by one again', 'Correct 1st track name');
+  is ($t1->cd_single, undef, 'No single for 1st track');
+  is ($t2->title, 'The dereferencer', 'Correct 2nd track name');
+  isa_ok ($t2->cd_single, 'DBICTest::CD', 'Created a single for 2nd track');
+
+  my $single = $t2->cd_single;
+  is ($single->tracks->count, 2, 'Two tracks on single CD');
+  is ($single->tracks->find ({ position => 1})->title, 'The dereferencer', 'Correct 1st track title');
+  is ($single->tracks->find ({ position => 2})->title, 'The dereferencer II', 'Correct 2nd track title');
+
+  is ($single->cd_to_producer->count, 1, 'One producer created with the single cd');
+  is ($single->cd_to_producer->first->producer->name, 'K&R', 'Producer name correct');
 };
 diag $@ if $@;
 
+TODO: {
+local $TODO = "Todoify for multicreate branch";
+# test might_have again but with a PK == FK in the middle (obviously not specified)
+eval {
+  my $artist = $schema->resultset('Artist')->first;
+  my $cd = $schema->resultset('CD')->create ({
+    artist => $artist,
+    title => 'Music to code by at twilight',
+    year => 2008,
+    artwork => {
+      images => [
+        { name => 'recursive descent' },
+        { name => 'tail packing' },
+      ],
+    },
+  });
+
+  isa_ok ($cd, 'DBICTest::CD', 'Main CD object created');
+  is ($cd->title, 'Music to code by at twilight', 'Correct CD title');
+  isa_ok ($cd->artwork, 'DBICTest::Artwork', 'Artwork created');
+
+  # this test might look weird, but it failed at one point, keep it there
+  my $art_obj = $cd->artwork;
+  ok ($art_obj->has_column_loaded ('cd_id'), 'PK/FK present on artwork object');
+  is ($art_obj->images->count, 2, 'Correct artwork image count via the new object');
+  is_deeply (
+    [ sort $art_obj->images->get_column ('name')->all ],
+    [ 'recursive descent', 'tail packing' ],
+    'Images named correctly in objects',
+  );
+
+
+  my $artwork = $schema->resultset('Artwork')->search (
+    { 'cd.title' => 'Music to code by at twilight' },
+    { join => 'cd' },
+  )->single;
+
+  is ($artwork->images->count, 2, 'Correct artwork image count via a new search');
+
+  is_deeply (
+    [ sort $artwork->images->get_column ('name')->all ],
+    [ 'recursive descent', 'tail packing' ],
+    'Images named correctly after search',
+  );
+};
+diag $@ if $@;
+
+# test might_have again but with just a PK and FK (neither specified) in the mid-table
+eval {
+  my $cd = $schema->resultset('CD')->first;
+  my $track = $schema->resultset ('Track')->create ({
+    cd => $cd,
+    position => 66,
+    title => 'Black',
+    lyrics => {
+      lyric_versions => [
+        { text => 'The color black' },
+        { text => 'The colour black' },
+      ],
+    },
+  });
+
+  isa_ok ($track, 'DBICTest::Track', 'Main track object created');
+  is ($track->title, 'Black', 'Correct track title');
+  isa_ok ($track->lyrics, 'DBICTest::Lyrics', 'Lyrics created');
+
+  # this test might look weird, but it was failing at one point, keep it there
+  my $lyric_obj = $track->lyrics;
+  ok ($lyric_obj->has_column_loaded ('lyric_id'), 'PK present on lyric object');
+  ok ($lyric_obj->has_column_loaded ('track_id'), 'FK present on lyric object');
+  is ($lyric_obj->lyric_versions->count, 2, 'Correct lyric versions count via the new object');
+  is_deeply (
+    [ sort $lyric_obj->lyric_versions->get_column ('text')->all ],
+    [ 'The color black', 'The colour black' ],
+    'Lyrics text in objects matches',
+  );
+
+
+  my $lyric = $schema->resultset('Lyrics')->search (
+    { 'track.title' => 'Black' },
+    { join => 'track' },
+  )->single;
+
+  is ($lyric->lyric_versions->count, 2, 'Correct lyric versions count via a new search');
+
+  is_deeply (
+    [ sort $lyric->lyric_versions->get_column ('text')->all ],
+    [ 'The color black', 'The colour black' ],
+    'Lyrics text via search matches',
+  );
+};
+diag $@ if $@;
+}
+
 # nested find_or_create
 eval {
   my $newartist2 = $schema->resultset('Artist')->find_or_create({ 
@@ -80,7 +280,7 @@
 # multiple same level has_many create
 eval {
   my $artist2 = $schema->resultset('Artist')->create({
-    name => 'Fred 3',
+    name => 'Fred 4',
     cds => [
       {
         title => 'Music to code by',
@@ -279,7 +479,6 @@
 # (should work, despite the fact that no one will probably use it this way)
 
 # first count how many rows do we initially have
-
 my $counts;
 $counts->{$_} = $schema->resultset($_)->count for qw/Artist CD Genre Producer Tag/;
 
@@ -287,7 +486,7 @@
 eval {
   $schema->resultset('CD')->create ({
     artist => {
-      name => 'larry',
+      name => 'james',
     },
     title => 'Greatest hits 1',
     year => '2012',
@@ -301,15 +500,15 @@
     cd_to_producer => [
       {
         producer => {
-          name => 'Dirty Harry',
+          name => 'bob',
           producer_to_cd => [
             {
               cd => { 
                 artist => {
-                  name => 'Dirty Harry himself',
+                  name => 'lars',
                   cds => [
                     {
-                      title => 'Greatest hits 3',
+                      title => 'Greatest hits 2',
                       year => 2012,
                       genre => {
                         name => '"Greatest" collections',
@@ -318,10 +517,60 @@
                         { tag => 'A' },
                         { tag => 'B' },
                       ],
+                      # This cd is created via artist so it doesn't know about producers
+                      cd_to_producer => [
+                        # if we specify 'bob' here things bomb
+                        # as the producer attached to Greatest Hits 1 is
+                        # already created, but not yet inserted.
+                        # Maybe this can be fixed, but things are hairy
+                        # enough already.
+                        #
+                        #{ producer => { name => 'bob' } },
+                        { producer => { name => 'paul' } },
+                        { producer => {
+                          name => 'flemming',
+                          producer_to_cd => [
+                            { cd => {
+                              artist => {
+                                name => 'kirk',
+                                cds => [
+                                  {
+                                    title => 'Greatest hits 3',
+                                    year => 2012,
+                                    genre => {
+                                      name => '"Greatest" collections',
+                                    },
+                                    tags => [
+                                      { tag => 'A' },
+                                      { tag => 'B' },
+                                    ],
+                                  },
+                                  {
+                                    title => 'Greatest hits 4',
+                                    year => 2012,
+                                    genre => {
+                                      name => '"Greatest" collections2',
+                                    },
+                                    tags => [
+                                      { tag => 'A' },
+                                      { tag => 'B' },
+                                    ],
+                                  },
+                                ],
+                              },
+                              title => 'Greatest hits 5',
+                              year => 2013,
+                              genre => {
+                                name => '"Greatest" collections2',
+                              },
+                            }},
+                          ],
+                        }},
+                      ],
                     },
                   ],
                 },
-                title => 'Greatest hits 2',
+                title => 'Greatest hits 6',
                 year => 2012,
                 genre => {
                   name => '"Greatest" collections',
@@ -335,10 +584,12 @@
             {
               cd => { 
                 artist => {
-                  name => 'larry',    # should already exist
+                  name => 'lars',    # should already exist
+                  # even though the artist 'name' is not uniquely constrained
+                  # find_or_create will arguably DWIM 
                 },
-                title => 'Greatest hits 4',
-                year => 2012,
+                title => 'Greatest hits 7',
+                year => 2013,
               },
             },
           ],
@@ -347,33 +598,94 @@
     ],
   });
 
-  is ($schema->resultset ('Artist')->count, $counts->{Artist} + 1, 'One new artists created');  # even though the 'name' is not uniquely constrained find_or_create will arguably DWIM
-  is ($schema->resultset ('Genre')->count, $counts->{Genre} + 1, 'One additional genre created');
-  is ($schema->resultset ('Producer')->count, $counts->{Producer} + 1, 'One new producer');
-  is ($schema->resultset ('CD')->count, $counts->{CD} + 4, '4 new CDs');
-  is ($schema->resultset ('Tag')->count, $counts->{Tag} + 6, '6 new Tags');
+  is ($schema->resultset ('Artist')->count, $counts->{Artist} + 3, '3 new artists created');
+  is ($schema->resultset ('Genre')->count, $counts->{Genre} + 2, '2 additional genres created');
+  is ($schema->resultset ('Producer')->count, $counts->{Producer} + 3, '3 new producer');
+  is ($schema->resultset ('CD')->count, $counts->{CD} + 7, '7 new CDs');
+  is ($schema->resultset ('Tag')->count, $counts->{Tag} + 10, '10 new Tags');
 
-  my $harry_cds = $schema->resultset ('Artist')->single ({name => 'Dirty Harry himself'})->cds;
-  is ($harry_cds->count, 2, 'Two CDs created by Harry');
-  ok ($harry_cds->single ({title => 'Greatest hits 2'}), 'First CD name correct');
-  ok ($harry_cds->single ({title => 'Greatest hits 3'}), 'Second CD name correct');
+  my $cd_rs = $schema->resultset ('CD')
+    ->search ({ title => { -like => 'Greatest hits %' }}, { order_by => 'title'} );
+  is ($cd_rs->count, 7, '7 greatest hits created');
 
-  my $harry_productions = $schema->resultset ('Producer')->single ({name => 'Dirty Harry'})
-    ->search_related ('producer_to_cd', {})->search_related ('cd', {});
-  is ($harry_productions->count, 4, 'All 4 CDs are produced by Harry');
-  is ($harry_productions->search ({ year => 2012 })->count, 4, 'All 4 CDs have the correct year');
+  my $cds_2012 = $cd_rs->search ({ year => 2012});
+  is ($cds_2012->count, 5, '5 CDs created in 2012');
 
-  my $hits_genre = $schema->resultset ('Genre')->single ({name => '"Greatest" collections'});
-  ok ($hits_genre, 'New genre row found');
-  is ($hits_genre->cds->count, 3, 'Three of the new CDs fall into the new genre');
+  is (
+    $cds_2012->search(
+      { 'tags.tag' => { -in => [qw/A B/] } },
+      { join => 'tags', group_by => 'me.cdid' }
+    ),
+    5,
+    'All 10 tags were pairwise distributed between 5 year-2012 CDs'
+  );
 
-  my $a_tags = $schema->resultset('Tag')->search({ tag => 'A'});
-  my $b_tags = $schema->resultset('Tag')->search({ tag => 'A'});
-  is ($a_tags->count, 3, '3 A tags');
-  is ($a_tags->count, 3, '3 B tags');
+  my $paul_prod = $cd_rs->search (
+    { 'producer.name' => 'paul'},
+    { join => { cd_to_producer => 'producer' } }
+  );
+  is ($paul_prod->count, 1, 'Paul had 1 production');
+  my $pauls_cd = $paul_prod->single;
+  is ($pauls_cd->cd_to_producer->count, 2, 'Paul had one co-producer');
+  is (
+    $pauls_cd->search_related ('cd_to_producer',
+      { 'producer.name' => 'flemming'},
+      { join => 'producer' }
+    )->count,
+    1,
+    'The second producer is flemming',
+  );
 
-  my $cds_with_ab = $schema->resultset('CD')
-    ->search({ 'tags.tag' => { -in => [qw/A B/] } }, { join => 'tags', group_by => 'me.cdid' } );
-  is ($cds_with_ab->count, 3, '6 tags were pairwise distributed between 3 CDs');
+  my $kirk_cds = $cd_rs->search ({ 'artist.name' => 'kirk' }, { join => 'artist' });
+  is ($kirk_cds, 3, 'Kirk had 3 CDs');
+  is (
+    $kirk_cds->search (
+      { 'cd_to_producer.cd' => { '!=', undef } },
+      { join => 'cd_to_producer' },
+    ),
+    1,
+    'Kirk had a producer only on one cd',
+  );
+
+  my $lars_cds = $cd_rs->search ({ 'artist.name' => 'lars' }, { join => 'artist' });
+  is ($lars_cds->count, 3, 'Lars had 3 CDs');
+  is (
+    $lars_cds->search (
+      { 'cd_to_producer.cd' => undef },
+      { join => 'cd_to_producer' },
+    ),
+    0,
+    'Lars always had a producer',
+  );
+  is (
+    $lars_cds->search_related ('cd_to_producer',
+      { 'producer.name' => 'flemming'},
+      { join => 'producer' }
+    )->count,
+    1,
+    'Lars produced 1 CD with flemming',
+  );
+  is (
+    $lars_cds->search_related ('cd_to_producer',
+      { 'producer.name' => 'bob'},
+      { join => 'producer' }
+    )->count,
+    2,
+    'Lars produced 2 CDs with bob',
+  );
+
+  my $bob_prod = $cd_rs->search (
+    { 'producer.name' => 'bob'},
+    { join => { cd_to_producer => 'producer' } }
+  );
+  is ($bob_prod->count, 3, 'Bob produced a total of 3 CDs');
+
+  is (
+    $bob_prod->search ({ 'artist.name' => 'james' }, { join => 'artist' })->count,
+    1,
+    "Bob produced james' only CD",
+  );
 };
 diag $@ if $@;
+
+1;

Modified: DBIx-Class/0.08/branches/views_support/t/97result_class.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/97result_class.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/97result_class.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -2,20 +2,39 @@
 use warnings;  
 
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 9;
+plan tests => 12;
 
 {
   my $cd_rc = $schema->resultset("CD")->result_class;
   
+  throws_ok {
+    $schema->resultset("Artist")
+      ->search_rs({}, {result_class => "IWillExplode"})
+  } qr/Can't locate IWillExplode/, 'nonexistant result_class exception';
+
+# to make ensure_class_loaded happy, dies on inflate
+  eval 'package IWillExplode; sub dummy {}';
+
   my $artist_rs = $schema->resultset("Artist")
     ->search_rs({}, {result_class => "IWillExplode"});
   is($artist_rs->result_class, 'IWillExplode', 'Correct artist result_class');
-  
+
+  throws_ok {
+    $artist_rs->result_class('mtfnpy')
+  } qr/Can't locate mtfnpy/,
+  'nonexistant result_access exception (from accessor)';
+
+  throws_ok {
+    $artist_rs->first
+  } qr/Can't locate object method "inflate_result" via package "IWillExplode"/,
+  'IWillExplode explodes on inflate';
+
   my $cd_rs = $artist_rs->related_resultset('cds');
   is($cd_rs->result_class, $cd_rc, 'Correct cd result_class');
 

Modified: DBIx-Class/0.08/branches/views_support/t/98savepoints.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/98savepoints.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/98savepoints.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -15,7 +15,7 @@
 } elsif (exists $ENV{DBICTEST_MYSQL_DSN}) {
   ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
 
-  $create_sql = "CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10)) ENGINE=InnoDB";
+  $create_sql = "CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10)) ENGINE=InnoDB";
 } else {
   plan skip_all => 'Set DBICTEST_(PG|MYSQL)_DSN _USER and _PASS if you want to run savepoint tests';
 }

Modified: DBIx-Class/0.08/branches/views_support/t/99dbic_sqlt_parser.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/99dbic_sqlt_parser.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/99dbic_sqlt_parser.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -9,7 +9,7 @@
     eval "use DBD::mysql; use SQL::Translator 0.09;";
     plan $@
         ? ( skip_all => 'needs SQL::Translator 0.09 for testing' )
-        : ( tests => 102 );
+        : ( tests => 114 );
 }
 
 my $schema = DBICTest->init_schema();

Modified: DBIx-Class/0.08/branches/views_support/t/bindtype_columns.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/bindtype_columns.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/bindtype_columns.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -22,10 +22,11 @@
     $dbh->do(qq[
         CREATE TABLE artist
         (
-            artistid        serial  NOT NULL    PRIMARY KEY,
-            media           bytea   NOT NULL,
-            name            varchar NULL,
-            rank            integer NOT NULL    DEFAULT '13'
+            artistid        serial       NOT NULL   PRIMARY KEY,
+            media           bytea        NOT NULL,
+            name            varchar(100) NULL,
+            rank            integer NOT  NULL       DEFAULT '13',
+            charfield       char(10)     NULL
         );
     ],{ RaiseError => 1, PrintError => 1 });
 }

Modified: DBIx-Class/0.08/branches/views_support/t/cdbi-t/02-Film.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/cdbi-t/02-Film.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/cdbi-t/02-Film.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -231,17 +231,26 @@
 );
 
 # Test that a disconnect doesnt harm anything.
-Film->db_Main->disconnect;
- at films = Film->search({ Rating => 'NC-17' });
-ok(@films == 1 && $films[0]->id eq $gone->id, 'auto reconnection');
+{
+    # SQLite is loud on disconnect/reconnect. 
+    # This is solved in DBIC but not in ContextualFetch
+    local $SIG{__WARN__} = sub {
+      warn @_ unless $_[0] =~
+        /active statement handles|inactive database handle/;
+    };
 
-# Test discard_changes().
-my $orig_director = $btaste->Director;
-$btaste->Director('Lenny Bruce');
-is($btaste->Director, 'Lenny Bruce', 'set new Director');
-$btaste->discard_changes;
-is($btaste->Director, $orig_director, 'discard_changes()');
+    Film->db_Main->disconnect;
+    @films = Film->search({ Rating => 'NC-17' });
+    ok(@films == 1 && $films[0]->id eq $gone->id, 'auto reconnection');
 
+    # Test discard_changes().
+    my $orig_director = $btaste->Director;
+    $btaste->Director('Lenny Bruce');
+    is($btaste->Director, 'Lenny Bruce', 'set new Director');
+    $btaste->discard_changes;
+    is($btaste->Director, $orig_director, 'discard_changes()');
+}
+
 SKIP: {
 	skip "ActiveState perl produces additional warnings", 3
           if ($^O eq 'MSWin32');

Modified: DBIx-Class/0.08/branches/views_support/t/cdbi-t/15-accessor.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/cdbi-t/15-accessor.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/cdbi-t/15-accessor.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -2,43 +2,45 @@
 use Test::More;
 
 BEGIN {
-  eval "use DBIx::Class::CDBICompat;";
-  if ($@) {
-    plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
-    next;
-  }
-  eval "use DBD::SQLite";
-  plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 54);
+    eval "use DBIx::Class::CDBICompat;";
+    if ($@) {
+        plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
+        next;
+    }
+    eval "use DBD::SQLite";
+    plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 75);
 }
 
 INIT {
-	#local $SIG{__WARN__} =
-		#sub { like $_[0], qr/clashes with built-in method/, $_[0] };
-	use lib 't/testlib';
-	require Film;
-	require Actor;
-        require Director;
-	Actor->has_a(film => 'Film');
-        Film->has_a(director => 'Director');
-	sub Class::DBI::sheep { ok 0; }
+    #local $SIG{__WARN__} =
+        #sub { like $_[0], qr/clashes with built-in method/, $_[0] };
+    use lib 't/testlib';
+    require Film;
+    require Actor;
+    require Director;
+
+    Actor->has_a(film => 'Film');
+    Film->has_a(director => 'Director');
+
+    sub Class::DBI::sheep { ok 0; }
 }
 
 sub Film::mutator_name {
-	my ($class, $col) = @_;
-	return "set_sheep" if lc $col eq "numexplodingsheep";
-	return $col;
+    my ($class, $col) = @_;
+    return "set_sheep" if lc $col eq "numexplodingsheep";
+    return $col;
 }
 
 sub Film::accessor_name {
-	my ($class, $col) = @_;
-	return "sheep" if lc $col eq "numexplodingsheep";
-	return $col;
+    my ($class, $col) = @_;
+    return "sheep" if lc $col eq "numexplodingsheep";
+    return $col;
 }
 
 sub Actor::accessor_name_for {
-	my ($class, $col) = @_;
-	return "movie" if lc $col eq "film";
-	return $col;
+    my ($class, $col) = @_;
+    return "movie" if lc $col eq "film";
+    return $col;
 }
 
 # This is a class with accessor_name_for() but no corresponding mutator_name_for()
@@ -49,94 +51,140 @@
 }
 
 my $data = {
-	Title    => 'Bad Taste',
-	Director => 'Peter Jackson',
-	Rating   => 'R',
+    Title    => 'Bad Taste',
+    Director => 'Peter Jackson',
+    Rating   => 'R',
 };
 
 eval {
-	my $data = $data;
-	$data->{NumExplodingSheep} = 1;
-	ok my $bt = Film->create($data), "Modified accessor - with column name";
-	isa_ok $bt, "Film";
+    my $data = { %$data };
+    $data->{NumExplodingSheep} = 1;
+    ok my $bt = Film->create($data), "Modified accessor - with column name";
+    isa_ok $bt, "Film";
+    is $bt->sheep, 1, 'sheep bursting violently';
 };
 is $@, '', "No errors";
 
 eval {
-	my $data = $data;
-	$data->{sheep} = 1;
-	ok my $bt = Film->create($data), "Modified accessor - with accessor";
-	isa_ok $bt, "Film";
+    my $data = { %$data };
+    $data->{sheep} = 2;
+    ok my $bt = Film->create($data), "Modified accessor - with accessor";
+    isa_ok $bt, "Film";
+    is $bt->sheep, 2, 'sheep bursting violently';
 };
 is $@, '', "No errors";
 
 eval {
-	my @film = Film->search({ sheep => 1 });
-	is @film, 2, "Can search with modified accessor";
+    my $data = { %$data };
+    $data->{NumExplodingSheep} = 1;
+    ok my $bt = Film->find_or_create($data),
+		"find_or_create Modified accessor - find with column name";
+    isa_ok $bt, "Film";
+    is $bt->sheep, 1, 'sheep bursting violently';
 };
+is $@, '', "No errors";
 
+eval {
+    my $data = { %$data };
+    $data->{sheep} = 1;
+    ok my $bt = Film->find_or_create($data),
+		"find_or_create Modified accessor - find with accessor";
+    isa_ok $bt, "Film";
+    is $bt->sheep, 1, 'sheep bursting violently';
+};
+is $@, '', "No errors";
+
+eval {
+    my $data = { %$data };
+    $data->{NumExplodingSheep} = 3;
+    ok my $bt = Film->find_or_create($data),
+		"find_or_create Modified accessor - create with column name";
+    isa_ok $bt, "Film";
+    is $bt->sheep, 3, 'sheep bursting violently';
+};
+is $@, '', "No errors";
+
+eval {
+    my $data = { %$data };
+    $data->{sheep} = 4;
+    ok my $bt = Film->find_or_create($data),
+		"find_or_create Modified accessor - create with accessor";
+    isa_ok $bt, "Film";
+    is $bt->sheep, 4, 'sheep bursting violently';
+};
+is $@, '', "No errors";
+
+eval {
+    my @film = Film->search({ sheep => 1 });
+    is @film, 2, "Can search with modified accessor";
+};
+is $@, '', "No errors";
+
 {
 
-	eval {
-		local $data->{set_sheep} = 1;
-		ok my $bt = Film->create($data), "Modified mutator - with mutator";
-		isa_ok $bt, "Film";
-	};
-	is $@, '', "No errors";
+    eval {
+        local $data->{set_sheep} = 1;
+        ok my $bt = Film->create($data), "Modified mutator - with mutator";
+        isa_ok $bt, "Film";
+    };
+    is $@, '', "No errors";
 
-	eval {
-		local $data->{NumExplodingSheep} = 1;
-		ok my $bt = Film->create($data), "Modified mutator - with column name";
-		isa_ok $bt, "Film";
-	};
-	is $@, '', "No errors";
+    eval {
+        local $data->{NumExplodingSheep} = 1;
+        ok my $bt = Film->create($data), "Modified mutator - with column name";
+        isa_ok $bt, "Film";
+    };
+    is $@, '', "No errors";
 
-	eval {
-		local $data->{sheep} = 1;
-		ok my $bt = Film->create($data), "Modified mutator - with accessor";
-		isa_ok $bt, "Film";
-	};
-	is $@, '', "No errors";
+    eval {
+        local $data->{sheep} = 1;
+        ok my $bt = Film->create($data), "Modified mutator - with accessor";
+        isa_ok $bt, "Film";
+    };
+    is $@, '', "No errors";
 
 }
 
 {
-	my $p_data = {
-		name => 'Peter Jackson',
-		film => 'Bad Taste',
-	};
-	my $bt = Film->create($data);
-	my $ac = Actor->create($p_data);
+    my $p_data = {
+        name => 'Peter Jackson',
+        film => 'Bad Taste',
+    };
+    my $bt = Film->create($data);
+    my $ac = Actor->create($p_data);
 
-	eval { my $f = $ac->film };
-	like $@, qr/film/, "no hasa film";
+    ok !eval { my $f = $ac->film; 1 };
+    like $@, qr/film/, "no hasa film";
 
-	eval {
-		ok my $f = $ac->movie, "hasa movie";
-		isa_ok $f, "Film";
-		is $f->id, $bt->id, " - Bad Taste";
-	};
-	is $@, '', "No errors";
+    eval {
+        local $SIG{__WARN__} = sub {
+            warn @_ unless $_[0] =~ /Query returned more than one row/;
+        };
+        ok my $f = $ac->movie, "hasa movie";
+        isa_ok $f, "Film";
+        is $f->id, $bt->id, " - Bad Taste";
+    };
+    is $@, '', "No errors";
 
-	{
-		local $data->{Title} = "Another film";
-		my $film = Film->create($data);
+    {
+        local $data->{Title} = "Another film";
+        my $film = Film->create($data);
 
-		eval { $ac->film($film) };
-		ok $@, $@;
+        eval { $ac->film($film) };
+        ok $@, $@;
 
-		eval { $ac->movie($film) };
-		ok $@, $@;
+        eval { $ac->movie($film) };
+        ok $@, $@;
 
-		eval {
-			ok $ac->set_film($film), "Set movie through hasa";
-			$ac->update;
-			ok my $f = $ac->movie, "hasa movie";
-			isa_ok $f, "Film";
-			is $f->id, $film->id, " - Another Film";
-		};
-		is $@, '', "No problem";
-	}
+        eval {
+            ok $ac->set_film($film), "Set movie through hasa";
+            $ac->update;
+            ok my $f = $ac->movie, "hasa movie";
+            isa_ok $f, "Film";
+            is $f->id, $film->id, " - Another Film";
+        };
+        is $@, '', "No problem";
+    }
 
 }
 
@@ -154,62 +202,64 @@
 }
 
 {
-	Film->columns(TEMP => qw/nonpersistent/);
-	ok(Film->find_column('nonpersistent'), "nonpersistent is a column");
-	ok(!Film->has_real_column('nonpersistent'), " - but it's not real");
+    Film->columns(TEMP => qw/nonpersistent/);
+    ok(Film->find_column('nonpersistent'), "nonpersistent is a column");
+    ok(!Film->has_real_column('nonpersistent'), " - but it's not real");
 
-	{
-		my $film = Film->create({ Title => "Veronique", nonpersistent => 42 });
-		is $film->title,         "Veronique", "Title set OK";
-		is $film->nonpersistent, 42,          "As is non persistent value";
-		$film->remove_from_object_index;
-		ok $film = Film->retrieve('Veronique'), "Re-retrieve film";
-		is $film->title, "Veronique", "Title still OK";
-		is $film->nonpersistent, undef, "Non persistent value gone";
-		ok $film->nonpersistent(40), "Can set it";
-		is $film->nonpersistent, 40, "And it's there again";
-		ok $film->update, "Commit the film";
-		is $film->nonpersistent, 40, "And it's still there";
-	}
+    {
+        my $film = Film->create({ Title => "Veronique", nonpersistent => 42 });
+        is $film->title,         "Veronique", "Title set OK";
+        is $film->nonpersistent, 42,          "As is non persistent value";
+        $film->remove_from_object_index;
+        ok $film = Film->retrieve('Veronique'), "Re-retrieve film";
+        is $film->title, "Veronique", "Title still OK";
+        is $film->nonpersistent, undef, "Non persistent value gone";
+        ok $film->nonpersistent(40), "Can set it";
+        is $film->nonpersistent, 40, "And it's there again";
+        ok $film->update, "Commit the film";
+        is $film->nonpersistent, 40, "And it's still there";
+    }
 }
 
 {
-	is_deeply(
-		[Actor->columns('Essential')],
-		[Actor->columns('Primary')],
-		"Actor has no specific essential columns"
-	);
-	ok(Actor->find_column('nonpersistent'), "nonpersistent is a column");
-	ok(!Actor->has_real_column('nonpersistent'), " - but it's not real");
-	my $pj = eval { Actor->search(name => "Peter Jackson")->first };
-	is $@, '', "no problems retrieving actors";
-	isa_ok $pj => "Actor";
+    is_deeply(
+        [Actor->columns('Essential')],
+        [Actor->columns('Primary')],
+        "Actor has no specific essential columns"
+    );
+    ok(Actor->find_column('nonpersistent'), "nonpersistent is a column");
+    ok(!Actor->has_real_column('nonpersistent'), " - but it's not real");
+    my $pj = eval { Actor->search(name => "Peter Jackson")->first };
+    is $@, '', "no problems retrieving actors";
+    isa_ok $pj => "Actor";
 }
 
 {
-	Film->autoupdate(1);
-	my $naked = Film->create({ title => 'Naked' });
-	my $sandl = Film->create({ title => 'Secrets and Lies' });
+    Film->autoupdate(1);
+    my $naked = Film->create({ title => 'Naked' });
+    my $sandl = Film->create({ title => 'Secrets and Lies' });
 
-	my $rating = 1;
-	my $update_failure = sub {
-		my $obj = shift;
-		eval { $obj->rating($rating++) };
-		return $@ =~ /read only/;
-	};
+    my $rating = 1;
+    my $update_failure = sub {
+        my $obj = shift;
+        eval { $obj->rating($rating++) };
+        return $@ =~ /read only/;
+    };
 
-	ok !$update_failure->($naked), "Can update Naked";
-	ok $naked->make_read_only, "Make Naked read only";
-	ok $update_failure->($naked), "Can't update Naked any more";
-	ok !$update_failure->($sandl), "But can still update Secrets and Lies";
-	my $july4 = eval { Film->create({ title => "4 Days in July" }) };
-	isa_ok $july4 => "Film", "And can still create new films";
+    ok !$update_failure->($naked), "Can update Naked";
+    ok $naked->make_read_only, "Make Naked read only";
+    ok $update_failure->($naked), "Can't update Naked any more";
+    ok !$update_failure->($sandl), "But can still update Secrets and Lies";
+    my $july4 = eval { Film->create({ title => "4 Days in July" }) };
+    isa_ok $july4 => "Film", "And can still create new films";
 
-	ok(Film->make_read_only, "Make all Films read only");
-	ok $update_failure->($naked), "Still can't update Naked";
-	ok $update_failure->($sandl), "And can't update S&L any more";
-	eval { $july4->delete };
-	like $@, qr/read only/, "And can't delete 4 Days in July";
-	my $abigail = eval { Film->create({ title => "Abigail's Party" }) };
-	like $@, qr/read only/, "Or create new films";
+    ok(Film->make_read_only, "Make all Films read only");
+    ok $update_failure->($naked), "Still can't update Naked";
+    ok $update_failure->($sandl), "And can't update S&L any more";
+    eval { $july4->delete };
+    like $@, qr/read only/, "And can't delete 4 Days in July";
+    my $abigail = eval { Film->create({ title => "Abigail's Party" }) };
+    like $@, qr/read only/, "Or create new films";
+
+    $sandl->discard_changes;
 }

Modified: DBIx-Class/0.08/branches/views_support/t/cdbi-t/23-cascade.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/cdbi-t/23-cascade.t	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/cdbi-t/23-cascade.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1,5 +1,6 @@
 use strict;
 use Test::More;
+use Data::Dumper;
 
 BEGIN {
   eval "use DBIx::Class::CDBICompat;";
@@ -48,7 +49,8 @@
     is $dir->nasties, 1, "We have one nasty";
 
     ok $dir->delete;
-    ok +Film->retrieve("Alligator"), "has_many with @{[ keys %$args ]} => @{[ values %$args ]}";
+    local $Data::Dumper::Terse = 1;
+    ok +Film->retrieve("Alligator"), 'has_many with ' . Dumper ($args);;
     $kk->delete;
 }
 

Added: DBIx-Class/0.08/branches/views_support/t/cdbi-t/mk_group_accessors.t
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/cdbi-t/mk_group_accessors.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/views_support/t/cdbi-t/mk_group_accessors.t	2008-11-22 18:56:26 UTC (rev 5178)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More;
+
+BEGIN {
+    eval "use DBIx::Class::CDBICompat;";
+    plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
+
+    eval "use DBD::SQLite";
+    plan skip_all => 'needs DBD::SQLite for testing' if $@;
+
+    plan 'no_plan';
+}
+
+INIT {
+    use lib 't/testlib';
+    require Film;
+}
+
+sub Film::get_test {
+    my $self = shift;
+    my $key = shift;
+    $self->{get_test}++;
+    return $self->{$key};
+}
+
+sub Film::set_test {
+    my($self, $key, $val) = @_;
+    $self->{set_test}++;
+    return $self->{$key} = $val;
+}
+
+
+my $film = Film->create({ Title => "No Wolf McQuade" });
+
+# Test mk_group_accessors() with a list of fields.
+{
+    Film->mk_group_accessors(test => qw(foo bar));
+    $film->foo(42);
+    is $film->foo, 42;
+
+    $film->bar(23);
+    is $film->bar, 23;
+}
+
+
+# An explicit accessor passed to mk_group_accessors should
+# ignore accessor/mutator_name_for.
+sub Film::accessor_name_for {
+    my($class, $col) = @_;
+    return "hlaglagh" if $col eq "wibble";
+    return $col;
+}
+
+sub Film::mutator_name_for {
+    my($class, $col) = @_;
+    return "hlaglagh" if $col eq "wibble";
+    return $col;
+}
+
+
+# Test with a mix of fields and field specs
+{
+    Film->mk_group_accessors(test => ("baz", [wibble_thing => "wibble"]));
+    $film->baz(42);
+    is $film->baz, 42;
+
+    $film->wibble_thing(23);
+    is $film->wibble_thing, 23;
+}

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artist.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artist.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -23,6 +23,11 @@
     data_type => 'integer',
     default_value => 13,
   },
+  charfield => {
+    data_type => 'char',
+    size => 10,
+    is_nullable => 1,
+  },
 );
 __PACKAGE__->set_primary_key('artistid');
 

Added: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artwork.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artwork.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Artwork.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -0,0 +1,16 @@
+package # hide from PAUSE 
+    DBICTest::Schema::Artwork;
+
+use base qw/DBIx::Class::Core/;
+
+__PACKAGE__->table('cd_artwork');
+__PACKAGE__->add_columns(
+  'cd_id' => {
+    data_type => 'integer',
+  },
+);
+__PACKAGE__->set_primary_key('cd_id');
+__PACKAGE__->belongs_to('cd', 'DBICTest::Schema::CD', 'cd_id');
+__PACKAGE__->has_many('images', 'DBICTest::Schema::Image', 'artwork_id');
+
+1;

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Bookmark.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Bookmark.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Bookmark.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -8,7 +8,6 @@
 use warnings;
 
 __PACKAGE__->table('bookmark');
-__PACKAGE__->add_columns(qw/id link/);
 __PACKAGE__->add_columns(
     'id' => {
         data_type => 'integer',

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/CD.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/CD.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/CD.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -23,6 +23,11 @@
   'genreid' => { 
     data_type => 'integer',
     is_nullable => 1,
+  },
+  'single_track' => {
+    data_type => 'integer',
+    is_nullable => 1,
+    is_foreign_key => 1,
   }
 );
 __PACKAGE__->set_primary_key('cdid');
@@ -30,10 +35,11 @@
 
 __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { 
     is_deferrable => 1, 
-    on_delete => undef,
-    on_update => 'SET NULL',
 });
 
+# in case this is a single-cd it promotes a track from another cd
+__PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track' );
+
 __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' );
 __PACKAGE__->has_many(
     tags => 'DBICTest::Schema::Tag', undef,
@@ -47,6 +53,8 @@
     liner_notes => 'DBICTest::Schema::LinerNotes', undef,
     { proxy => [ qw/notes/ ] },
 );
+__PACKAGE__->might_have(artwork => 'DBICTest::Schema::Artwork', 'cd_id');
+
 __PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' );
 __PACKAGE__->many_to_many(
     producers_sorted => cd_to_producer => 'producer',
@@ -55,7 +63,12 @@
 
 __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre',
     { 'foreign.genreid' => 'self.genreid' },
-    { join_type => 'left' },
+    {
+        join_type => 'left',
+        on_delete => 'SET NULL',
+        on_update => 'CASCADE',
+
+    },
 );
 
 #__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre',

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Event.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Event.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Event.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -14,7 +14,7 @@
   created_on => { data_type => 'timestamp' },
   varchar_date => { data_type => 'varchar', inflate_date => 1, size => 20, is_nullable => 1 },
   varchar_datetime => { data_type => 'varchar', inflate_datetime => 1, size => 20, is_nullable => 1 },
-  skip_inflation => { data_type => 'datetime', inflate_datetime => 0, size => 20, is_nullable => 1 },
+  skip_inflation => { data_type => 'datetime', inflate_datetime => 0, is_nullable => 1 },
 );
 
 __PACKAGE__->set_primary_key('id');

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/ForceForeign.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/ForceForeign.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/ForceForeign.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -29,4 +29,13 @@
 			},
 );
 
+# Normally this would appear as a FK constraint
+__PACKAGE__->belongs_to(
+			'cd_3', 'DBICTest::Schema::CD', {
+			    'foreign.cdid' => 'self.cd',
+			}, {
+			    is_foreign_key_constraint => 0,
+			},
+);
+
 1;

Added: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Image.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Image.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Image.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -0,0 +1,28 @@
+package # hide from PAUSE 
+    DBICTest::Schema::Image;
+
+use base qw/DBIx::Class::Core/;
+
+__PACKAGE__->table('images');
+__PACKAGE__->add_columns(
+  'id' => {
+    data_type => 'integer',
+    is_auto_increment => 1,
+  },
+  'artwork_id' => {
+    data_type => 'integer',
+    is_foreign_key => 1,
+  },
+  'name' => {
+    data_type => 'varchar',
+    size => 100,
+  },
+  'data' => {
+    data_type => 'blob',
+    is_nullable => 1,
+  },
+);
+__PACKAGE__->set_primary_key('id');
+__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_id');
+
+1;

Added: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/LyricVersion.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/LyricVersion.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/LyricVersion.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -0,0 +1,24 @@
+package # hide from PAUSE
+    DBICTest::Schema::LyricVersion;
+
+use base qw/DBIx::Class::Core/;
+
+__PACKAGE__->table('lyric_versions');
+__PACKAGE__->add_columns(
+  'id' => {
+    data_type => 'integer',
+    is_auto_increment => 1,
+  },
+  'lyric_id' => {
+    data_type => 'integer',
+    is_foreign_key => 1,
+  },
+  'text' => {
+    data_type => 'varchar',
+    size => 100,
+  },
+);
+__PACKAGE__->set_primary_key('id');
+__PACKAGE__->belongs_to('lyric', 'DBICTest::Schema::Lyrics', 'lyric_id');
+
+1;

Added: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Lyrics.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Lyrics.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Lyrics.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -0,0 +1,21 @@
+package # hide from PAUSE 
+    DBICTest::Schema::Lyrics;
+
+use base qw/DBIx::Class::Core/;
+
+__PACKAGE__->table('lyrics');
+__PACKAGE__->add_columns(
+  'lyric_id' => {
+    data_type => 'integer',
+    is_auto_increment => 1,
+  },
+  'track_id' => {
+    data_type => 'integer',
+    is_foreign_key => 1,
+  },
+);
+__PACKAGE__->set_primary_key('lyric_id');
+__PACKAGE__->belongs_to('track', 'DBICTest::Schema::Track', 'track_id');
+__PACKAGE__->has_many('lyric_versions', 'DBICTest::Schema::LyricVersion', 'lyric_id');
+
+1;

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Producer.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Producer.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Producer.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -20,5 +20,5 @@
 __PACKAGE__->has_many(
     producer_to_cd => 'DBICTest::Schema::CD_to_Producer' => 'producer'
 );
-
+__PACKAGE__->many_to_many('cds', 'producer_to_cd', 'cd');
 1;

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Track.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Track.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema/Track.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -35,4 +35,7 @@
 __PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD' );
 __PACKAGE__->belongs_to( disc => 'DBICTest::Schema::CD' => 'cd');
 
+__PACKAGE__->might_have( cd_single => 'DBICTest::Schema::CD', 'single_track' );
+__PACKAGE__->might_have( lyrics => 'DBICTest::Schema::Lyrics', 'track_id' );
+
 1;

Modified: DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/DBICTest/Schema.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -21,6 +21,10 @@
   /,
   { 'DBICTest::Schema' => [qw/
     LinerNotes
+    Artwork
+    Image
+    Lyrics
+    LyricVersion
     OneKey
     #dummy
     TwoKeys

Modified: DBIx-Class/0.08/branches/views_support/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/lib/sqlite.sql	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/lib/sqlite.sql	2008-11-22 18:56:26 UTC (rev 5178)
@@ -1,6 +1,6 @@
 -- 
 -- Created by SQL::Translator::Producer::SQLite
--- Created on Sun Nov  2 15:27:04 2008
+-- Created on Mon Nov 17 02:53:11 2008
 -- 
 BEGIN TRANSACTION;
 
@@ -11,7 +11,8 @@
 CREATE TABLE artist (
   artistid INTEGER PRIMARY KEY NOT NULL,
   name varchar(100),
-  rank integer NOT NULL DEFAULT '13'
+  rank integer NOT NULL DEFAULT '13',
+  charfield char(10)
 );
 
 
@@ -28,6 +29,15 @@
 CREATE INDEX artist_undirected_map_idx_id2_ ON artist_undirected_map (id2);
 
 --
+-- Table: cd_artwork
+--
+CREATE TABLE cd_artwork (
+  cd_id INTEGER PRIMARY KEY NOT NULL
+);
+
+CREATE INDEX cd_artwork_idx_cd_id_cd_artwor ON cd_artwork (cd_id);
+
+--
 -- Table: bookmark
 --
 CREATE TABLE bookmark (
@@ -57,11 +67,13 @@
   artist integer NOT NULL,
   title varchar(100) NOT NULL,
   year varchar(100) NOT NULL,
-  genreid integer
+  genreid integer,
+  single_track integer
 );
 
 CREATE INDEX cd_idx_artist_cd ON cd (artist);
 CREATE INDEX cd_idx_genreid_cd ON cd (genreid);
+CREATE INDEX cd_idx_single_track_cd ON cd (single_track);
 CREATE UNIQUE INDEX cd_artist_title_cd ON cd (artist, title);
 
 --
@@ -118,7 +130,7 @@
   created_on timestamp NOT NULL,
   varchar_date varchar(20),
   varchar_datetime varchar(20),
-  skip_inflation datetime(20)
+  skip_inflation datetime
 );
 
 
@@ -182,6 +194,18 @@
 CREATE UNIQUE INDEX genre_name_genre ON genre (name);
 
 --
+-- Table: images
+--
+CREATE TABLE images (
+  id INTEGER PRIMARY KEY NOT NULL,
+  artwork_id integer NOT NULL,
+  name varchar(100) NOT NULL,
+  data blob
+);
+
+CREATE INDEX images_idx_artwork_id_images ON images (artwork_id);
+
+--
 -- Table: liner_notes
 --
 CREATE TABLE liner_notes (
@@ -189,6 +213,7 @@
   notes varchar(100) NOT NULL
 );
 
+CREATE INDEX liner_notes_idx_liner_id_liner ON liner_notes (liner_id);
 
 --
 -- Table: link
@@ -201,6 +226,27 @@
 
 
 --
+-- Table: lyric_versions
+--
+CREATE TABLE lyric_versions (
+  id INTEGER PRIMARY KEY NOT NULL,
+  lyric_id integer NOT NULL,
+  text varchar(100) NOT NULL
+);
+
+CREATE INDEX lyric_versions_idx_lyric_id_ly ON lyric_versions (lyric_id);
+
+--
+-- Table: lyrics
+--
+CREATE TABLE lyrics (
+  lyric_id INTEGER PRIMARY KEY NOT NULL,
+  track_id integer NOT NULL
+);
+
+CREATE INDEX lyrics_idx_track_id_lyrics ON lyrics (track_id);
+
+--
 -- Table: noprimarykey
 --
 CREATE TABLE noprimarykey (

Modified: DBIx-Class/0.08/branches/views_support/t/testlib/MyBase.pm
===================================================================
--- DBIx-Class/0.08/branches/views_support/t/testlib/MyBase.pm	2008-11-22 00:06:46 UTC (rev 5177)
+++ DBIx-Class/0.08/branches/views_support/t/testlib/MyBase.pm	2008-11-22 18:56:26 UTC (rev 5178)
@@ -8,7 +8,8 @@
 
 use vars qw/$dbh/;
 
-my @connect = ("dbi:mysql:test", "", "");
+# temporary, might get switched to the new test framework someday
+my @connect = ("dbi:mysql:test", "", "", { PrintError => 0});
 
 $dbh = DBI->connect(@connect) or die DBI->errstr;
 my @table;




More information about the Bast-commits mailing list