[Bast-commits] r8345 - in DBIx-Class/0.08/branches/dbicadmin_refactor: . examples/Schema/MyDatabase/Main/Result lib/DBIx lib/DBIx/Class lib/DBIx/Class/InflateColumn lib/DBIx/Class/Manual lib/DBIx/Class/PK lib/DBIx/Class/Relationship lib/DBIx/Class/ResultSource lib/DBIx/Class/SQLAHacks lib/DBIx/Class/Schema lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/ADO lib/DBIx/Class/Storage/DBI/ODBC lib/DBIx/Class/Storage/DBI/Oracle lib/DBIx/Class/Storage/DBI/Replicated lib/DBIx/Class/Storage/DBI/Sybase lib/SQL/Translator/Parser/DBIx t t/count t/inflate t/lib t/lib/DBICNSTest/Bogus t/lib/DBICNSTest/OtherRslt t/lib/DBICNSTest/Result t/lib/DBICNSTest/Rslt t/lib/DBICNSTest/RtBug41083/Schema t/lib/DBICNSTest/RtBug41083/Schema_A t/lib/DBICTest t/lib/DBICTest/ResultSetManager t/lib/DBICTest/Schema t/prefetch t/relationship t/resultset t/schema t/search t/sqlahacks t/sqlahacks/limit_dialects t/sqlahacks/quotes t/sqlahacks/sql_maker

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun Jan 17 16:20:32 GMT 2010


Author: ribasushi
Date: 2010-01-17 16:20:32 +0000 (Sun, 17 Jan 2010)
New Revision: 8345

Added:
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/resultset/nulls_only.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/anon.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/clone.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/search/related_strip_prefetch.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/limit_dialects/
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/limit_dialects/toplimit.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes_newstyle.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker_quote.t
Removed:
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes_newstyle.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/42toplimit.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker_quote.t
Modified:
   DBIx-Class/0.08/branches/dbicadmin_refactor/
   DBIx-Class/0.08/branches/dbicadmin_refactor/Changes
   DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL
   DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Artist.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Cd.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Track.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Componentised.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Core.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/DateTime.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/File.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Component.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Cookbook.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Example.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Intro.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Joining.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Troubleshooting.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/PK/Auto.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship/HasOne.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSet.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSetColumn.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource/View.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSourceProxy.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks/MSSQL.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema/Versioned.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/DB2.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Pg.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Introduction.pod
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/SQLite.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/mysql.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/UTF8Columns.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/SQL/Translator/Parser/DBIx/Class.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/20setuperrors.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threads.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threadtxn.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/52cycle.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/60core.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/71mysql.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/72pg.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/73oracle.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/746mssql.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/747mssql_ado.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/74mssql.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/85utf8.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/86might_have.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/86sqlt.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/88result_set_column.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/99dbic_sqlt_parser.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/count/prefetch.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/core.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/hri.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/A.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/B.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/OtherRslt/D.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/A.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/B.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/A.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/B.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema/Foo.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/BaseResult.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/ResultSetManager/Foo.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/Schema/Artist.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionNew.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionOrig.pm
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/double_prefetch.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/via_search_related.t
   DBIx-Class/0.08/branches/dbicadmin_refactor/t/relationship/core.t
Log:
 r8007 at Thesaurus (orig r7995):  castaway | 2009-11-30 16:20:19 +0100
 Remove over-emphasis on +select/+as. Add docs on prefetch and other ways to get related data, with caveats etc. 
 
 r8009 at Thesaurus (orig r7997):  dew | 2009-11-30 19:37:00 +0100
 Alter the docs for has_many relationships to make them a little easier to grok
 r8021 at Thesaurus (orig r8009):  castaway | 2009-12-02 14:19:40 +0100
 Added note about prefetch and has_many related objects
 
 r8029 at Thesaurus (orig r8017):  ribasushi | 2009-12-03 13:24:04 +0100
 Source sanity check on subqueried update/delete
 r8030 at Thesaurus (orig r8018):  ribasushi | 2009-12-03 14:39:37 +0100
 Sanify populate arg handling
 r8040 at Thesaurus (orig r8028):  ribasushi | 2009-12-04 02:46:20 +0100
  r7935 at Thesaurus (orig r7923):  ribasushi | 2009-11-19 11:05:04 +0100
  Branches for RTs
  r7965 at Thesaurus (orig r7953):  ribasushi | 2009-11-26 00:19:21 +0100
  Test and fix scalarref in an inflatable slot corner-case
  r7966 at Thesaurus (orig r7954):  ribasushi | 2009-11-26 00:24:23 +0100
  Looks like we nailed a todo
  r8038 at Thesaurus (orig r8026):  ribasushi | 2009-12-04 02:45:40 +0100
  Changes
  r8039 at Thesaurus (orig r8027):  ribasushi | 2009-12-04 02:46:08 +0100
  Changes(2)
 
 r8055 at Thesaurus (orig r8043):  ribasushi | 2009-12-07 15:11:25 +0100
 Forgotten auto-savepoint example patch
 r8057 at Thesaurus (orig r8045):  ribasushi | 2009-12-08 14:13:38 +0100
 Weird test case
 r8058 at Thesaurus (orig r8046):  ribasushi | 2009-12-08 14:23:31 +0100
 Fix the test - code is correct
 r8063 at Thesaurus (orig r8051):  ribasushi | 2009-12-09 02:33:30 +0100
 It's almost 2010 - load_components ('Core') is like ewwww
 r8067 at Thesaurus (orig r8055):  caelum | 2009-12-09 18:13:33 +0100
 workaround for evil ADO bug
 r8068 at Thesaurus (orig r8056):  ribasushi | 2009-12-09 23:13:59 +0100
  r8022 at Thesaurus (orig r8010):  frew | 2009-12-02 17:57:17 +0100
  branch for replacing TOP with RNO in MSSQL
  r8027 at Thesaurus (orig r8015):  frew | 2009-12-03 02:48:36 +0100
  Switch to RowNumberOver for MSSQL
  r8028 at Thesaurus (orig r8016):  ribasushi | 2009-12-03 10:03:18 +0100
  The correct top100 mssql solution and test
  r8031 at Thesaurus (orig r8019):  frew | 2009-12-03 15:56:35 +0100
  fix RNO for MSSQL to not use a kludgy regexp
  r8032 at Thesaurus (orig r8020):  frew | 2009-12-04 01:33:28 +0100
  initial (broken) version of 42rno.t
  r8033 at Thesaurus (orig r8021):  frew | 2009-12-04 01:37:06 +0100
  first shot at moving stuff around
  r8034 at Thesaurus (orig r8022):  frew | 2009-12-04 01:45:42 +0100
  rename files to get rid of numbers and use folders
  r8035 at Thesaurus (orig r8023):  frew | 2009-12-04 01:48:00 +0100
  missed toplimit
  r8036 at Thesaurus (orig r8024):  frew | 2009-12-04 01:52:44 +0100
  still broken rno test, but now it actually tests mssql
  r8042 at Thesaurus (orig r8030):  ribasushi | 2009-12-04 09:34:56 +0100
  Variable clash
  r8043 at Thesaurus (orig r8031):  ribasushi | 2009-12-04 11:44:47 +0100
  The complex prefetch rewrite actually takes care of this as cleanly as possible
  r8044 at Thesaurus (orig r8032):  ribasushi | 2009-12-04 11:47:22 +0100
  Smarter implementation of the select top 100pct subselect handling
  r8045 at Thesaurus (orig r8033):  ribasushi | 2009-12-04 12:07:05 +0100
  Add support for unordered limited resultsets
  Rename the limit helper to signify it is MS specific
  Make sure we don't lose group_by/having clauses
  r8046 at Thesaurus (orig r8034):  ribasushi | 2009-12-04 12:07:56 +0100
  Un-todoify mssql limit tests - no changes necessary (throw away the obsolete generated sql checks)
  r8047 at Thesaurus (orig r8035):  ribasushi | 2009-12-04 12:24:13 +0100
  Tests for bindvar propagation and Changes
  r8049 at Thesaurus (orig r8037):  ribasushi | 2009-12-04 15:01:32 +0100
  KISS - a select(1) makes perfect ordering criteria
  r8050 at Thesaurus (orig r8038):  ribasushi | 2009-12-04 15:06:11 +0100
  Unify the MSSQL and DB2 RNO implementations - they are the same
  r8051 at Thesaurus (orig r8039):  ribasushi | 2009-12-05 10:29:50 +0100
  Wrap mssql selects in yet another subquery to make limited right-ordered join resultsets possible
  r8052 at Thesaurus (orig r8040):  ribasushi | 2009-12-05 10:46:41 +0100
  Better not touch Top - it's too complex at this point
  r8053 at Thesaurus (orig r8041):  ribasushi | 2009-12-05 11:03:00 +0100
  Extend test just a bit more
  r8054 at Thesaurus (orig r8042):  ribasushi | 2009-12-05 11:44:25 +0100
  DB2 and MSSQL have different default order syntaxes
  r8056 at Thesaurus (orig r8044):  frew | 2009-12-08 02:10:06 +0100
  add version check for mssql 2005 and greater
  r8059 at Thesaurus (orig r8047):  frew | 2009-12-08 16:15:50 +0100
  real exception instead of die
  r8061 at Thesaurus (orig r8049):  ribasushi | 2009-12-09 00:19:49 +0100
  Test for immediate connection with known storage type
  r8062 at Thesaurus (orig r8050):  frew | 2009-12-09 01:24:45 +0100
  fix mssql version check so it's lazier
  r8064 at Thesaurus (orig r8052):  ribasushi | 2009-12-09 02:40:51 +0100
  Fix comment
  r8066 at Thesaurus (orig r8054):  caelum | 2009-12-09 16:12:56 +0100
  fix _get_mssql_version for ODBC
 
 r8071 at Thesaurus (orig r8059):  frew | 2009-12-10 00:32:55 +0100
 fail nicely if user doesn't have perms for xp_msver
 r8073 at Thesaurus (orig r8061):  ribasushi | 2009-12-10 09:36:21 +0100
 Changes
 r8074 at Thesaurus (orig r8062):  ribasushi | 2009-12-10 09:53:38 +0100
 First half of distinct cleanup
 r8075 at Thesaurus (orig r8063):  frew | 2009-12-10 16:04:37 +0100
 release 0.08115
 r8076 at Thesaurus (orig r8064):  ribasushi | 2009-12-12 12:31:12 +0100
 Even clearer unloaded FK exception
 r8078 at Thesaurus (orig r8066):  ribasushi | 2009-12-12 14:27:18 +0100
 As clear as it gets
 r8141 at Thesaurus (orig r8129):  ovid | 2009-12-16 17:40:50 +0100
 Have has_one/might_have warn if set on nullable columns.
 
 r8143 at Thesaurus (orig r8131):  caelum | 2009-12-17 13:30:10 +0100
 somewhat better fix for ADO
 r8144 at Thesaurus (orig r8132):  caelum | 2009-12-17 13:34:20 +0100
 minor changes
 r8146 at Thesaurus (orig r8134):  caelum | 2009-12-17 17:44:34 +0100
 cleanup source_bind_attributes for ADO
 r8147 at Thesaurus (orig r8135):  caelum | 2009-12-17 18:09:55 +0100
 more types for ADO fix, and documentation
 r8148 at Thesaurus (orig r8136):  abraxxa | 2009-12-17 19:54:55 +0100
 Cookbook POD fix for add_drop_table instead of add_drop_tables
 
 r8158 at Thesaurus (orig r8146):  ribasushi | 2009-12-18 14:55:53 +0100
  r8150 at Thesaurus (orig r8138):  abraxxa | 2009-12-17 23:22:07 +0100
  Views without a view_definition won't be added to the SQL::Translator::Schema by the parser + tests
  
  r8151 at Thesaurus (orig r8139):  abraxxa | 2009-12-17 23:23:33 +0100
  test cleanups
  
  r8153 at Thesaurus (orig r8141):  abraxxa | 2009-12-18 14:34:14 +0100
  throw_exception if view_definition is missing instead of silent skipping + test changes
  
  r8154 at Thesaurus (orig r8142):  abraxxa | 2009-12-18 14:40:32 +0100
  use Test::Exception
  
  r8155 at Thesaurus (orig r8143):  abraxxa | 2009-12-18 14:42:00 +0100
  fixed Changes
  
  r8156 at Thesaurus (orig r8144):  abraxxa | 2009-12-18 14:44:52 +0100
  test cleanups
  
  r8157 at Thesaurus (orig r8145):  ribasushi | 2009-12-18 14:46:26 +0100
  Another bitr
 
 r8160 at Thesaurus (orig r8148):  ribasushi | 2009-12-18 15:04:34 +0100
 Fix no_index entries
 r8162 at Thesaurus (orig r8150):  abraxxa | 2009-12-18 15:59:58 +0100
 Schema POD inprovement for dclone
 
 r8163 at Thesaurus (orig r8151):  abraxxa | 2009-12-18 16:07:27 +0100
 link to DBIx::Class::Row
 
 r8164 at Thesaurus (orig r8152):  abraxxa | 2009-12-18 16:08:56 +0100
 fixed typo in Changes
 
 r8165 at Thesaurus (orig r8153):  abraxxa | 2009-12-18 16:14:47 +0100
 dclone pod take #2
 
 r8169 at Thesaurus (orig r8157):  ribasushi | 2009-12-19 18:47:42 +0100
 detabify
 r8170 at Thesaurus (orig r8158):  ribasushi | 2009-12-19 19:41:42 +0100
 Fix RT52812
 r8171 at Thesaurus (orig r8159):  caelum | 2009-12-23 07:16:29 +0100
 minor POD fixes
 r8175 at Thesaurus (orig r8163):  ribasushi | 2009-12-24 09:59:52 +0100
 Fix deployment_statements context sensitivity regression
 r8176 at Thesaurus (orig r8164):  ribasushi | 2009-12-24 10:13:37 +0100
 Don't call the PK setter if no PK
 r8204 at Thesaurus (orig r8192):  caelum | 2009-12-30 22:58:47 +0100
 bump CAG dep
 r8231 at Thesaurus (orig r8219):  matthewt | 2010-01-02 01:41:12 +0100
 fix typo in variable name
 r8238 at Thesaurus (orig r8226):  rafl | 2010-01-02 18:46:40 +0100
 Merge branch 'native_traits'
 
 * native_traits:
   Port replicated storage from MXAH to native traits.
   Create branch native_traits
 r8244 at Thesaurus (orig r8232):  caelum | 2010-01-04 00:30:51 +0100
 fix _rebless into sybase/mssql/nobindvars
 r8247 at Thesaurus (orig r8235):  caelum | 2010-01-05 13:54:56 +0100
  r22328 at hlagh (orig r8201):  caelum | 2009-12-31 12:29:51 -0500
  new branch to fix table aliases in queries over the 30char limit
  r22329 at hlagh (orig r8202):  caelum | 2009-12-31 12:55:50 -0500
  failing test
  r22330 at hlagh (orig r8203):  caelum | 2009-12-31 13:00:35 -0500
  switch oracle tests to done_testing()
  r22331 at hlagh (orig r8204):  caelum | 2009-12-31 15:02:50 -0500
  got something working
  r22332 at hlagh (orig r8205):  caelum | 2009-12-31 15:08:30 -0500
  POD touchups
  r22343 at hlagh (orig r8216):  caelum | 2010-01-01 07:42:03 -0500
  fix uninitialized warning and a bug in ResultSet
  r22419 at hlagh (orig r8234):  caelum | 2010-01-05 07:53:18 -0500
  append half of a base64 MD5 to shortened table aliases for Oracle
 
 r8249 at Thesaurus (orig r8237):  caelum | 2010-01-05 15:27:40 +0100
 minor change: use more of the hash if possible for oracle table alias shortening
 r8251 at Thesaurus (orig r8239):  caelum | 2010-01-06 02:20:17 +0100
 bump perl_version to 5.8.1
 r8252 at Thesaurus (orig r8240):  caelum | 2010-01-06 02:21:41 +0100
 remove alignment mark on base64 md5
 r8260 at Thesaurus (orig r8248):  ribasushi | 2010-01-07 11:21:55 +0100
 5.8.1 is minimum required perl
 r8261 at Thesaurus (orig r8249):  ribasushi | 2010-01-07 11:22:42 +0100
 Minor optimization
 r8262 at Thesaurus (orig r8250):  ribasushi | 2010-01-07 11:23:35 +0100
 Wrong title
 r8265 at Thesaurus (orig r8253):  ribasushi | 2010-01-08 17:48:50 +0100
 Resolve problem reported by http://lists.scsys.co.uk/pipermail/dbix-class/2009-December/008699.html
 r8266 at Thesaurus (orig r8254):  ribasushi | 2010-01-08 17:52:01 +0100
 Put utf8columns in line with the store_column fix
 r8267 at Thesaurus (orig r8255):  ribasushi | 2010-01-08 19:03:26 +0100
 Tests while hunting for something else
 r8268 at Thesaurus (orig r8256):  ribasushi | 2010-01-08 19:14:42 +0100
 Make test look even more like http://lists.scsys.co.uk/pipermail/dbix-class/2009-November/008599.html
 r8277 at Thesaurus (orig r8265):  ribasushi | 2010-01-09 02:16:14 +0100
  r8263 at Thesaurus (orig r8251):  ribasushi | 2010-01-08 15:43:38 +0100
  New branch to find a leak
  r8264 at Thesaurus (orig r8252):  ribasushi | 2010-01-08 15:52:46 +0100
  Weird test failures
  r8272 at Thesaurus (orig r8260):  ribasushi | 2010-01-09 01:24:56 +0100
  Proper invocation
  r8273 at Thesaurus (orig r8261):  ribasushi | 2010-01-09 01:35:34 +0100
  Test for the real leak reason
  r8274 at Thesaurus (orig r8262):  ribasushi | 2010-01-09 01:37:33 +0100
  Void ctx as it should be
  r8275 at Thesaurus (orig r8263):  ribasushi | 2010-01-09 02:10:13 +0100
  A "fix" for sqlt-related schema leaks
  r8276 at Thesaurus (orig r8264):  ribasushi | 2010-01-09 02:15:53 +0100
  Changes
 
 r8287 at Thesaurus (orig r8275):  caelum | 2010-01-10 11:29:06 +0100
  r22483 at hlagh (orig r8272):  caelum | 2010-01-09 05:52:15 -0500
  new branch to add "normalize_connect_info" class method to Storage::DBI
  r22495 at hlagh (orig r8274):  caelum | 2010-01-10 05:27:42 -0500
  split connect_info parser out into private _normalize_connect_info
 
 r8289 at Thesaurus (orig r8277):  caelum | 2010-01-10 12:04:52 +0100
 fix connection details in ::DBI::Replicated docs
 r8291 at Thesaurus (orig r8279):  ribasushi | 2010-01-11 09:50:21 +0100
  r8077 at Thesaurus (orig r8065):  ribasushi | 2009-12-12 14:24:30 +0100
  Branch for yet another mssql ordered prefetch problem
  r8079 at Thesaurus (orig r8067):  ribasushi | 2009-12-12 14:37:48 +0100
  prefetch does not get disassembled properly
  r8112 at Thesaurus (orig r8100):  ribasushi | 2009-12-13 00:07:00 +0100
  Extra test to highlight search_related inefficiency
  r8113 at Thesaurus (orig r8101):  ribasushi | 2009-12-13 00:17:44 +0100
  Real test for search_related and prefetch
  r8114 at Thesaurus (orig r8102):  ribasushi | 2009-12-13 00:19:57 +0100
  Fix corner case regression on search_related on a prefetching rs
  r8115 at Thesaurus (orig r8103):  ribasushi | 2009-12-13 00:21:05 +0100
  Isolate prefetch heads using RNO with a subquery
  r8116 at Thesaurus (orig r8104):  ribasushi | 2009-12-13 00:23:46 +0100
  Changes
  r8125 at Thesaurus (orig r8113):  ribasushi | 2009-12-15 13:06:26 +0100
  Extend mssql limited prefetch tests
  r8126 at Thesaurus (orig r8114):  ribasushi | 2009-12-15 13:08:56 +0100
  Add extra test to prove Alan wrong :)
  r8132 at Thesaurus (orig r8120):  ribasushi | 2009-12-16 00:38:04 +0100
  Do not realias tables in the RNO subqueries
  r8133 at Thesaurus (orig r8121):  ribasushi | 2009-12-16 00:50:52 +0100
  Deliberately disturb alphabetical order
  r8134 at Thesaurus (orig r8122):  ribasushi | 2009-12-16 10:26:43 +0100
  Got a failing test
  r8135 at Thesaurus (orig r8123):  ribasushi | 2009-12-16 10:49:10 +0100
  Cleanup
  r8136 at Thesaurus (orig r8124):  ribasushi | 2009-12-16 10:51:58 +0100
  More moving around
  r8137 at Thesaurus (orig r8125):  ribasushi | 2009-12-16 11:25:37 +0100
  The real mssql problem - it's... bad
  r8138 at Thesaurus (orig r8126):  ribasushi | 2009-12-16 11:29:20 +0100
  Clearer debug
  r8139 at Thesaurus (orig r8127):  ribasushi | 2009-12-16 11:47:48 +0100
  This is horrific but the tests pass... maybe someone will figure out something better
  r8140 at Thesaurus (orig r8128):  ribasushi | 2009-12-16 16:45:47 +0100
  cleanup tests
  r8187 at Thesaurus (orig r8175):  ribasushi | 2009-12-24 16:22:30 +0100
  Ordered subqueries do not work in mssql after all
  r8271 at Thesaurus (orig r8259):  ribasushi | 2010-01-08 23:58:13 +0100
  Cleaner RNO sql
  r8279 at Thesaurus (orig r8267):  ribasushi | 2010-01-09 10:13:16 +0100
  Subqueries no longer experimental
  r8280 at Thesaurus (orig r8268):  ribasushi | 2010-01-09 11:26:46 +0100
  Close the book on mssql ordered subqueries
  r8281 at Thesaurus (orig r8269):  ribasushi | 2010-01-09 11:36:36 +0100
  Changes and typos
  r8283 at Thesaurus (orig r8271):  ribasushi | 2010-01-09 11:42:21 +0100
  Highlight the real problem
  r8285 at Thesaurus (orig r8273):  ribasushi | 2010-01-10 10:07:10 +0100
  Rename subquery to subselect and rewrite POD (per castaway)
  r8290 at Thesaurus (orig r8278):  ribasushi | 2010-01-10 17:01:24 +0100
  rename as per mst
 
 r8295 at Thesaurus (orig r8283):  caelum | 2010-01-11 23:42:30 +0100
 make a public ::Schema::unregister_source
 r8298 at Thesaurus (orig r8286):  abraxxa | 2010-01-12 18:04:18 +0100
 fixed a typo in Changes
 more detailed explanation for the warning about has_one/might_have rels on nullable columns
 
 r8307 at Thesaurus (orig r8295):  abraxxa | 2010-01-13 17:28:05 +0100
 added the sources parser arg to the example code
 
 r8327 at Thesaurus (orig r8315):  ribasushi | 2010-01-15 01:25:39 +0100
  r8167 at Thesaurus (orig r8155):  ribasushi | 2009-12-19 12:50:13 +0100
  New branch for null-only-result fix
  r8168 at Thesaurus (orig r8156):  ribasushi | 2009-12-19 12:51:21 +0100
  Failing test
  r8322 at Thesaurus (orig r8310):  ribasushi | 2010-01-15 00:48:09 +0100
  Correct test order
  r8323 at Thesaurus (orig r8311):  ribasushi | 2010-01-15 01:15:33 +0100
  Generalize the to-node inner-join-er to apply to all related_resultset calls, not just counts
  r8324 at Thesaurus (orig r8312):  ribasushi | 2010-01-15 01:16:05 +0100
  Adjust sql-emitter tests
  r8326 at Thesaurus (orig r8314):  ribasushi | 2010-01-15 01:25:10 +0100
  One more sql-test fix and changes
 
 r8328 at Thesaurus (orig r8316):  ribasushi | 2010-01-15 01:31:58 +0100
 Strict mysql bugfix
 r8329 at Thesaurus (orig r8317):  ribasushi | 2010-01-15 01:38:53 +0100
 Better description of mysql strict option
 r8331 at Thesaurus (orig r8319):  ribasushi | 2010-01-15 03:12:13 +0100
 Update troubleshooting doc
 r8337 at Thesaurus (orig r8325):  ribasushi | 2010-01-15 17:13:28 +0100
 RT52674
 r8346 at Thesaurus (orig r8334):  ribasushi | 2010-01-17 09:41:49 +0100
 No method aliasing in OO code, *ever*



Property changes on: DBIx-Class/0.08/branches/dbicadmin_refactor
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/cookbook_fixes:7657
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/prefetch_bug-unqualified_column_in_search_related_cond:7959
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/void_populate_resultset_cond:7935
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:7982
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11788
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/table_name_ref:7266
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/ado_mssql:7886
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/autocast:7418
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/connect_info_hash:7435
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cookbook_fixes:7479
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_rs:6741
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/discard_changes_replication_fix:7252
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/get_inflated_columns_rt46953:7964
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/grouped_has_many_join:7382
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/grouped_prefetch:6885
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/is_resultset_paginated:7769
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mc_fixes:6645
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_money_type:7096
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_storage_minor_refactor:7210
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_top_fixes:6971
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multicreate_fixes:7275
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mysql_ansi:7175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mystery_join:6589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/new_replication_transaction_fixup:7058
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_connect_call:6854
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle-tweaks:6222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/order_by_refactor:6475
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/pg_unqualified_schema:7842
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch-group_by:7917
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_bug-unqualified_column_in_search_related_cond:7900
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_limit:6724
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_redux:7206
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/reduce_pings:7261
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rsrc_in_storage:6577
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/search_related_prefetch:6818
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-tweaks:6262
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/syb_connected:6919
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:7682
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_bulk_insert:7679
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_bulkinsert_support:7796
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_refactor:7940
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_support:7797
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/table_name_ref:7132
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/top_limit_altfix:6429
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/type_aware_update:6619
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/unresolvable_prefetch:6949
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/view_rels:7908
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/void_populate_resultset_cond:7944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/tags/0.08108_prerelease_please_do_not_pull_into_it:7008
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/tags/pre_0.08109_please_do_not_merge:7336
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/cookbook_fixes:7657
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/prefetch_bug-unqualified_column_in_search_related_cond:7959
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/void_populate_resultset_cond:7935
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:7982
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11788
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/table_name_ref:7266
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/ado_mssql:7886
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/autocast:7418
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/connect_info_hash:7435
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/connected_schema_leak:8264
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cookbook_fixes:7479
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_rs:6741
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/create_scalarref_rt51559:8027
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/discard_changes_replication_fix:7252
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/get_inflated_columns_rt46953:7964
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/grouped_has_many_join:7382
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/grouped_prefetch:6885
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/is_resultset_paginated:7769
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mc_fixes:6645
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_limit_regression:8278
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_money_type:7096
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_rno_pagination:8054
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_storage_minor_refactor:7210
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mssql_top_fixes:6971
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multicreate_fixes:7275
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mysql_ansi:7175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/mystery_join:6589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/new_replication_transaction_fixup:7058
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/normalize_connect_info:8274
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/null_column_regression:8314
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_connect_call:6854
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle-tweaks:6222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_shorten_aliases:8234
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/order_by_refactor:6475
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/pg_unqualified_schema:7842
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch-group_by:7917
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_bug-unqualified_column_in_search_related_cond:7900
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_limit:6724
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch_redux:7206
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/reduce_pings:7261
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rsrc_in_storage:6577
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/search_related_prefetch:6818
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqlt_parser_view:8145
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-tweaks:6262
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/syb_connected:6919
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:7682
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_bulk_insert:7679
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_bulkinsert_support:7796
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_refactor:7940
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_support:7797
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/table_name_ref:7132
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/top_limit_altfix:6429
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/type_aware_update:6619
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/unresolvable_prefetch:6949
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/view_rels:7908
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/void_populate_resultset_cond:7944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/tags/0.08108_prerelease_please_do_not_pull_into_it:7008
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/tags/pre_0.08109_please_do_not_merge:7336
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:8334
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/dbicadmin_refactor/Changes
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/Changes	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/Changes	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,15 +1,45 @@
 Revision history for DBIx::Class
 
+        - Perl 5.8.1 is now the minimum supported version
+        - Subqueries no longer marked experimental
+        - might_have/has_one now warn if applied calling class's column
+          has is_nullable set to true.
+        - Fixed regression in deploy() with a {sources} table limit applied
+          (RT#52812)
+        - Cookbook POD fix for add_drop_table instead of add_drop_tables
+        - Views without a view_definition will throw an exception when
+          parsed by SQL::Translator::Parser::DBIx::Class
+        - Schema POD improvement for dclone
+        - Fix regression in context sensitiveness of deployment_statements
+        - Fix regression resulting in overcomplicated query on
+          search_related from prefetching resultsets
+        - Fix regression on all-null returning searches (properly switch
+          LEFT JOIN to JOIN in order to distinguish between both cases)
+        - Fix regression in groupedresultset count() used on strict-mode
+          MySQL connections
+        - Better isolation of RNO-limited queries from the rest of a
+          prefetching resultset
+        - New MSSQL specific resultset attribute to allow hacky ordered
+          subquery support
+        - Fix nasty schema/dbhandle leak due to SQL::Translator
+
+0.08115 2009-12-10 09:02:00 (CST)
+        - Real limit/offset support for MSSQL server (via Row_Number)
         - Fix distinct => 1 with non-selecting order_by (the columns
           in order_by also need to be aded to the resulting group_by)
         - Do not attempt to deploy FK constraints pointing to a View
-        - Refactored Sybase storage driver into a central ::DBI::Sybase
-          dispatcher, and a sybase-specific ::DBI::Sybase::ASE
+        - Fix count/objects from search_related on limited resultset
+        - Stop propagating distinct => 1 over search_related chains
         - Make sure populate() inherits the resultset conditions just
           like create() does
-        - Fix count/objects from search_related on limited resultset
         - Make get_inflated_columns behave identically to get_columns
           wrt +select/+as (RT#46953)
+        - Fix problems with scalarrefs under InflateColumn (RT#51559)
+        - Throw exception on delete/update of PK-less resultsets
+        - Refactored Sybase storage driver into a central ::DBI::Sybase
+          dispatcher, and a sybase-specific ::DBI::Sybase::ASE
+        - Fixed an atrocious DBD::ADO bind-value bug
+        - Cookbook/Intro POD improvements
 
 0.08114 2009-11-14 17:45:00 (UTC)
         - Preliminary support for MSSQL via DBD::ADO

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL	2010-01-17 16:20:32 UTC (rev 8345)
@@ -3,12 +3,12 @@
 use warnings;
 use POSIX ();
 
-use 5.006001; # delete this line if you want to send patches for earlier.
+use 5.008001;
 
 # ****** DO NOT ADD OPTIONAL DEPENDENCIES. EVER. --mst ******
 
 name     'DBIx-Class';
-perl_version '5.006001';
+perl_version '5.008001';
 all_from 'lib/DBIx/Class.pm';
 
 
@@ -28,17 +28,14 @@
 requires 'Scalar::Util'             => '0';
 requires 'Storable'                 => '0';
 
-# Perl 5.8.0 doesn't have utf8::is_utf8()
-requires 'Encode'                   => '0' if ($] <= 5.008000);
-
 # Dependencies (keep in alphabetical order)
 requires 'Carp::Clan'               => '6.0';
-requires 'Class::Accessor::Grouped' => '0.09000';
+requires 'Class::Accessor::Grouped' => '0.09002';
 requires 'Class::C3::Componentised' => '1.0005';
 requires 'Class::Inspector'         => '1.24';
 requires 'Data::Page'               => '2.00';
 requires 'DBD::SQLite'              => '1.25';
-requires 'DBI'                      => '1.605';
+requires 'DBI'                      => '1.609';
 requires 'JSON::Any'                => '1.18';
 requires 'MRO::Compat'              => '0.09';
 requires 'Module::Find'             => '0.06';
@@ -50,8 +47,7 @@
 requires 'Data::Dumper::Concise'    => '1.000';
 
 my %replication_requires = (
-  'Moose',                    => '0.87',
-  'MooseX::AttributeHelpers'  => '0.21',
+  'Moose',                    => '0.90',
   'MooseX::Types',            => '0.16',
   'namespace::clean'          => '0.11',
   'Hash::Merge',              => '0.11',
@@ -156,17 +152,15 @@
 resources 'repository'  => 'http://dev.catalyst.perl.org/repos/bast/DBIx-Class/';
 resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
 
-no_index 'DBIx::Class::SQLAHacks';
-no_index 'DBIx::Class::SQLAHacks::MSSQL';
-no_index 'DBIx::Class::SQLAHacks::OracleJoins';
-no_index 'DBIx::Class::Storage::DBI::AmbiguousGlob';
-no_index 'DBIx::Class::Storage::DBIHacks';
-no_index 'DBIx::Class::PK::Auto::DB2';
-no_index 'DBIx::Class::PK::Auto::MSSQL';
-no_index 'DBIx::Class::PK::Auto::MySQL';
-no_index 'DBIx::Class::PK::Auto::Oracle';
-no_index 'DBIx::Class::PK::Auto::Pg';
-no_index 'DBIx::Class::PK::Auto::SQLite';
+# Deprecated/internal modules need no exposure
+no_index directory => $_ for (qw|
+  lib/DBIx/Class/SQLAHacks
+  lib/DBIx/Class/PK/Auto 
+|);
+no_index package => $_ for (qw/
+  DBIx::Class::Storage::DBI::AmbiguousGlob
+  DBIx::Class::SQLAHacks DBIx::Class::Storage::DBIHacks
+/);
 
 # re-build README and require extra modules for testing if we're in a checkout
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Artist.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Artist.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,9 +1,16 @@
 package MyDatabase::Main::Result::Artist;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+
+use warnings;
+use strict;
+
+use base qw/DBIx::Class::Core/;
+
 __PACKAGE__->table('artist');
+
 __PACKAGE__->add_columns(qw/ artistid name /);
+
 __PACKAGE__->set_primary_key('artistid');
+
 __PACKAGE__->has_many('cds' => 'MyDatabase::Main::Result::Cd');
 
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Cd.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Cd.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Cd.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,9 +1,16 @@
 package MyDatabase::Main::Result::Cd;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+
+use warnings;
+use strict;
+
+use base qw/DBIx::Class::Core/;
+
 __PACKAGE__->table('cd');
+
 __PACKAGE__->add_columns(qw/ cdid artist title/);
+
 __PACKAGE__->set_primary_key('cdid');
+
 __PACKAGE__->belongs_to('artist' => 'MyDatabase::Main::Result::Artist');
 __PACKAGE__->has_many('tracks' => 'MyDatabase::Main::Result::Track');
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Track.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Track.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/examples/Schema/MyDatabase/Main/Result/Track.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,9 +1,16 @@
 package MyDatabase::Main::Result::Track;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+
+use warnings;
+use strict;
+
+use base qw/DBIx::Class::Core/;
+
 __PACKAGE__->table('track');
+
 __PACKAGE__->add_columns(qw/ trackid cd title/);
+
 __PACKAGE__->set_primary_key('trackid');
+
 __PACKAGE__->belongs_to('cd' => 'MyDatabase::Main::Result::Cd');
 
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Componentised.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Componentised.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Componentised.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -4,10 +4,34 @@
 use strict;
 use warnings;
 
-###
-# Keep this class for backwards compatibility
-###
-
 use base 'Class::C3::Componentised';
+use Carp::Clan qw/^DBIx::Class|^Class::C3::Componentised/;
+use mro 'c3';
 
+# this warns of subtle bugs introduced by UTF8Columns hacky handling of store_column
+sub inject_base {
+  my $class = shift;
+  my $target = shift;
+
+  my @present_components = (@{mro::get_linear_isa ($target)||[]});
+
+  no strict 'refs';
+  for my $comp (reverse @_) {
+    if (
+      $comp->isa ('DBIx::Class::UTF8Columns')
+        and
+      my @broken = grep { $_ ne 'DBIx::Class::Row' and defined ${"${_}::"}{store_column} } (@present_components)
+    ) {
+      carp "Incorrect loading order of $comp by ${target} will affect other components overriding store_column ("
+          . join (', ', @broken)
+          .'). Refer to the documentation of DBIx::Class::UTF8Columns for more info';
+    }
+    else {
+      unshift @present_components, $comp;
+    }
+  }
+
+  $class->next::method($target, @_);
+}
+
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Core.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Core.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Core.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -22,8 +22,8 @@
 
 =head1 SYNOPSIS
 
-  # In your table classes
-  __PACKAGE__->load_components(qw/Core/);
+  # In your result (table) classes
+  use base 'DBIx::Class::Core';
 
 =head1 DESCRIPTION
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/DateTime.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/DateTime.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -15,15 +15,14 @@
 columns to be of the datetime, timestamp or date datatype.
 
   package Event;
-  __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
+  use base 'DBIx::Class::Core';
+
+  __PACKAGE__->load_components(qw/InflateColumn::DateTime/);
   __PACKAGE__->add_columns(
     starts_when => { data_type => 'datetime' }
     create_date => { data_type => 'date' }
   );
 
-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/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/File.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/File.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn/File.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -113,8 +113,10 @@
 
 In your L<DBIx::Class> table class:
 
-    __PACKAGE__->load_components( "PK::Auto", "InflateColumn::File", "Core" );
+    use base 'DBIx::Class::Core';
 
+    __PACKAGE__->load_components(qw/InflateColumn::File/);
+
     # define your columns
     __PACKAGE__->add_columns(
         "id",

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/InflateColumn.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -124,8 +124,11 @@
     unless exists $self->column_info($col)->{_inflate_info};
   return $self->{_inflated_column}{$col}
     if exists $self->{_inflated_column}{$col};
-  return $self->{_inflated_column}{$col} =
-           $self->_inflated_column($col, $self->get_column($col));
+
+  my $val = $self->get_column($col);
+  return $val if ref $val eq 'SCALAR';  #that would be a not-yet-reloaded sclarref update
+
+  return $self->{_inflated_column}{$col} = $self->_inflated_column($col, $val);
 }
 
 =head2 set_inflated_column
@@ -175,7 +178,7 @@
 =over 4
 
 =item L<DBIx::Class::Core> - This component is loaded as part of the
-      "core" L<DBIx::Class> components; generally there is no need to
+      C<core> L<DBIx::Class> components; generally there is no need to
       load it directly
 
 =back

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Component.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Component.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Component.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -12,31 +12,29 @@
 
 =head1 USING
 
-Components are loaded using the load_components() method within your 
+Components are loaded using the load_components() method within your
 DBIx::Class classes.
 
   package My::Thing;
-  use base qw( DBIx::Class );
-  __PACKAGE__->load_components(qw/ PK::Auto Core /);
+  use base qw( DBIx::Class::Core );
+  __PACKAGE__->load_components(qw/InflateColumn::DateTime TimeStamp/);
 
-Generally you do not want to specify the full package name 
-of a component, instead take off the DBIx::Class:: part of 
-it and just include the rest.  If you do want to load a 
-component outside of the normal namespace you can do so 
+Generally you do not want to specify the full package name
+of a component, instead take off the DBIx::Class:: part of
+it and just include the rest.  If you do want to load a
+component outside of the normal namespace you can do so
 by prepending the component name with a +.
 
   __PACKAGE__->load_components(qw/ +My::Component /);
 
-Once a component is loaded all of it's methods, or otherwise, 
+Once a component is loaded all of it's methods, or otherwise,
 that it provides will be available in your class.
 
-The order in which is you load the components may be 
-very important, depending on the component.  The general 
-rule of thumb is to first load extra components and then 
-load core ones last.  If you are not sure, then read the 
-docs for the components you are using and see if they 
-mention anything about the order in which you should load 
-them.
+The order in which is you load the components may be very
+important, depending on the component. If you are not sure,
+then read the docs for the components you are using and see
+if they mention anything about the order in which you should
+load them.
 
 =head1 CREATING COMPONENTS
 
@@ -47,11 +45,11 @@
   # Create methods, accessors, load other components, etc.
   1;
 
-When a component is loaded it is included in the calling 
-class' inheritance chain using L<Class::C3>.  As well as 
-providing custom utility methods, a component may also 
-override methods provided by other core components, like 
-L<DBIx::Class::Row> and others.  For example, you 
+When a component is loaded it is included in the calling
+class' inheritance chain using L<Class::C3>.  As well as
+providing custom utility methods, a component may also
+override methods provided by other core components, like
+L<DBIx::Class::Row> and others.  For example, you
 could override the insert and delete methods.
 
   sub insert {
@@ -108,22 +106,22 @@
 
 =head2 Experimental
 
-These components are under development, there interfaces may 
-change, they may not work, etc.  So, use them if you want, but 
+These components are under development, there interfaces may
+change, they may not work, etc.  So, use them if you want, but
 be warned.
 
 L<DBIx::Class::Validation> - Validate all data before submitting to your database.
 
 =head2 Core
 
-These are the components that all, or nearly all, people will use 
-without even knowing it.  These components provide most of 
+These are the components that all, or nearly all, people will use
+without even knowing it.  These components provide most of
 DBIx::Class' functionality.
 
-L<DBIx::Class::AccessorGroup> - Lets you build groups of accessors.
-
 L<DBIx::Class::Core> - Loads various components that "most people" would want.
 
+L<DBIx::Class::AccessorGroup> - Lets you build groups of accessors.
+
 L<DBIx::Class::DB> - Non-recommended classdata schema component.
 
 L<DBIx::Class::InflateColumn> - Automatically create objects from column data.

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Cookbook.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Cookbook.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -113,9 +113,8 @@
   package My::Schema::Result::UserFriendsComplex;
   use strict;
   use warnings;
-  use base qw/DBIx::Class/;
+  use base qw/DBIx::Class::Core/;
 
-  __PACKAGE__->load_components('Core');
   __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 
   # ->table, ->add_columns, etc.
@@ -318,7 +317,7 @@
 are in any way unsure about the use of the attributes above (C< join
 >, C< select >, C< as > and C< group_by >).
 
-=head2 Subqueries (EXPERIMENTAL)
+=head2 Subqueries
 
 You can write subqueries relatively easily in DBIC.
 
@@ -366,10 +365,6 @@
        WHERE artist_id = me.artist_id
       )
 
-=head3 EXPERIMENTAL
-
-Please note that subqueries are considered an experimental feature.
-
 =head2 Predefined searches
 
 You can write your own L<DBIx::Class::ResultSet> class by inheriting from it
@@ -391,11 +386,16 @@
 
   1;
 
-To use your resultset, first tell DBIx::Class to create an instance of it
-for you, in your My::DBIC::Schema::CD class:
+If you're using L<DBIx::Class::Schema/load_namespaces>, simply place the file
+into the C<ResultSet> directory next to your C<Result> directory, and it will
+be automatically loaded.
 
+If however you are still using L<DBIx::Class::Schema/load_classes>, first tell
+DBIx::Class to create an instance of the ResultSet class for you, in your
+My::DBIC::Schema::CD class:
+
   # class definition as normal
-  __PACKAGE__->load_components(qw/ Core /);
+  use base 'DBIx::Class::Core';
   __PACKAGE__->table('cd');
 
   # tell DBIC to use the custom ResultSet class
@@ -842,13 +842,11 @@
 
     use strict;
     use warnings;
-    use base qw/DBIx::Class/;
+    use base qw/DBIx::Class::Core/;
 
     ### Define what our admin class is, for ensure_class_loaded()
     my $admin_class = __PACKAGE__ . '::Admin';
 
-    __PACKAGE__->load_components(qw/Core/);
-
     __PACKAGE__->table('users');
 
     __PACKAGE__->add_columns(qw/user_id   email    password
@@ -1090,8 +1088,7 @@
 This is straightforward using L<ManyToMany|DBIx::Class::Relationship/many_to_many>:
 
   package My::User;
-  use base 'DBIx::Class';
-  __PACKAGE__->load_components('Core');
+  use base 'DBIx::Class::Core';
   __PACKAGE__->table('user');
   __PACKAGE__->add_columns(qw/id name/);
   __PACKAGE__->set_primary_key('id');
@@ -1099,8 +1096,7 @@
   __PACKAGE__->many_to_many('addresses' => 'user_address', 'address');
 
   package My::UserAddress;
-  use base 'DBIx::Class';
-  __PACKAGE__->load_components('Core');
+  use base 'DBIx::Class::Core';
   __PACKAGE__->table('user_address');
   __PACKAGE__->add_columns(qw/user address/);
   __PACKAGE__->set_primary_key(qw/user address/);
@@ -1108,8 +1104,7 @@
   __PACKAGE__->belongs_to('address' => 'My::Address');
 
   package My::Address;
-  use base 'DBIx::Class';
-  __PACKAGE__->load_components('Core');
+  use base 'DBIx::Class::Core';
   __PACKAGE__->table('address');
   __PACKAGE__->add_columns(qw/id street town area_code country/);
   __PACKAGE__->set_primary_key('id');
@@ -1140,8 +1135,7 @@
 declaration, like so...
 
   package MyDatabase::Main::Artist;
-  use base qw/DBIx::Class/;
-  __PACKAGE__->load_components(qw/PK::Auto Core/);
+  use base qw/DBIx::Class::Core/;
 
   __PACKAGE__->table('database1.artist'); # will use "database1.artist" in FROM clause
 
@@ -1257,10 +1251,102 @@
 Nested transactions will work as expected. That is, only the outermost
 transaction will actually issue a commit to the $dbh, and a rollback
 at any level of any transaction will cause the entire nested
-transaction to fail. Support for savepoints and for true nested
-transactions (for databases that support them) will hopefully be added
-in the future.
+transaction to fail.
+ 
+=head2 Nested transactions and auto-savepoints
 
+If savepoints are supported by your RDBMS, it is possible to achieve true
+nested transactions with minimal effort. To enable auto-savepoints via nested
+transactions, supply the C<< auto_savepoint = 1 >> connection attribute.
+
+Here is an example of true nested transactions. In the example, we start a big
+task which will create several rows. Generation of data for each row is a
+fragile operation and might fail. If we fail creating something, depending on
+the type of failure, we want to abort the whole task, or only skip the failed
+row.
+
+  my $schema = MySchema->connect("dbi:Pg:dbname=my_db");
+
+  # Start a transaction. Every database change from here on will only be 
+  # commited into the database if the eval block succeeds.
+  eval {
+    $schema->txn_do(sub {
+      # SQL: BEGIN WORK;
+
+      my $job = $schema->resultset('Job')->create({ name=> 'big job' });
+      # SQL: INSERT INTO job ( name) VALUES ( 'big job' );
+
+      for (1..10) {
+
+        # Start a nested transaction, which in fact sets a savepoint.
+        eval {
+          $schema->txn_do(sub {
+            # SQL: SAVEPOINT savepoint_0;
+
+            my $thing = $schema->resultset('Thing')->create({ job=>$job->id });
+            # SQL: INSERT INTO thing ( job) VALUES ( 1 );
+
+            if (rand > 0.8) {
+              # This will generate an error, thus setting $@
+
+              $thing->update({force_fail=>'foo'});
+              # SQL: UPDATE thing SET force_fail = 'foo'
+              #      WHERE ( id = 42 );
+            }
+          });
+        };
+        if ($@) {
+          # SQL: ROLLBACK TO SAVEPOINT savepoint_0;
+
+          # There was an error while creating a $thing. Depending on the error
+          # we want to abort the whole transaction, or only rollback the
+          # changes related to the creation of this $thing
+
+          # Abort the whole job
+          if ($@ =~ /horrible_problem/) {
+            print "something horrible happend, aborting job!";
+            die $@;                # rethrow error
+          }
+
+          # Ignore this $thing, report the error, and continue with the
+          # next $thing
+          print "Cannot create thing: $@";
+        }
+        # There was no error, so save all changes since the last 
+        # savepoint.
+
+        # SQL: RELEASE SAVEPOINT savepoint_0;
+      }
+    });
+  };
+  if ($@) {
+    # There was an error while handling the $job. Rollback all changes
+    # since the transaction started, including the already commited
+    # ('released') savepoints. There will be neither a new $job nor any
+    # $thing entry in the database.
+
+    # SQL: ROLLBACK;
+
+    print "ERROR: $@\n";
+  }
+  else {
+    # There was no error while handling the $job. Commit all changes.
+    # Only now other connections can see the newly created $job and
+    # @things.
+
+    # SQL: COMMIT;
+
+    print "Ok\n";
+  }
+
+In this example it might be hard to see where the rollbacks, releases and
+commits are happening, but it works just the same as for plain L<<txn_do>>: If
+the C<eval>-block around C<txn_do> fails, a rollback is issued. If the C<eval>
+succeeds, the transaction is committed (or the savepoint released).
+
+While you can get more fine-grained controll using C<svp_begin>, C<svp_release>
+and C<svp_rollback>, it is strongly recommended to use C<txn_do> with coderefs.
+
 =head1 SQL
 
 =head2 Creating Schemas From An Existing Database
@@ -1296,7 +1382,7 @@
 To create a new database using the schema:
 
  my $schema = My::Schema->connect($dsn);
- $schema->deploy({ add_drop_tables => 1});
+ $schema->deploy({ add_drop_table => 1});
 
 To import created .sql files using the mysql client:
 
@@ -1334,8 +1420,7 @@
   package MyAppDB::Dual;
   use strict;
   use warnings;
-  use base 'DBIx::Class';
-  __PACKAGE__->load_components("Core");
+  use base 'DBIx::Class::Core';
   __PACKAGE__->table("Dual");
   __PACKAGE__->add_columns(
     "dummy",
@@ -1920,15 +2005,15 @@
 
 Typically L<DBIx::Class> result classes start off with
 
-    use base qw/DBIx::Class/;
-    __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
+    use base qw/DBIx::Class::Core/;
+    __PACKAGE__->load_components(qw/InflateColumn::DateTime/);
 
 If this preamble is moved into a common base class:-
 
     package MyDBICbase;
 
-    use base qw/DBIx::Class/;
-    __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
+    use base qw/DBIx::Class::Core/;
+    __PACKAGE__->load_components(qw/InflateColumn::DateTime/);
     1;
 
 and each result class then uses this as a base:-

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Example.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Example.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Example.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -89,8 +89,7 @@
 MyDatabase/Main/Result/Artist.pm:
 
   package MyDatabase::Main::Result::Artist;
-  use base qw/DBIx::Class/;
-  __PACKAGE__->load_components(qw/Core/);
+  use base qw/DBIx::Class::Core/;
   __PACKAGE__->table('artist');
   __PACKAGE__->add_columns(qw/ artistid name /);
   __PACKAGE__->set_primary_key('artistid');
@@ -102,8 +101,8 @@
 MyDatabase/Main/Result/Cd.pm:
 
   package MyDatabase::Main::Result::Cd;
-  use base qw/DBIx::Class/;
-  __PACKAGE__->load_components(qw/Core/);
+  use base qw/DBIx::Class::Core/;
+  __PACKAGE__->load_components(qw/InflateColumn::DateTime/);
   __PACKAGE__->table('cd');
   __PACKAGE__->add_columns(qw/ cdid artist title/);
   __PACKAGE__->set_primary_key('cdid');
@@ -116,10 +115,9 @@
 MyDatabase/Main/Result/Track.pm:
 
   package MyDatabase::Main::Result::Track;
-  use base qw/DBIx::Class/;
-  __PACKAGE__->load_components(qw/Core/);
+  use base qw/DBIx::Class::Core/;
   __PACKAGE__->table('track');
-  __PACKAGE__->add_columns(qw/ trackid cd title/);
+  __PACKAGE__->add_columns(qw/ trackid cd title /);
   __PACKAGE__->set_primary_key('trackid');
   __PACKAGE__->belongs_to('cd' => 'MyDatabase::Main::Result::Cd');
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Intro.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Intro.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Intro.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -105,13 +105,14 @@
 Next, create each of the classes you want to load as specified above:
 
   package My::Schema::Result::Album;
-  use base qw/DBIx::Class/;
+  use base qw/DBIx::Class::Core/;
 
-Load any components required by each class with the load_components() method.
-This should consist of "Core" plus any additional components you want to use.
-For example, if you want to force columns to use UTF-8 encoding:
+Load any additional components you may need with the load_components() method,
+and provide component configuration if required. For example, if you want
+automatic row ordering:
 
-  __PACKAGE__->load_components(qw/ ForceUTF8 Core /);
+  __PACKAGE__->load_components(qw/ Ordered /);
+  __PACKAGE__->position_column('rank');
 
 Set the table for your class:
 
@@ -119,7 +120,7 @@
 
 Add columns to your class:
 
-  __PACKAGE__->add_columns(qw/ albumid artist title /);
+  __PACKAGE__->add_columns(qw/ albumid artist title rank /);
 
 Each column can also be set up with its own accessor, data_type and other pieces
 of information that it may be useful to have -- just pass C<add_columns> a hash:
@@ -145,13 +146,20 @@
                               is_nullable => 0,
                               is_auto_increment => 0,
                               default_value => '',
+                            },
+                          rank =>
+                            { data_type => 'integer',
+                              size      => 16,
+                              is_nullable => 0,
+                              is_auto_increment => 0,
+                              default_value => '',
                             }
                          );
 
 DBIx::Class doesn't directly use most of this data yet, but various related
 modules such as L<DBIx::Class::WebForm> make use of it. Also it allows you to
 create your database tables from your Schema, instead of the other way around.
-See L<SQL::Translator> for details.
+See L<DBIx::Class::Schema/deploy> for details.
 
 See L<DBIx::Class::ResultSource> for more details of the possible column
 attributes.

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Joining.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Joining.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Joining.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -17,7 +17,7 @@
 But I'll explain anyway. Assuming you have created your database in a
 more or less sensible way, you will end up with several tables that
 contain C<related> information. For example, you may have a table
-containing information about C<CDs>, containing the CD title and it's
+containing information about C<CD>s, containing the CD title and it's
 year of publication, and another table containing all the C<Track>s
 for the CDs, one track per row.
 
@@ -34,7 +34,8 @@
 So, joins are a way of extending simple select statements to include
 fields from other, related, tables. There are various types of joins,
 depending on which combination of the data you wish to retrieve, see
-MySQL's doc on JOINs: L<http://dev.mysql.com/doc/refman/5.0/en/join.html>.
+MySQL's doc on JOINs:
+L<http://dev.mysql.com/doc/refman/5.0/en/join.html>.
 
 =head1 DEFINING JOINS AND RELATIONSHIPS
 
@@ -42,7 +43,7 @@
 be defined in the L<ResultSource|DBIx::Class::Manual::Glossary/ResultSource> for the
 table. If the relationship needs to be accessed in both directions
 (i.e. Fetch all tracks of a CD, and fetch the CD data for a Track),
-then it needs to be defined in both tables.
+then it needs to be defined for both tables.
 
 For the CDs/Tracks example, that means writing, in C<MySchema::CD>:
 
@@ -68,14 +69,15 @@
 
 When performing either a L<search|DBIx::Class::ResultSet/search> or a
 L<find|DBIx::Class::ResultSet/find> operation, you can specify which
-C<relations> to also fetch data from (or sort by), using the
+C<relations> to also refine your results based on, using the
 L<join|DBIx::Class::ResultSet/join> attribute, like this:
 
   $schema->resultset('CD')->search(
-    { 'Title' => 'Funky CD' },
+    { 'Title' => 'Funky CD',
+      'tracks.Name' => { like => 'T%' }
+    },
     { join      => 'tracks',
-      '+select' => [ 'tracks.Name', 'tracks.Artist' ],
-      '+as'     => [ 'TrackName', 'ArtistName' ]
+      order_by  => ['tracks.id'],
     }
   );
 
@@ -84,18 +86,125 @@
 L<DBIx::Class::ResultSet/ATTRIBUTES>, but here's a quick break down:
 
 The first argument to search is a hashref of the WHERE attributes, in
-this case a simple restriction on the Title column. The second
-argument is a hashref of attributes to the search, '+select' adds
-extra columns to the select (from the joined table(s) or from
-calculations), and '+as' gives aliases to those fields.
+this case a restriction on the Title column in the CD table, and a
+restriction on the name of the track in the Tracks table, but ONLY for
+tracks actually related to the chosen CD(s). The second argument is a
+hashref of attributes to the search, the results will be returned
+sorted by the C<id> of the related tracks.
 
-'join' specifies which C<relationships> to include in the query. The
-distinction between C<relationships> and C<tables> is important here,
-only the C<relationship> names are valid.
+The special 'join' attribute specifies which C<relationships> to
+include in the query. The distinction between C<relationships> and
+C<tables> is important here, only the C<relationship> names are valid.
 
-This example should magically produce SQL like the second select in
-L</WHAT ARE JOINS> above.
+This slightly nonsense example will produce SQL similar to:
 
+  SELECT cd.ID, cd.Title, cd.Year FROM CD cd JOIN Tracks tracks ON cd.ID = tracks.CDID WHERE cd.Title = 'Funky CD' AND tracks.Name LIKE 'T%' ORDER BY 'tracks.id';
+
+=head1 FETCHING RELATED DATA
+
+Another common use for joining to related tables, is to fetch the data
+from both tables in one query, preventing extra round-trips to the
+database. See the example above in L</WHAT ARE JOINS>.
+
+Three techniques are described here. Of the three, only the
+C<prefetch> technique will deal sanely with fetching related objects
+over a C<has_many> relation. The others work fine for 1 to 1 type
+relationships.
+
+=head2 Whole related objects
+
+To fetch entire related objects, eg CDs and all Track data, use the
+'prefetch' attribute:
+
+  $schema->resultset('CD')->search(
+    { 'Title' => 'Funky CD',
+    },
+    { prefetch      => 'tracks',
+      order_by  => ['tracks.id'],
+    }
+  );
+
+This will produce SQL similar to the following:
+
+  SELECT cd.ID, cd.Title, cd.Year, tracks.id, tracks.Name, tracks.Artist FROM CD JOIN Tracks ON CD.ID = tracks.CDID WHERE cd.Title = 'Funky CD' ORDER BY 'tracks.id';
+
+The syntax of 'prefetch' is the same as 'join' and implies the
+joining, so no need to use both together.
+
+=head2 Subset of related fields
+
+To fetch a subset or the related fields, the '+select' and '+as'
+attributes can be used. For example, if the CD data is required and
+just the track name from the Tracks table:
+
+  $schema->resultset('CD')->search(
+    { 'Title' => 'Funky CD',
+    },
+    { join      => 'tracks',
+      '+select' => ['tracks.Name'],
+      '+as'     => ['track_name'],
+      order_by  => ['tracks.id'],
+    }
+  );
+
+Which will produce the query:
+
+  SELECT cd.ID, cd.Title, cd.Year, tracks.Name FROM CD JOIN Tracks ON CD.ID = tracks.CDID WHERE cd.Title = 'Funky CD' ORDER BY 'tracks.id';
+
+Note that the '+as' does not produce an SQL 'AS' keyword in the
+output, see the L<DBIx::Class::Manual::FAQ> for an explanation.
+
+This type of column restriction has a downside, the resulting $row
+object will have no 'track_name' accessor:
+
+  while(my $row = $search_rs->next) {
+     print $row->track_name; ## ERROR
+  }
+
+Instead C<get_column> must be used:
+
+  while(my $row = $search_rs->next) {
+     print $row->get_colum('track_name'); ## WORKS
+  }
+
+=head2 Incomplete related objects
+
+In rare circumstances, you may also wish to fetch related data as
+incomplete objects. The usual reason to do is when the related table
+has a very large field you don't need for the current data
+output. This is better solved by storing that field in a separate
+table which you only join to when needed.
+
+To fetch an incomplete related object, supply the dotted notation to the '+as' attribute: 
+
+  $schema->resultset('CD')->search(
+    { 'Title' => 'Funky CD',
+    },
+    { join      => 'tracks',
+      '+select' => ['tracks.Name'],
+      '+as'     => ['tracks.Name'], 
+      order_by  => ['tracks.id'],
+    }
+  );
+
+Which will produce same query as above;
+
+  SELECT cd.ID, cd.Title, cd.Year, tracks.Name FROM CD JOIN Tracks ON CD.ID = tracks.CDID WHERE cd.Title = 'Funky CD' ORDER BY 'tracks.id';
+
+Now you can access the result using the relationship accessor:
+
+  while(my $row = $search_rs->next) {
+     print $row->tracks->name; ## WORKS
+  }
+
+However, this will produce broken objects. If the tracks id column is
+not fetched, the object will not be usable for any operation other
+than reading its data. Use the L</Whole related objects> method as
+much as possible to avoid confusion in your code later.
+
+Broken means: Update will not work. Fetching other related objects
+will not work. Deleting the object will not work.
+
 =head1 COMPLEX JOINS AND STUFF
 
 =head2 Across multiple relations
@@ -114,14 +223,12 @@
   $schema->resultset('CD')->search(
     { 'Title' => 'Funky CD' },
     { join      => { 'tracks' => 'artist' },
-      '+select' => [ 'tracks.Name', 'artist.Artist' ],
-      '+as'     => [ 'TrackName', 'ArtistName' ]
     }
   );
 
 Which is:
 
-  SELECT me.ID, me.Title, me.Year, tracks.Name, artist.Artist FROM CD me JOIN Tracks tracks ON CD.ID = tracks.CDID JOIN Artists artist ON tracks.ArtistID = artist.ID WHERE me.Title = 'Funky CD';
+  SELECT me.ID, me.Title, me.Year FROM CD me JOIN Tracks tracks ON CD.ID = tracks.CDID JOIN Artists artist ON tracks.ArtistID = artist.ID WHERE me.Title = 'Funky CD';
 
 To perform joins using relations of the tables you are joining to, use
 a hashref to indicate the join depth. This can theoretically go as
@@ -147,12 +254,10 @@
     { 'Title' => 'Funky CD' },
     { join      => { 'tracks' => 'artist' },
       order_by  => [ 'tracks.Name', 'artist.Artist' ],
-      '+select' => [ 'tracks.Name', 'artist.Artist' ],
-      '+as'     => [ 'TrackName', 'ArtistName' ]
     }
   );
 
-  SELECT me.ID, me.Title, me.Year, tracks.Name, artist.Artist FROM CD me JOIN Tracks tracks ON CD.ID = tracks.CDID JOIN Artists artist ON tracks.ArtistID = artist.ID WHERE me.Title = 'Funky CD' ORDER BY tracks.Name, artist.Artist;
+  SELECT me.ID, me.Title, me.Year FROM CD me JOIN Tracks tracks ON CD.ID = tracks.CDID JOIN Artists artist ON tracks.ArtistID = artist.ID WHERE me.Title = 'Funky CD' ORDER BY tracks.Name, artist.Artist;
 
 This is essential if any of your tables have columns with the same names.
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Troubleshooting.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Troubleshooting.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Manual/Troubleshooting.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -100,29 +100,21 @@
 L<DBIx::Class::Manual::Cookbook/Setting_quoting_for_the_generated_SQL> for
 details.
 
-Note that quoting may lead to problems with C<order_by> clauses, see
-L<... column "foo DESC" does not exist ...> for info on avoiding those.
-
 =head2 column "foo DESC" does not exist ...
 
-This can happen if you've turned on quoting and then done something like
-this:
+This can happen if you are still using the obsolete order hack, and also
+happen to turn on sql-quoting.
 
   $rs->search( {}, { order_by => [ 'name DESC' ] } );
 
-This results in SQL like this:
+Since L<DBIx::Class> >= 0.08100 and L<SQL::Abstract> >= 1.50 the above
+should be written as:
 
-  ... ORDER BY "name DESC"
+  $rs->search( {}, { order_by => { -desc => 'name' } } );
 
-The solution is to pass your order_by items as scalar references to avoid
-quoting:
+For more ways to express order clauses refer to
+L<SQL::Abstract/ORDER_BY_CLAUSES>
 
-  $rs->search( {}, { order_by => [ \'name DESC' ] } );
-
-Now you'll get SQL like this:
-
-  ... ORDER BY name DESC
-
 =head2 Perl Performance Issues on Red Hat Systems
 
 There is a problem with slow performance of certain DBIx::Class

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/PK/Auto.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/PK/Auto.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/PK/Auto.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -11,7 +11,7 @@
 
 =head1 SYNOPSIS
 
-__PACKAGE__->load_components(qw/Core/);
+use base 'DBIx::Class::Core';
 __PACKAGE__->set_primary_key('id');
 
 =head1 DESCRIPTION
@@ -19,8 +19,6 @@
 This class overrides the insert method to get automatically incremented primary
 keys.
 
-  __PACKAGE__->load_components(qw/Core/);
-
 PK::Auto is now part of Core.
 
 See L<DBIx::Class::Manual::Component> for details of component interactions.

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship/HasOne.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship/HasOne.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship/HasOne.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -3,6 +3,7 @@
 
 use strict;
 use warnings;
+use Carp::Clan qw/^DBIx::Class/;
 
 our %_pod_inherit_config = 
   (
@@ -21,20 +22,16 @@
   my ($class, $join_type, $rel, $f_class, $cond, $attrs) = @_;
   unless (ref $cond) {
     $class->ensure_class_loaded($f_class);
-    my ($pri, $too_many) = $class->primary_columns;
 
+    my $pri = $class->_get_primary_key;
+  
     $class->throw_exception(
-      "might_have/has_one can only infer join for a single primary key; ".
-      "${class} has more"
-    ) if $too_many;
-
-    $class->throw_exception(
       "might_have/has_one needs a primary key  to infer a join; ".
       "${class} has none"
     ) if !defined $pri && (!defined $cond || !length $cond);
 
     my $f_class_loaded = eval { $f_class->columns };
-    my ($f_key,$guess);
+    my ($f_key,$too_many,$guess);
     if (defined $cond && length $cond) {
       $f_key = $cond;
       $guess = "caller specified foreign key '$f_key'";
@@ -42,11 +39,7 @@
       $f_key = $rel;
       $guess = "using given relationship '$rel' for foreign key";
     } else {
-      ($f_key, $too_many) = $f_class->primary_columns;
-      $class->throw_exception(
-        "might_have/has_one can only infer join for a single primary key; ".
-        "${f_class} has more"
-      ) if $too_many;
+      $f_key = $class->_get_primary_key($f_class);
       $guess = "using primary key of foreign class for foreign key";
     }
     $class->throw_exception(
@@ -54,6 +47,7 @@
     ) if $f_class_loaded && !$f_class->has_column($f_key);
     $cond = { "foreign.${f_key}" => "self.${pri}" };
   }
+  $class->_validate_cond($cond);
   $class->add_relationship($rel, $f_class,
    $cond,
    { accessor => 'single',
@@ -63,4 +57,34 @@
   1;
 }
 
+sub _get_primary_key {
+  my ( $class, $target_class ) = @_;
+  $target_class ||= $class;
+  my ($pri, $too_many) = $target_class->primary_columns;
+  $class->throw_exception(
+    "might_have/has_one can only infer join for a single primary key; ".
+    "${class} has more"
+  ) if $too_many;
+  return $pri;
+}
+
+sub _validate_cond {
+  my ($class, $cond )  = @_;
+
+  return if $ENV{DBIC_DONT_VALIDATE_RELS};
+  return unless 'HASH' eq ref $cond;
+  foreach my $foreign_id ( keys %$cond ) {
+    my $self_id = $cond->{$foreign_id};
+
+    # we can ignore a bad $self_id because add_relationship handles this
+    # warning
+    return unless $self_id =~ /^self\.(.*)$/;
+    my $key = $1;
+    my $column_info = $class->column_info($key);
+    if ( $column_info->{is_nullable} ) {
+      carp(qq'"might_have/has_one" must not be on columns with is_nullable set to true ($class/$key). This might indicate an incorrect use of those relationship helpers instead of belongs_to.');
+    }
+  }
+}
+
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Relationship.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -232,13 +232,13 @@
 
 =back
 
-Creates a one-to-many relationship, where the corresponding elements
-of the foreign class store the calling class's primary key in one (or
-more) of the foreign class columns. This relationship defaults to using
-the end of this classes namespace as the foreign key in C<$related_class>
-to resolve the join, unless C<$their_fk_column> specifies the foreign
-key column in C<$related_class> or C<cond> specifies a reference to a
-join condition hash.
+Creates a one-to-many relationship where the foreign class refers to
+this class's primary key. This relationship refers to zero or more
+records in the foreign table (ie, a C<LEFT JOIN>). This relationship 
+defaults to using the end of this classes namespace as the foreign key
+in C<$related_class> to resolve the join, unless C<$their_fk_column>
+specifies the foreign key column in C<$related_class> or C<cond>
+specifies a reference to a join condition hash.
 
 =over
 
@@ -441,6 +441,17 @@
 for a L<list of standard resultset attributes|DBIx::Class::ResultSet/ATTRIBUTES>
 which can be assigned to relationships as well.
 
+Note that if you supply a condition on which to join, if the column in the
+current table allows nulls (i.e., has the C<is_nullable> attribute set to a
+true value), than C<might_have> will warn about this because it's naughty and
+you shouldn't do that.  
+
+ "might_have/has_one" must not be on columns with is_nullable set to true (MySchema::SomeClass/key)
+
+If you must be naughty, you can suppress the warning by setting
+C<DBIC_DONT_VALIDATE_RELS> environment variable to a true value.  Otherwise,
+you probably just want to use C<DBIx::Class::Relationship/belongs_to>.
+
 =head2 has_one
 
 =over 4
@@ -528,6 +539,11 @@
 for a L<list of standard resultset attributes|DBIx::Class::ResultSet/ATTRIBUTES>
 which can be assigned to relationships as well.
 
+Note that if you supply a condition on which to join, if the column in the
+current table allows nulls (i.e., has the C<is_nullable> attribute set to a
+true value), than warnings might apply just as with
+L<DBIx::Class::Relationship/might_have>.
+
 =head2 many_to_many
 
 =over 4

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSet.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSet.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -974,19 +974,6 @@
 sub _collapse_result {
   my ($self, $as_proto, $row) = @_;
 
-  # if the first row that ever came in is totally empty - this means we got
-  # hit by a smooth^Wempty left-joined resultset. Just noop in that case
-  # instead of producing a {}
-  #
-  my $has_def;
-  for (@$row) {
-    if (defined $_) {
-      $has_def++;
-      last;
-    }
-  }
-  return undef unless $has_def;
-
   my @copy = @$row;
 
   # 'foo'         => [ undef, 'foo' ]
@@ -1247,11 +1234,6 @@
   $tmp_attrs->{select} = $rsrc->storage->_count_select ($rsrc, $tmp_attrs);
   $tmp_attrs->{as} = 'count';
 
-  # read the comment on top of the actual function to see what this does
-  $tmp_attrs->{from} = $self->result_source->schema->storage->_straight_join_to_node (
-    $tmp_attrs->{from}, $tmp_attrs->{alias}
-  );
-
   my $tmp_rs = $rsrc->resultset_class->new($rsrc, $tmp_attrs)->get_column ('count');
 
   return $tmp_rs;
@@ -1279,11 +1261,6 @@
 
   $sub_attrs->{select} = $rsrc->storage->_subq_count_select ($rsrc, $sub_attrs);
 
-  # read the comment on top of the actual function to see what this does
-  $sub_attrs->{from} = $self->result_source->schema->storage->_straight_join_to_node (
-    $sub_attrs->{from}, $sub_attrs->{alias}
-  );
-
   # this is so that the query can be simplified e.g.
   # * non-limiting joins can be pruned
   # * ordering can be thrown away in things like Top limit
@@ -1431,7 +1408,7 @@
   my $cond = $rsrc->schema->storage->_strip_cond_qualifiers ($self->{cond});
 
   my $needs_group_by_subq = $self->_has_resolved_attr (qw/collapse group_by -join/);
-  my $needs_subq = (not defined $cond) || $self->_has_resolved_attr(qw/row offset/);
+  my $needs_subq = $needs_group_by_subq || (not defined $cond) || $self->_has_resolved_attr(qw/row offset/);
 
   if ($needs_group_by_subq or $needs_subq) {
 
@@ -1658,11 +1635,11 @@
 =cut
 
 sub populate {
-  my $self = shift @_;
-  my $data = ref $_[0][0] eq 'HASH'
-    ? $_[0] : ref $_[0][0] eq 'ARRAY' ? $self->_normalize_populate_args($_[0]) :
-    $self->throw_exception('Populate expects an arrayref of hashes or arrayref of arrayrefs');
+  my $self = shift;
 
+  # cruft placed in standalone method
+  my $data = $self->_normalize_populate_args(@_);
+
   if(defined wantarray) {
     my @created;
     foreach my $item (@$data) {
@@ -1754,26 +1731,27 @@
   }
 }
 
-=head2 _normalize_populate_args ($args)
 
-Private method used by L</populate> to normalize its incoming arguments.  Factored
-out in case you want to subclass and accept new argument structures to the
-L</populate> method.
-
-=cut
-
+# populate() argumnets went over several incarnations
+# What we ultimately support is AoH
 sub _normalize_populate_args {
-  my ($self, $data) = @_;
-  my @names = @{shift(@$data)};
-  my @results_to_create;
-  foreach my $datum (@$data) {
-    my %result_to_create;
-    foreach my $index (0..$#names) {
-      $result_to_create{$names[$index]} = $$datum[$index];
+  my ($self, $arg) = @_;
+
+  if (ref $arg eq 'ARRAY') {
+    if (ref $arg->[0] eq 'HASH') {
+      return $arg;
     }
-    push @results_to_create, \%result_to_create;
+    elsif (ref $arg->[0] eq 'ARRAY') {
+      my @ret;
+      my @colnames = @{$arg->[0]};
+      foreach my $values (@{$arg}[1 .. $#$arg]) {
+        push @ret, { map { $colnames[$_] => $values->[$_] } (0 .. $#colnames) };
+      }
+      return \@ret;
+    }
   }
-  return \@results_to_create;
+
+  $self->throw_exception('Populate expects an arrayref of hashrefs or arrayref of arrayrefs');
 }
 
 =head2 pager
@@ -2046,7 +2024,7 @@
   return \%unaliased;
 }
 
-=head2 as_query (EXPERIMENTAL)
+=head2 as_query
 
 =over 4
 
@@ -2060,8 +2038,6 @@
 
 This is generally used as the RHS for a subquery.
 
-B<NOTE>: This feature is still experimental.
-
 =cut
 
 sub as_query {
@@ -2511,18 +2487,28 @@
 
   $self->{related_resultsets} ||= {};
   return $self->{related_resultsets}{$rel} ||= do {
-    my $rel_info = $self->result_source->relationship_info($rel);
+    my $rsrc = $self->result_source;
+    my $rel_info = $rsrc->relationship_info($rel);
 
     $self->throw_exception(
-      "search_related: result source '" . $self->result_source->source_name .
+      "search_related: result source '" . $rsrc->source_name .
         "' has no such relationship $rel")
       unless $rel_info;
 
     my $attrs = $self->_chain_relationship($rel);
 
     my $join_count = $attrs->{seen_join}{$rel};
-    my $alias = ($join_count > 1 ? join('_', $rel, $join_count) : $rel);
 
+    my $alias = $self->result_source->storage
+        ->relname_to_table_alias($rel, $join_count);
+
+    # since this is search_related, and we already slid the select window inwards
+    # (the select/as attrs were deleted in the beginning), we need to flip all 
+    # left joins to inner, so we get the expected results
+    # read the comment on top of the actual function to see what this does
+    $attrs->{from} = $rsrc->schema->storage->_straight_join_to_node ($attrs->{from}, $alias);
+
+
     #XXX - temp fix for result_class bug. There likely is a more elegant fix -groditi
     delete @{$attrs}{qw(result_class alias)};
 
@@ -2535,7 +2521,7 @@
       }
     }
 
-    my $rel_source = $self->result_source->related_source($rel);
+    my $rel_source = $rsrc->related_source($rel);
 
     my $new = do {
 
@@ -2625,7 +2611,7 @@
   # ->_resolve_join as otherwise they get lost - captainL
   my $join = $self->_merge_attr( $attrs->{join}, $attrs->{prefetch} );
 
-  delete @{$attrs}{qw/join prefetch collapse select as columns +select +as +columns/};
+  delete @{$attrs}{qw/join prefetch collapse distinct select as columns +select +as +columns/};
 
   my $seen = { %{ (delete $attrs->{seen_join}) || {} } };
 
@@ -2637,10 +2623,19 @@
       ||
     $self->_has_resolved_attr (@force_subq_attrs)
   ) {
+    # Nuke the prefetch (if any) before the new $rs attrs
+    # are resolved (prefetch is useless - we are wrapping
+    # a subquery anyway).
+    my $rs_copy = $self->search;
+    $rs_copy->{attrs}{join} = $self->_merge_attr (
+      $rs_copy->{attrs}{join},
+      delete $rs_copy->{attrs}{prefetch},
+    );
+
     $from = [{
       -source_handle => $source->handle,
       -alias => $attrs->{alias},
-      $attrs->{alias} => $self->as_query,
+      $attrs->{alias} => $rs_copy->as_query,
     }];
     delete @{$attrs}{@force_subq_attrs, 'where'};
     $seen->{-relation_chain_depth} = 0;
@@ -2677,7 +2672,6 @@
   # the join in question so we could tell it *is* the search_related)
   my $already_joined;
 
-
   # we consider the last one thus reverse
   for my $j (reverse @requested_joins) {
     if ($rel eq $j->[0]{-join_path}[-1]) {
@@ -2686,7 +2680,6 @@
       last;
     }
   }
-
 # alternative way to scan the entire chain - not backwards compatible
 #  for my $j (reverse @$from) {
 #    next unless ref $j eq 'ARRAY';

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSetColumn.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSetColumn.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSetColumn.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -98,7 +98,7 @@
   return $new;
 }
 
-=head2 as_query (EXPERIMENTAL)
+=head2 as_query
 
 =over 4
 
@@ -112,8 +112,6 @@
 
 This is generally used as the RHS for a subquery.
 
-B<NOTE>: This feature is still experimental.
-
 =cut
 
 sub as_query { return shift->_resultset->as_query(@_) }

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource/View.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource/View.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource/View.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -19,9 +19,8 @@
 
   package MyDB::Schema::Result::Year2000CDs;
 
-  use base qw/DBIx::Class/;
+  use base qw/DBIx::Class::Core/;
 
-  __PACKAGE__->load_components('Core');
   __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 
   __PACKAGE__->table('year2000cds');

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSource.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -28,9 +28,8 @@
   # Create a table based result source, in a result class.
 
   package MyDB::Schema::Result::Artist;
-  use base qw/DBIx::Class/;
+  use base qw/DBIx::Class::Core/;
 
-  __PACKAGE__->load_components(qw/Core/);
   __PACKAGE__->table('artist');
   __PACKAGE__->add_columns(qw/ artistid name /);
   __PACKAGE__->set_primary_key('artistid');
@@ -40,8 +39,9 @@
 
   # Create a query (view) based result source, in a result class
   package MyDB::Schema::Result::Year2000CDs;
+  use base qw/DBIx::Class::Core/;
 
-  __PACKAGE__->load_components('Core');
+  __PACKAGE__->load_components('InflateColumn::DateTime');
   __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 
   __PACKAGE__->table('year2000cds');
@@ -60,10 +60,10 @@
 default result source type, so one is created for you when defining a
 result class as described in the synopsis above.
 
-More specifically, the L<DBIx::Class::Core> component pulls in the
-L<DBIx::Class::ResultSourceProxy::Table> as a base class, which
-defines the L<table|DBIx::Class::ResultSourceProxy::Table/table>
-method. When called, C<table> creates and stores an instance of
+More specifically, the L<DBIx::Class::Core> base class pulls in the
+L<DBIx::Class::ResultSourceProxy::Table> component, which defines
+the L<table|DBIx::Class::ResultSourceProxy::Table/table> method.
+When called, C<table> creates and stores an instance of
 L<DBIx::Class::ResultSoure::Table>. Luckily, to use tables as result
 sources, you don't need to remember any of this.
 
@@ -1228,7 +1228,9 @@
       $force_left ||= lc($rel_info->{attrs}{join_type}||'') eq 'left';
 
       # the actual seen value will be incremented by the recursion
-      my $as = ($seen->{$rel} ? join ('_', $rel, $seen->{$rel} + 1) : $rel);
+      my $as = $self->storage->relname_to_table_alias(
+        $rel, ($seen->{$rel} && $seen->{$rel} + 1)
+      );
 
       push @ret, (
         $self->_resolve_join($rel, $alias, $seen, [@$jpath], $force_left),
@@ -1245,7 +1247,9 @@
   }
   else {
     my $count = ++$seen->{$join};
-    my $as = ($count > 1 ? "${join}_${count}" : $join);
+    my $as = $self->storage->relname_to_table_alias(
+      $join, ($count > 1 && $count)
+    );
 
     my $rel_info = $self->relationship_info($join)
       or $self->throw_exception("No such relationship ${join}");
@@ -1334,13 +1338,13 @@
         unless ($for->has_column_loaded($v)) {
           if ($for->in_storage) {
             $self->throw_exception(sprintf
-              'Unable to resolve relationship from %s to %s: column %s.%s not '
-            . 'loaded from storage (or not passed to new() prior to insert()). '
-            . 'Maybe you forgot to call ->discard_changes to get defaults from the db.',
-
-              $for->result_source->source_name,
+              "Unable to resolve relationship '%s' from object %s: column '%s' not "
+            . 'loaded from storage (or not passed to new() prior to insert()). You '
+            . 'probably need to call ->discard_changes to get the server-side defaults '
+            . 'from the database.',
               $as,
-              $as, $v,
+              $for,
+              $v,
             );
           }
           return $UNRESOLVABLE_CONDITION;
@@ -1579,7 +1583,7 @@
 =cut
 
 sub handle {
-    return new DBIx::Class::ResultSourceHandle({
+    return DBIx::Class::ResultSourceHandle->new({
         schema         => $_[0]->schema,
         source_moniker => $_[0]->source_name
     });

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSourceProxy.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSourceProxy.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/ResultSourceProxy.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -41,7 +41,9 @@
   }
 }
 
-*add_column = \&add_columns;
+sub add_column {
+  shift->add_columns(@_);
+}
 
 sub has_column {
   shift->result_source_instance->has_column(@_);

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Row.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Row.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -527,7 +527,9 @@
 this behaviour off, pass C<< cascade_delete => 0 >> in the C<$attr>
 hashref of the relationship, see L<DBIx::Class::Relationship>. Any
 database-level cascade or restrict will take precedence over a
-DBIx-Class-based cascading delete.
+DBIx-Class-based cascading delete, since DBIx-Class B<deletes the
+main row first> and only then attempts to delete any remaining related
+rows.
 
 If you delete an object within a txn_do() (see L<DBIx::Class::Storage/txn_do>)
 and the transaction subsequently fails, the row object will remain marked as
@@ -802,7 +804,7 @@
   $self->{_orig_ident} ||= $self->ident_condition;
   my $old_value = $self->get_column($column);
 
-  $self->store_column($column, $new_value);
+  $new_value = $self->store_column($column, $new_value);
 
   my $dirty;
   if (!$self->in_storage) { # no point tracking dirtyness on uninserted data

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks/MSSQL.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks/MSSQL.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -5,29 +5,10 @@
 use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
 
 #
-# MSSQL is retarded wrt TOP (crappy limit) and ordering.
-# One needs to add a TOP to *all* ordered subqueries, if
-# TOP has been used in the statement at least once.
-# Do it here.
+# MSSQL does not support ... OVER() ... RNO limits
 #
-sub select {
-  my $self = shift;
-
-  my ($sql, @bind) = $self->SUPER::select (@_);
-
-  # ordering was requested and there are at least 2 SELECT/FROM pairs
-  # (thus subquery), and there is no TOP specified
-  if (
-    $sql =~ /\bSELECT\b .+? \bFROM\b .+? \bSELECT\b .+? \bFROM\b/isx
-      &&
-    $sql !~ /^ \s* SELECT \s+ TOP \s+ \d+ /xi
-      &&
-    scalar $self->_order_by_chunks ($_[3]->{order_by})
-  ) {
-    $sql =~ s/^ \s* SELECT \s/SELECT TOP 100 PERCENT /xi;
-  }
-
-  return wantarray ? ($sql, @bind) : $sql;
+sub _rno_default_order {
+  return \ '(SELECT(1))';
 }
 
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/SQLAHacks.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -47,31 +47,44 @@
 }
 
 
-# Slow but ANSI standard Limit/Offset support. DB2 uses this
+# ANSI standard Limit/Offset implementation. DB2 and MSSQL use this
 sub _RowNumberOver {
   my ($self, $sql, $order, $rows, $offset ) = @_;
 
-  $offset += 1;
-  my $last = $rows + $offset - 1;
-  my ( $order_by ) = $self->_order_by( $order );
+  # get the select to make the final amount of columns equal the original one
+  my ($select) = $sql =~ /^ \s* SELECT \s+ (.+?) \s+ FROM/ix
+    or croak "Unrecognizable SELECT: $sql";
 
-  $sql = <<"SQL";
-SELECT * FROM
-(
-   SELECT Q1.*, ROW_NUMBER() OVER( ) AS ROW_NUM FROM (
-      $sql
-      $order_by
-   ) Q1
-) Q2
-WHERE ROW_NUM BETWEEN $offset AND $last
+  # get the order_by only (or make up an order if none exists)
+  my $order_by = $self->_order_by(
+    (delete $order->{order_by}) || $self->_rno_default_order
+  );
 
-SQL
+  # whatever is left of the order_by
+  my $group_having = $self->_order_by($order);
 
+  my $qalias = $self->_quote ($self->{_dbic_rs_attrs}{alias});
+
+  $sql = sprintf (<<EOS, $offset + 1, $offset + $rows, );
+
+SELECT $select FROM (
+  SELECT $qalias.*, ROW_NUMBER() OVER($order_by ) AS rno__row__index FROM (
+    ${sql}${group_having}
+  ) $qalias
+) $qalias WHERE rno__row__index BETWEEN %d AND %d
+
+EOS
+
+  $sql =~ s/\s*\n\s*/ /g;   # easier to read in the debugger
   return $sql;
 }
 
-# Crappy Top based Limit/Offset support. MSSQL uses this currently,
-# but may have to switch to RowNumberOver one day
+# some databases are happy with OVER (), some need OVER (ORDER BY (SELECT (1)) )
+sub _rno_default_order {
+  return undef;
+}
+
+# Crappy Top based Limit/Offset support. Legacy from MSSQL.
 sub _Top {
   my ( $self, $sql, $order, $rows, $offset ) = @_;
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema/Versioned.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema/Versioned.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,10 +1,9 @@
 package # Hide from PAUSE
   DBIx::Class::Version::Table;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 use strict;
 use warnings;
 
-__PACKAGE__->load_components(qw/ Core/);
 __PACKAGE__->table('dbix_class_schema_versions');
 
 __PACKAGE__->add_columns
@@ -31,8 +30,7 @@
 
 package # Hide from PAUSE
   DBIx::Class::Version::TableCompat;
-use base 'DBIx::Class';
-__PACKAGE__->load_components(qw/ Core/);
+use base 'DBIx::Class::Core';
 __PACKAGE__->table('SchemaVersions');
 
 __PACKAGE__->add_columns
@@ -180,7 +178,7 @@
 
 use strict;
 use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Schema';
 
 use Carp::Clan qw/^DBIx::Class/;
 use POSIX 'strftime';

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Schema.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -5,7 +5,7 @@
 
 use DBIx::Class::Exception;
 use Carp::Clan qw/^DBIx::Class/;
-use Scalar::Util qw/weaken/;
+use Scalar::Util ();
 use File::Spec;
 use Sub::Name ();
 use Module::Find();
@@ -33,8 +33,9 @@
   __PACKAGE__->load_namespaces();
 
   package Library::Schema::Result::CD;
-  use base qw/DBIx::Class/;
-  __PACKAGE__->load_components(qw/Core/); # for example
+  use base qw/DBIx::Class::Core/;
+
+  __PACKAGE__->load_components(qw/InflateColumn::DateTime/); # for example
   __PACKAGE__->table('cd');
 
   # Elsewhere in your code:
@@ -1082,7 +1083,7 @@
   $self->storage->deployment_statements($self, @_);
 }
 
-=head2 create_ddl_dir (EXPERIMENTAL)
+=head2 create_ddl_dir
 
 =over 4
 
@@ -1177,9 +1178,18 @@
 
 =head2 dclone
 
-Recommeneded way of dcloning objects. This is needed to properly maintain
-references to the schema object (which itself is B<not> cloned.)
+=over 4
 
+=item Arguments: $object
+
+=item Return Value: dcloned $object
+
+=back
+
+Recommended way of dcloning L<DBIx::Class::Row> and L<DBIx::Class::ResultSet>
+objects so their references to the schema object
+(which itself is B<not> cloned) are properly maintained.
+
 =cut
 
 sub dclone {
@@ -1259,6 +1269,24 @@
   $self->_register_source(@_);
 }
 
+=head2 unregister_source
+
+=over 4
+
+=item Arguments: $moniker
+
+=back
+
+Removes the L<DBIx::Class::ResultSource> from the schema for the given moniker.
+
+=cut
+
+sub unregister_source {
+  my $self = shift;
+
+  $self->_unregister_source(@_);
+}
+
 =head2 register_extra_source
 
 =over 4
@@ -1285,7 +1313,7 @@
 
   $source = $source->new({ %$source, source_name => $moniker });
   $source->schema($self);
-  weaken($source->{schema}) if ref($self);
+  Scalar::Util::weaken($source->{schema}) if ref($self);
 
   my $rs_class = $source->result_class;
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -14,6 +14,86 @@
   $self->_identity_method('@@identity');
 }
 
+sub source_bind_attributes {
+  my $self = shift;
+  my ($source) = @_;
+
+  my $bind_attributes = $self->next::method(@_);
+
+  foreach my $column ($source->columns) {
+    $bind_attributes->{$column}{ado_size} ||= 8000; # max VARCHAR
+  }
+
+  return $bind_attributes;
+}
+
+sub bind_attribute_by_data_type {
+  my ($self, $data_type) = @_;
+
+  ($data_type = lc($data_type)) =~ s/\s+.*//;
+
+  my $max_size =
+    $self->_mssql_max_data_type_representation_size_in_bytes->{$data_type};
+
+  my $res = {};
+  $res->{ado_size} = $max_size if $max_size;
+
+  return $res;
+}
+
+# approximate
+# XXX needs to support varchar(max) and varbinary(max)
+sub _mssql_max_data_type_representation_size_in_bytes {
+  my $self = shift;
+
+  my $blob_max = $self->_get_dbh->{LongReadLen} || 32768;
+
+  return +{
+# MSSQL types
+    char => 8000,
+    varchar => 8000,
+    binary => 8000,
+    varbinary => 8000,
+    nchar => 8000,
+    nvarchar => 8000,
+    numeric => 100,
+    smallint => 100,
+    tinyint => 100,
+    smallmoney => 100,
+    bigint => 100,
+    bit => 100,
+    decimal => 100,
+    integer => 100,
+    int => 100,
+    money => 100,
+    float => 100,
+    real => 100,
+    uniqueidentifier => 100,
+    ntext => $blob_max,
+    text => $blob_max,
+    image => $blob_max,
+    date => 100,
+    datetime => 100,
+    datetime2 => 100,
+    datetimeoffset => 100,
+    smalldatetime => 100,
+    time => 100,
+    timestamp => 100,
+    cursor => 100,
+    hierarchyid => 100,
+    sql_variant => 100,
+    table => 100,
+    xml => $blob_max, # ???
+
+# some non-MSSQL types
+    serial => 100,
+    bigserial => 100,
+    varchar2 => 8000,
+    blob => $blob_max,
+    clob => $blob_max,
+  }
+}
+
 1;
 
 =head1 NAME
@@ -30,10 +110,29 @@
 The MSSQL specific functionality is provided by
 L<DBIx::Class::Storage::DBI::MSSQL>.
 
+=head2 CAVEATS
+
+=head3 identities
+
 C<_identity_method> is set to C<@@identity>, as C<SCOPE_IDENTITY()> doesn't work
 with L<DBD::ADO>. See L<DBIx::Class::Storage::DBI::MSSQL/IMPLEMENTATION NOTES>
 for caveats regarding this.
 
+=head3 truncation bug
+
+There is a bug with MSSQL ADO providers where data gets truncated based on the
+size of the bind sizes in the first prepare call:
+
+L<https://rt.cpan.org/Ticket/Display.html?id=52048>
+
+The C<ado_size> workaround is used (see L<DBD::ADO/"ADO Providers">) with the
+approximate maximum size of the data_type of the bound column, or 8000 (maximum
+VARCHAR size) if the data_type is not available.
+
+This code is incomplete and may be buggy. Particularly, C<VARCHAR(MAX)> is not
+supported yet. The data_type list for other DBs is also incomplete. Please
+report problems (and send patches.)
+
 =head1 AUTHOR
 
 See L<DBIx::Class/CONTRIBUTORS>.

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ADO.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -26,7 +26,8 @@
   }
 }
 
-# set cursor type here, if necessary
+# Here I was just experimenting with ADO cursor types, left in as a comment in
+# case you want to as well. See the DBD::ADO docs.
 #sub _dbh_sth {
 #  my ($self, $dbh, $sql) = @_;
 #

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -8,7 +8,7 @@
 
 =head1 NAME
 
-DBIx::Class::Storage::DBI::AmbiguousGlob - Storage component for RDBMS supporting multicolumn in clauses
+DBIx::Class::Storage::DBI::AmbiguousGlob - Storage component for RDBMS choking on count(*)
 
 =head1 DESCRIPTION
 
@@ -27,6 +27,9 @@
 
 sub _subq_count_select {
   my ($self, $source, $rs_attrs) = @_;
+
+  return $rs_attrs->{group_by} if $rs_attrs->{group_by};
+
   my @pcols = map { join '.', $rs_attrs->{alias}, $_ } ($source->primary_columns);
   return @pcols ? \@pcols : [ 1 ];
 }

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/DB2.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/DB2.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/DB2.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -38,7 +38,7 @@
 =head1 SYNOPSIS
 
   # In your table classes
-  __PACKAGE__->load_components(qw/PK::Auto Core/);
+  use base 'DBIx::Class::Core';
   __PACKAGE__->set_primary_key('id');
 
 =head1 DESCRIPTION

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -178,6 +178,33 @@
 
 sub last_insert_id { shift->_identity }
 
+#
+# MSSQL is retarded wrt ordered subselects. One needs to add a TOP
+# to *all* subqueries, but one also can't use TOP 100 PERCENT
+# http://sqladvice.com/forums/permalink/18496/22931/ShowThread.aspx#22931
+#
+sub _select_args_to_query {
+  my $self = shift;
+
+  my ($sql, $prep_bind, @rest) = $self->next::method (@_);
+
+  # see if this is an ordered subquery
+  my $attrs = $_[3];
+  if ( scalar $self->sql_maker->_order_by_chunks ($attrs->{order_by}) ) {
+    $self->throw_exception(
+      'An ordered subselect encountered - this is not safe! Please see "Ordered Subselects" in DBIx::Class::Storage::DBI::MSSQL
+    ') unless $attrs->{unsafe_subselect_ok};
+    my $max = 2 ** 32;
+    $sql =~ s/^ \s* SELECT \s/SELECT TOP $max /xi;
+  }
+
+  return wantarray
+    ? ($sql, $prep_bind, @rest)
+    : \[ "($sql)", @$prep_bind ]
+  ;
+}
+
+
 # savepoint syntax is the same as in Sybase ASE
 
 sub _svp_begin {
@@ -205,14 +232,35 @@
 
 sub sqlt_type { 'SQLServer' }
 
-sub _sql_maker_opts {
-  my ( $self, $opts ) = @_;
+sub _get_mssql_version {
+  my $self = shift;
 
-  if ( $opts ) {
-    $self->{_sql_maker_opts} = { %$opts };
+  my $data = $self->_get_dbh->selectrow_hashref('xp_msver ProductVersion');
+
+  if ($data->{Character_Value} =~ /^(\d+)\./) {
+    return $1;
+  } else {
+    $self->throw_exception(q{Your ProductVersion's Character_Value is missing or malformed!});
   }
+}
 
-  return { limit_dialect => 'Top', %{$self->{_sql_maker_opts}||{}} };
+sub sql_maker {
+  my $self = shift;
+
+  unless ($self->_sql_maker) {
+    unless ($self->{_sql_maker_opts}{limit_dialect}) {
+      my $version = eval { $self->_get_mssql_version; } || 0;
+
+      $self->{_sql_maker_opts} = {
+        limit_dialect => ($version >= 9 ? 'RowNumberOver' : 'Top'),
+        %{$self->{_sql_maker_opts}||{}}
+      };
+    }
+
+    my $maker = $self->next::method (@_);
+  }
+
+  return $self->_sql_maker;
 }
 
 1;
@@ -260,6 +308,54 @@
 C<db_ddladmin> privilege, which is normally not included in the standard
 write-permissions.
 
+=head2 Ordered Subselects
+
+If you attempted the following query (among many others) in Microsoft SQL
+Server
+
+ $rs->search ({}, {
+  prefetch => 'relation',
+  rows => 2,
+  offset => 3,
+ });
+
+You may be surprised to receive an exception. The reason for this is a quirk
+in the MSSQL engine itself, and sadly doesn't have a sensible workaround due
+to the way DBIC is built. DBIC can do truly wonderful things with the aid of
+subselects, and does so automatically when necessary. The list of situations
+when a subselect is necessary is long and still changes often, so it can not
+be exhaustively enumerated here. The general rule of thumb is a joined
+L<has_many|DBIx::Class::Relationship/has_many> relationship with limit/group
+applied to the left part of the join.
+
+In its "pursuit of standards" Microsft SQL Server goes to great lengths to
+forbid the use of ordered subselects. This breaks a very useful group of
+searches like "Give me things number 4 to 6 (ordered by name), and prefetch
+all their relations, no matter how many". While there is a hack which fools
+the syntax checker, the optimizer may B<still elect to break the subselect>.
+Testing has determined that while such breakage does occur (the test suite
+contains an explicit test which demonstrates the problem), it is relative
+rare. The benefits of ordered subselects are on the other hand too great to be
+outright disabled for MSSQL.
+
+Thus compromise between usability and perfection is the MSSQL-specific
+L<resultset attribute|DBIx::Class::ResultSet/ATTRIBUTES> C<unsafe_subselect_ok>.
+It is deliberately not possible to set this on the Storage level, as the user
+should inspect (and preferrably regression-test) the return of every such
+ResultSet individually. The example above would work if written like:
+
+ $rs->search ({}, {
+  unsafe_subselect_ok => 1,
+  prefetch => 'relation',
+  rows => 2,
+  offset => 3,
+ });
+
+If it is possible to rewrite the search() in a way that will avoid the need
+for this flag - you are urged to do so. If DBIC internals insist that an
+ordered subselect is necessary for an operation, and you believe there is a
+differnt/better way to get the same result - please file a bugreport.
+
 =head1 AUTHOR
 
 See L<DBIx::Class/CONTRIBUTORS>.

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -43,8 +43,8 @@
 
 =head1 SYNOPSIS
 
-  # In your table classes
-  __PACKAGE__->load_components(qw/PK::Auto Core/);
+  # In your result (table) classes
+  use base 'DBIx::Class::Core';
   __PACKAGE__->set_primary_key('id');
 
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -175,6 +175,14 @@
   }
 }
 
+sub _get_mssql_version {
+  my $self = shift;
+
+  my ($version) = $self->_get_dbh->get_info(18) =~ /^(\d+)/;
+
+  return $version;
+}
+
 1;
 
 =head1 AUTHOR

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/ODBC.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -36,18 +36,11 @@
 
 DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
 
-=head1 SYNOPSIS
-
-  # In your table classes
-  __PACKAGE__->load_components(qw/Core/);
-
-
 =head1 DESCRIPTION
 
 This class simply provides a mechanism for discovering and loading a sub-class
 for a specific ODBC backend.  It should be transparent to the user.
 
-
 =head1 AUTHORS
 
 Marc Mims C<< <marc at questright.com> >>

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -9,15 +9,17 @@
 
 =head1 SYNOPSIS
 
-  # In your table classes
-  __PACKAGE__->load_components(qw/PK::Auto Core/);
+  # In your result (table) classes
+  use base 'DBIx::Class::Core';
   __PACKAGE__->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1 } });
   __PACKAGE__->set_primary_key('id');
   __PACKAGE__->sequence('mysequence');
 
 =head1 DESCRIPTION
 
-This class implements autoincrements for Oracle.
+This class implements base Oracle support. The subclass
+L<DBIx::Class::Storage::DBI::Oracle::WhereJoins> is for C<(+)> joins in Oracle
+versions before 9.
 
 =head1 METHODS
 
@@ -274,6 +276,46 @@
     $self->_get_dbh->do("ROLLBACK TO SAVEPOINT $name")
 }
 
+=head2 relname_to_table_alias
+
+L<DBIx::Class> uses L<DBIx::Class::Relationship> names as table aliases in
+queries.
+
+Unfortunately, Oracle doesn't support identifiers over 30 chars in length, so
+the L<DBIx::Class::Relationship> name is shortened and appended with half of an
+MD5 hash.
+
+See L<DBIx::Class::Storage/"relname_to_table_alias">.
+
+=cut
+
+sub relname_to_table_alias {
+  my $self = shift;
+  my ($relname, $join_count) = @_;
+
+  my $alias = $self->next::method(@_);
+
+  return $alias if length($alias) <= 30;
+
+  # get a base64 md5 of the alias with join_count
+  require Digest::MD5;
+  my $ctx = Digest::MD5->new;
+  $ctx->add($alias);
+  my $md5 = $ctx->b64digest;
+
+  # remove alignment mark just in case
+  $md5 =~ s/=*\z//;
+
+  # truncate and prepend to truncated relname without vowels
+  (my $devoweled = $relname) =~ s/[aeiou]//g;
+  my $shortened = substr($devoweled, 0, 18);
+
+  my $new_alias =
+    $shortened . '_' . substr($md5, 0, 30 - length($shortened) - 1);
+
+  return $new_alias;
+}
+
 =head1 AUTHOR
 
 See L<DBIx::Class/CONTRIBUTORS>.

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Oracle.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -30,11 +30,6 @@
 
 DBIx::Class::Storage::DBI::Oracle - Base class for Oracle driver
 
-=head1 SYNOPSIS
-
-  # In your table classes
-  __PACKAGE__->load_components(qw/Core/);
-
 =head1 DESCRIPTION
 
 This class simply provides a mechanism for discovering and loading a sub-class

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Pg.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Pg.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Pg.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -189,8 +189,8 @@
 
 =head1 SYNOPSIS
 
-  # In your table classes
-  __PACKAGE__->load_components(qw/PK::Auto Core/);
+  # In your result (table) classes
+  use base 'DBIx::Class::Core';
   __PACKAGE__->set_primary_key('id');
   __PACKAGE__->sequence('mysequence');
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Introduction.pod
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Introduction.pod	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Introduction.pod	2010-01-17 16:20:32 UTC (rev 8345)
@@ -89,26 +89,25 @@
 you use (or upgrade to) the latest L<Catalyst::Model::DBIC::Schema>, which makes
 this job even easier.
 
-First, you need to connect your L<DBIx::Class::Schema>.  Let's assume you have
-such a schema called, "MyApp::Schema".
+First, you need to get a C<$schema> object and set the storage_type:
 
-	use MyApp::Schema;
-	my $schema = MyApp::Schema->connect($dsn, $user, $pass);
+  my $schema = MyApp::Schema->clone;
+  $schema->storage_type([
+    '::DBI::Replicated' => {
+      balancer_type => '::Random',
+      balancer_args => {
+        auto_validate_every => 5,
+        master_read_weight => 1
+      },
+      pool_args => {
+        maximum_lag =>2,
+      },
+    }
+  ]);
 
-Next, you need to set the storage_type.
+Then, you need to connect your L<DBIx::Class::Schema>.
 
-	$schema->storage_type(
-		::DBI::Replicated' => {
-			balancer_type => '::Random',
-            balancer_args => {
-				auto_validate_every => 5,
-				master_read_weight => 1
-			},
-			pool_args => {
-				maximum_lag =>2,
-			},
-		}
-	);
+  $schema->connection($dsn, $user, $pass);
 
 Let's break down the settings.  The method L<DBIx::Class::Schema/storage_type>
 takes one mandatory parameter, a scalar value, and an option second value which
@@ -160,11 +159,11 @@
 After you've configured the replicated storage, you need to add the connection
 information for the replicants:
 
-	$schema->storage->connect_replicants(
-		[$dsn1, $user, $pass, \%opts],
- 		[$dsn2, $user, $pass, \%opts],
- 		[$dsn3, $user, $pass, \%opts],
- 	);
+  $schema->storage->connect_replicants(
+    [$dsn1, $user, $pass, \%opts],
+    [$dsn2, $user, $pass, \%opts],
+    [$dsn3, $user, $pass, \%opts],
+  );
 
 These replicants should be configured as slaves to the master using the
 instructions for MySQL native replication, or if you are just learning, you

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,7 +1,6 @@
 package DBIx::Class::Storage::DBI::Replicated::Pool;
 
 use Moose;
-use MooseX::AttributeHelpers;
 use DBIx::Class::Storage::DBI::Replicated::Replicant;
 use List::Util 'sum';
 use Scalar::Util 'reftype';
@@ -125,26 +124,31 @@
 
 has 'replicants' => (
   is=>'rw',
-  metaclass => 'Collection::Hash',
+  traits => ['Hash'],
   isa=>HashRef['Object'],
   default=>sub {{}},
-  provides  => {
-    'set' => 'set_replicant',
-    'get' => 'get_replicant',
-    'empty' => 'has_replicants',
-    'count' => 'num_replicants',
-    'delete' => 'delete_replicant',
-    'values' => 'all_replicant_storages',
+  handles  => {
+    'set_replicant' => 'set',
+    'get_replicant' => 'get',
+    'has_replicants' => 'is_empty',
+    'num_replicants' => 'count',
+    'delete_replicant' => 'delete',
+    'all_replicant_storages' => 'values',
   },
 );
 
+around has_replicants => sub {
+    my ($orig, $self) = @_;
+    return !$self->$orig;
+};
+
 has next_unknown_replicant_id => (
   is => 'rw',
-  metaclass => 'Counter',
+  traits => ['Counter'],
   isa => Int,
   default => 1,
-  provides => {
-    inc => 'inc_unknown_replicant_id'
+  handles => {
+    'inc_unknown_replicant_id' => 'inc',
   },
 );
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Replicated.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -7,8 +7,7 @@
   ## use, so we explicitly test for these.
 
   my %replication_required = (
-    'Moose' => '0.87',
-    'MooseX::AttributeHelpers' => '0.21',
+    'Moose' => '0.90',
     'MooseX::Types' => '0.16',
     'namespace::clean' => '0.11',
     'Hash::Merge' => '0.11'
@@ -51,7 +50,9 @@
 also define your arguments, such as which balancer you want and any arguments
 that the Pool object should get.
 
+  my $schema = Schema::Class->clone;
   $schema->storage_type( ['::DBI::Replicated', {balancer=>'::Random'}] );
+  $schema->connection(...);
 
 Next, you need to add in the Replicants.  Basically this is an array of 
 arrayrefs, where each arrayref is database connect information.  Think of these
@@ -119,8 +120,7 @@
 
 Replicated Storage has additional requirements not currently part of L<DBIx::Class>
 
-  Moose => '0.87',
-  MooseX::AttributeHelpers => '0.20',
+  Moose => '0.90',
   MooseX::Types => '0.16',
   namespace::clean => '0.11',
   Hash::Merge => '0.11'

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/SQLite.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/SQLite.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -74,7 +74,7 @@
 =head1 SYNOPSIS
 
   # In your table classes
-  __PACKAGE__->load_components(qw/PK::Auto Core/);
+  use base 'DBIx::Class::Core';
   __PACKAGE__->set_primary_key('id');
 
 =head1 DESCRIPTION

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -13,7 +13,11 @@
   my $self = shift;
   my $dbh  = $self->_get_dbh;
 
+  return if ref $self ne __PACKAGE__;
+
   if (not $self->_typeless_placeholders_supported) {
+    require
+      DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars;
     bless $self,
       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
     $self->_rebless;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/mysql.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/mysql.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI/mysql.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -106,6 +106,19 @@
 session variables such that MySQL behaves more predictably as far as the
 SQL standard is concerned.
 
+=head1 STORAGE OPTIONS
+
+=head2 set_strict_mode
+
+Enables session-wide strict options upon connecting. Equivalent to:
+
+  ->connect ( ... , {
+    on_connect_do => [
+      q|SET SQL_MODE = CONCAT('ANSI,TRADITIONAL,ONLY_FULL_GROUP_BY,', @@sql_mode)|,
+      q|SET SQL_AUTO_IS_NULL = 0|,
+    ]
+  });
+
 =head1 AUTHORS
 
 See L<DBIx::Class/CONTRIBUTORS>

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Storage/DBI.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -451,14 +451,51 @@
 =cut
 
 sub connect_info {
-  my ($self, $info_arg) = @_;
+  my ($self, $info) = @_;
 
-  return $self->_connect_info if !$info_arg;
+  return $self->_connect_info if !$info;
 
+  $self->_connect_info($info); # copy for _connect_info
+
+  $info = $self->_normalize_connect_info($info)
+    if ref $info eq 'ARRAY';
+
+  for my $storage_opt (keys %{ $info->{storage_options} }) {
+    my $value = $info->{storage_options}{$storage_opt};
+
+    $self->$storage_opt($value);
+  }
+
+  # Kill sql_maker/_sql_maker_opts, so we get a fresh one with only
+  #  the new set of options
+  $self->_sql_maker(undef);
+  $self->_sql_maker_opts({});
+
+  for my $sql_maker_opt (keys %{ $info->{sql_maker_options} }) {
+    my $value = $info->{sql_maker_options}{$sql_maker_opt};
+
+    $self->_sql_maker_opts->{$sql_maker_opt} = $value;
+  }
+
+  my %attrs = (
+    %{ $self->_default_dbi_connect_attributes || {} },
+    %{ $info->{attributes} || {} },
+  );
+
+  my @args = @{ $info->{arguments} };
+
+  $self->_dbi_connect_info([@args,
+    %attrs && !(ref $args[0] eq 'CODE') ? \%attrs : ()]);
+
+  return $self->_connect_info;
+}
+
+sub _normalize_connect_info {
+  my ($self, $info_arg) = @_;
+  my %info;
+ 
   my @args = @$info_arg;  # take a shallow copy for further mutilation
-  $self->_connect_info([@args]); # copy for _connect_info
 
-
   # combine/pre-parse arguments depending on invocation style
 
   my %attrs;
@@ -494,36 +531,23 @@
     @args = @args[0,1,2];
   }
 
-  # Kill sql_maker/_sql_maker_opts, so we get a fresh one with only
-  #  the new set of options
-  $self->_sql_maker(undef);
-  $self->_sql_maker_opts({});
+  $info{arguments} = \@args; 
 
-  if(keys %attrs) {
-    for my $storage_opt (@storage_options, 'cursor_class') {    # @storage_options is declared at the top of the module
-      if(my $value = delete $attrs{$storage_opt}) {
-        $self->$storage_opt($value);
-      }
-    }
-    for my $sql_maker_opt (qw/limit_dialect quote_char name_sep/) {
-      if(my $opt_val = delete $attrs{$sql_maker_opt}) {
-        $self->_sql_maker_opts->{$sql_maker_opt} = $opt_val;
-      }
-    }
-  }
+  my @storage_opts = grep exists $attrs{$_},
+    @storage_options, 'cursor_class';
 
-  if (ref $args[0] eq 'CODE') {
-    # _connect() never looks past $args[0] in this case
-    %attrs = ()
-  } else {
-    %attrs = (
-      %{ $self->_default_dbi_connect_attributes || {} },
-      %attrs,
-    );
-  }
+  @{ $info{storage_options} }{@storage_opts} =
+    delete @attrs{@storage_opts} if @storage_opts;
 
-  $self->_dbi_connect_info([@args, keys %attrs ? \%attrs : ()]);
-  $self->_connect_info;
+  my @sql_maker_opts = grep exists $attrs{$_},
+    qw/limit_dialect quote_char name_sep/;
+
+  @{ $info{sql_maker_options} }{@sql_maker_opts} =
+    delete @attrs{@sql_maker_opts} if @sql_maker_opts;
+
+  $info{attributes} = \%attrs if %attrs;
+
+  return \%info;
 }
 
 sub _default_dbi_connect_attributes {
@@ -1360,7 +1384,6 @@
   return $updated_cols;
 }
 
-## Still not quite perfect, and EXPERIMENTAL
 ## Currently it is assumed that all values passed will be "normal", i.e. not
 ## scalar refs, or at least, all the same type as the first set, the statement is
 ## only prepped once.
@@ -1581,6 +1604,14 @@
 
   # quick check if we got a sane rs on our hands
   my @pcols = $rsrc->primary_columns;
+  unless (@pcols) {
+    $self->throw_exception (
+      sprintf (
+        "You must declare primary key(s) on source '%s' (via set_primary_key) in order to update or delete complex resultsets",
+        $rsrc->source_name || $rsrc->from
+      )
+    );
+  }
 
   my $sel = $rs->_resolved_attrs->{select};
   $sel = [ $sel ] unless ref $sel eq 'ARRAY';
@@ -1760,17 +1791,69 @@
 
   my @limit;
 
-  # see if we need to tear the prefetch apart (either limited has_many or grouped prefetch)
-  # otherwise delegate the limiting to the storage, unless software limit was requested
+  # see if we need to tear the prefetch apart otherwise delegate the limiting to the
+  # storage, unless software limit was requested
   if (
+    #limited has_many
     ( $attrs->{rows} && keys %{$attrs->{collapse}} )
        ||
-    ( $attrs->{group_by} && @{$attrs->{group_by}} &&
-      $attrs->{_prefetch_select} && @{$attrs->{_prefetch_select}} )
+    # limited prefetch with RNO subqueries
+    (
+      $attrs->{rows}
+        &&
+      $sql_maker->limit_dialect eq 'RowNumberOver'
+        &&
+      $attrs->{_prefetch_select}
+        &&
+      @{$attrs->{_prefetch_select}}
+    )
+      ||
+    # grouped prefetch
+    ( $attrs->{group_by}
+        &&
+      @{$attrs->{group_by}}
+        &&
+      $attrs->{_prefetch_select}
+        &&
+      @{$attrs->{_prefetch_select}}
+    )
   ) {
     ($ident, $select, $where, $attrs)
       = $self->_adjust_select_args_for_complex_prefetch ($ident, $select, $where, $attrs);
   }
+
+  elsif (
+    ($attrs->{rows} || $attrs->{offset})
+      &&
+    $sql_maker->limit_dialect eq 'RowNumberOver'
+      &&
+    (ref $ident eq 'ARRAY' && @$ident > 1)  # indicates a join
+      &&
+    scalar $sql_maker->_order_by_chunks ($attrs->{order_by})
+  ) {
+    # the RNO limit dialect above mangles the SQL such that the join gets lost
+    # wrap a subquery here
+
+    push @limit, delete @{$attrs}{qw/rows offset/};
+
+    my $subq = $self->_select_args_to_query (
+      $ident,
+      $select,
+      $where,
+      $attrs,
+    );
+
+    $ident = {
+      -alias => $attrs->{alias},
+      -source_handle => $ident->[0]{-source_handle},
+      $attrs->{alias} => $subq,
+    };
+
+    # all part of the subquery now
+    delete @{$attrs}{qw/order_by group_by having/};
+    $where = undef;
+  }
+
   elsif (! $attrs->{software_limit} ) {
     push @limit, $attrs->{rows}, $attrs->{offset};
   }
@@ -2088,7 +2171,7 @@
 }
 
 
-=head2 create_ddl_dir (EXPERIMENTAL)
+=head2 create_ddl_dir
 
 =over 4
 
@@ -2140,11 +2223,9 @@
  { ignore_constraint_names => 0, # ... other options }
 
 
-Note that this feature is currently EXPERIMENTAL and may not work correctly
-across all databases, or fully handle complex relationships.
+WARNING: You are strongly advised to check all SQL files created, before applying
+them.
 
-WARNING: Please check all SQL files created, before applying them.
-
 =cut
 
 sub create_ddl_dir {
@@ -2325,10 +2406,19 @@
     data => $schema,
   );
 
-  my $ret = $tr->translate
-    or $self->throw_exception( 'Unable to produce deployment statements: ' . $tr->error);
+  my @ret;
+  my $wa = wantarray;
+  if ($wa) {
+    @ret = $tr->translate;
+  }
+  else {
+    $ret[0] = $tr->translate;
+  }
 
-  return $ret;
+  $self->throw_exception( 'Unable to produce deployment statements: ' . $tr->error)
+    unless (@ret && defined $ret[0]);
+
+  return $wa ? @ret : $ret[0];
 }
 
 sub deploy {
@@ -2453,6 +2543,34 @@
   sub _sqlt_minimum_version { $minimum_sqlt_version };
 }
 
+=head2 relname_to_table_alias
+
+=over 4
+
+=item Arguments: $relname, $join_count
+
+=back
+
+L<DBIx::Class> uses L<DBIx::Class::Relationship> names as table aliases in
+queries.
+
+This hook is to allow specific L<DBIx::Class::Storage> drivers to change the
+way these aliases are named.
+
+The default behavior is C<"$relname_$join_count" if $join_count > 1>, otherwise
+C<"$relname">.
+
+=cut
+
+sub relname_to_table_alias {
+  my ($self, $relname, $join_count) = @_;
+
+  my $alias = ($join_count && $join_count > 1 ?
+    join('_', $relname, $join_count) : $relname);
+
+  return $alias;
+}
+
 sub DESTROY {
   my $self = shift;
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/UTF8Columns.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/UTF8Columns.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/UTF8Columns.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -2,18 +2,8 @@
 use strict;
 use warnings;
 use base qw/DBIx::Class/;
+use utf8;
 
-BEGIN {
-
-    # Perl 5.8.0 doesn't have utf8::is_utf8()
-    # Yes, 5.8.0 support for Unicode is suboptimal, but things like RHEL3 ship with it.
-    if ($] <= 5.008000) {
-        require Encode;
-    } else {
-        require utf8;
-    }
-}
-
 __PACKAGE__->mk_classdata( '_utf8_columns' );
 
 =head1 NAME
@@ -23,7 +13,9 @@
 =head1 SYNOPSIS
 
     package Artist;
-    __PACKAGE__->load_components(qw/UTF8Columns Core/);
+    use base 'DBIx::Class::Core';
+
+    __PACKAGE__->load_components(qw/UTF8Columns/);
     __PACKAGE__->utf8_columns(qw/name description/);
 
     # then belows return strings with utf8 flag
@@ -34,6 +26,15 @@
 
 This module allows you to get columns data that have utf8 (Unicode) flag.
 
+=head2 Warning
+
+Note that this module overloads L<DBIx::Class::Row/store_column> in a way
+that may prevent other components overloading the same method from working
+correctly. This component must be the last one before L<DBIx::Class::Row>
+(which is provided by L<DBIx::Class::Core>). DBIx::Class will detect such
+incorrect component order and issue an appropriate warning, advising which
+components need to be loaded differently.
+
 =head1 SEE ALSO
 
 L<Template::Stash::ForceUTF8>, L<DBIx::Class::UUIDColumns>.
@@ -50,7 +51,7 @@
         foreach my $col (@_) {
             $self->throw_exception("column $col doesn't exist")
                 unless $self->has_column($col);
-        }        
+        }
         return $self->_utf8_columns({ map { $_ => 1 } @_ });
     } else {
         return $self->_utf8_columns;
@@ -67,17 +68,11 @@
     my ( $self, $column ) = @_;
     my $value = $self->next::method($column);
 
-    my $cols = $self->_utf8_columns;
-    if ( $cols and defined $value and $cols->{$column} ) {
+    utf8::decode($value) if (
+      defined $value and $self->_is_utf8_column($column) and ! utf8::is_utf8($value)
+    );
 
-        if ($] <= 5.008000) {
-            Encode::_utf8_on($value) unless Encode::is_utf8($value);
-        } else {
-            utf8::decode($value) unless utf8::is_utf8($value);
-        }
-    }
-
-    $value;
+    return $value;
 }
 
 =head2 get_columns
@@ -88,16 +83,13 @@
     my $self = shift;
     my %data = $self->next::method(@_);
 
-    foreach my $col (grep { defined $data{$_} } keys %{ $self->_utf8_columns || {} }) {
-
-        if ($] <= 5.008000) {
-            Encode::_utf8_on($data{$col}) unless Encode::is_utf8($data{$col});
-        } else {
-            utf8::decode($data{$col}) unless utf8::is_utf8($data{$col});
-        }
+    foreach my $col (keys %data) {
+      utf8::decode($data{$col}) if (
+        exists $data{$col} and defined $data{$col} and $self->_is_utf8_column($col) and ! utf8::is_utf8($data{$col})
+      );
     }
 
-    %data;
+    return %data;
 }
 
 =head2 store_column
@@ -107,32 +99,32 @@
 sub store_column {
     my ( $self, $column, $value ) = @_;
 
-    my $cols = $self->_utf8_columns;
-    if ( $cols and defined $value and $cols->{$column} ) {
+    # the dirtyness comparison must happen on the non-encoded value
+    my $copy;
 
-        if ($] <= 5.008000) {
-            Encode::_utf8_off($value) if Encode::is_utf8($value);
-        } else {
-            utf8::encode($value) if utf8::is_utf8($value);
-        }
+    if ( defined $value and $self->_is_utf8_column($column) and utf8::is_utf8($value) ) {
+      $copy = $value;
+      utf8::encode($value);
     }
 
     $self->next::method( $column, $value );
+
+    return $copy || $value;
 }
 
-=head1 AUTHOR
+# override this if you want to force everything to be encoded/decoded
+sub _is_utf8_column {
+  return (shift->utf8_columns || {})->{shift};
+}
 
-Daisuke Murase <typester at cpan.org>
+=head1 AUTHORS
 
-=head1 COPYRIGHT
+See L<DBIx::Class/CONTRIBUTORS>.
 
-This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
+=head1 LICENSE
 
-The full text of the license can be found in the
-LICENSE file included with this module.
+You may distribute this code under the same terms as Perl itself.
 
 =cut
 
 1;
-

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -4,9 +4,10 @@
 use warnings;
 
 use MRO::Compat;
+use mro 'c3';
 
 use vars qw($VERSION);
-use base qw/Class::C3::Componentised Class::Accessor::Grouped/;
+use base qw/DBIx::Class::Componentised Class::Accessor::Grouped/;
 use DBIx::Class::StartupCheck;
 
 sub mk_classdata {
@@ -24,7 +25,7 @@
 # Always remember to do all digits for the version even if they're 0
 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
 # brain damage and presumably various other packaging systems too
-$VERSION = '0.08114';
+$VERSION = '0.08115';
 
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 
@@ -78,9 +79,8 @@
 See L<DBIx::Class::ResultSource> for docs on defining result classes.
 
   package MyDB::Schema::Result::Artist;
-  use base qw/DBIx::Class/;
+  use base qw/DBIx::Class::Core/;
 
-  __PACKAGE__->load_components(qw/Core/);
   __PACKAGE__->table('artist');
   __PACKAGE__->add_columns(qw/ artistid name /);
   __PACKAGE__->set_primary_key('artistid');
@@ -92,9 +92,9 @@
 MyDB/Schema/Result/CD.pm:
 
   package MyDB::Schema::Result::CD;
-  use base qw/DBIx::Class/;
+  use base qw/DBIx::Class::Core/;
 
-  __PACKAGE__->load_components(qw/Core/);
+  __PACKAGE__->load_components(qw/InflateColumn::DateTime/);
   __PACKAGE__->table('cd');
   __PACKAGE__->add_columns(qw/ cdid artistid title year /);
   __PACKAGE__->set_primary_key('cdid');
@@ -117,7 +117,7 @@
   # Output all artists names
   # $artist here is a DBIx::Class::Row, which has accessors
   # for all its columns. Rows are also subclasses of your Result class.
-  foreach $artist (@artists) {
+  foreach $artist (@all_artists) {
     print $artist->name, "\n";
   }
 
@@ -295,6 +295,8 @@
 
 Numa: Dan Sully <daniel at cpan.org>
 
+ovid: Curtis "Ovid" Poe <ovid at cpan.org>
+
 oyse: Øystein Torget <oystein.torget at dnv.com>
 
 paulm: Paul Makepeace

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/SQL/Translator/Parser/DBIx/Class.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/SQL/Translator/Parser/DBIx/Class.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -15,6 +15,7 @@
 use Exporter;
 use SQL::Translator::Utils qw(debug normalize_name);
 use Carp::Clan qw/^SQL::Translator|^DBIx::Class/;
+use Scalar::Util ();
 
 use base qw(Exporter);
 
@@ -30,6 +31,10 @@
 # We're working with DBIx::Class Schemas, not data streams.
 # -------------------------------------------------------------------
 sub parse {
+    # this is a hack to prevent schema leaks due to a retarded SQLT implementation
+    # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway)
+    Scalar::Util::weaken ($_[1]);
+
     my ($tr, $data)   = @_;
     my $args          = $tr->parser_args;
     my $dbicschema    = $args->{'DBIx::Class::Schema'} ||  $args->{"DBIx::Schema"} ||$data;
@@ -65,19 +70,19 @@
     }
 
 
-    my(@table_monikers, @view_monikers);
+    my(%table_monikers, %view_monikers);
     for my $moniker (@monikers){
       my $source = $dbicschema->source($moniker);
        if ( $source->isa('DBIx::Class::ResultSource::Table') ) {
-         push(@table_monikers, $moniker);
+         $table_monikers{$moniker}++;
       } elsif( $source->isa('DBIx::Class::ResultSource::View') ){
           next if $source->is_virtual;
-         push(@view_monikers, $moniker);
+         $view_monikers{$moniker}++;
       }
     }
 
     my %tables;
-    foreach my $moniker (sort @table_monikers)
+    foreach my $moniker (sort keys %table_monikers)
     {
         my $source = $dbicschema->source($moniker);
         my $table_name = $source->name;
@@ -112,9 +117,11 @@
             my $f = $table->add_field(%colinfo)
               || $dbicschema->throw_exception ($table->error);
         }
-        $table->primary_key($source->primary_columns);
 
         my @primary = $source->primary_columns;
+
+        $table->primary_key(@primary) if @primary;
+
         my %unique_constraints = $source->unique_constraints;
         foreach my $uniq (sort keys %unique_constraints) {
             if (!$source->_compare_relationship_keys($unique_constraints{$uniq}, \@primary)) {
@@ -131,19 +138,23 @@
         my %created_FK_rels;
 
         # global add_fk_index set in parser_args
-        my $add_fk_index = (exists $args->{add_fk_index} && ($args->{add_fk_index} == 0)) ? 0 : 1;
+        my $add_fk_index = (exists $args->{add_fk_index} && ! $args->{add_fk_index}) ? 0 : 1;
 
         foreach my $rel (sort @rels)
         {
+
             my $rel_info = $source->relationship_info($rel);
 
             # Ignore any rel cond that isn't a straight hash
             next unless ref $rel_info->{cond} eq 'HASH';
 
-            my $othertable = $source->related_source($rel);
-            next if $othertable->isa('DBIx::Class::ResultSource::View');  # can't define constraints referencing a view
-            my $rel_table = $othertable->name;
+            my $relsource = $source->related_source($rel);
 
+            # related sources might be excluded via a {sources} filter or might be views
+            next unless exists $table_monikers{$relsource->source_name};
+
+            my $rel_table = $relsource->name;
+
             # FIXME - this isn't the right way to do it, but sqlt does not
             # support quoting properly to be signaled about this
             $rel_table = $$rel_table if ref $rel_table eq 'SCALAR';
@@ -153,7 +164,7 @@
 
             # Force the order of @cond to match the order of ->add_columns
             my $idx;
-            my %other_columns_idx = map {'foreign.'.$_ => ++$idx } $othertable->columns;            
+            my %other_columns_idx = map {'foreign.'.$_ => ++$idx } $relsource->columns;
             my @cond = sort { $other_columns_idx{$a} cmp $other_columns_idx{$b} } keys(%{$rel_info->{cond}}); 
 
             # Get the key information, mapping off the foreign/self markers
@@ -210,11 +221,12 @@
 
                   my $is_deferrable = $rel_info->{attrs}{is_deferrable};
 
-                  # do not consider deferrable constraints and self-references
-                  # for dependency calculations
+                  # calculate dependencies: do not consider deferrable constraints and
+                  # self-references for dependency calculations
                   if (! $is_deferrable and $rel_table ne $table_name) {
                     $tables{$table_name}{foreign_table_deps}{$rel_table}++;
                   }
+
                   $table->add_constraint(
                                     type             => 'foreign_key',
                                     name             => join('_', $table_name, 'fk', @keys),
@@ -274,7 +286,7 @@
     }
 
     my %views;
-    foreach my $moniker (sort @view_monikers)
+    foreach my $moniker (sort keys %view_monikers)
     {
         my $source = $dbicschema->source($moniker);
         my $view_name = $source->name;
@@ -289,6 +301,9 @@
         # Its possible to have multiple DBIC source using same table
         next if $views{$view_name}++;
 
+        $dbicschema->throw_exception ("view $view_name is missing a view_definition")
+            unless $source->view_definition;
+
         my $view = $schema->add_view (
           name => $view_name,
           fields => [ $source->columns ],
@@ -364,7 +379,14 @@
  my $schema = MyApp::Schema->connect;
  my $trans  = SQL::Translator->new (
       parser      => 'SQL::Translator::Parser::DBIx::Class',
-      parser_args => { package => $schema },
+      parser_args => {
+          package => $schema,
+          # to explicitly specify which ResultSources are to be parsed
+          sources => [qw/
+            Artist
+            CD
+          /],
+      },
       producer    => 'SQLite',
      ) or die SQL::Translator->error;
  my $out = $trans->translate() or die $trans->error;

Deleted: DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,75 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use IO::File;
-
-use lib qw(t/lib);
-use DBIC::SqlMakerTest;
-
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 7 );
-}
-
-
-use_ok('DBICTest');
-use_ok('DBIC::DebugObj');
-my $schema = DBICTest->init_schema();
-
-#diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
-
-$schema->storage->sql_maker->quote_char('`');
-$schema->storage->sql_maker->name_sep('.');
-
-my ($sql, @bind);
-$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
-$schema->storage->debug(1);
-
-my $rs;
-
-$rs = $schema->resultset('CD')->search(
-           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
-           { join => 'artist' });
-eval { $rs->count };
-is_same_sql_bind(
-  $sql, \@bind,
-  "SELECT COUNT( * ) FROM cd `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
-  'got correct SQL for count query with quoting'
-);
-
-my $order = 'year DESC';
-$rs = $schema->resultset('CD')->search({},
-            { 'order_by' => $order });
-eval { $rs->first };
-like($sql, qr/ORDER BY `\Q${order}\E`/, 'quoted ORDER BY with DESC (should use a scalarref anyway)');
-
-$rs = $schema->resultset('CD')->search({},
-            { 'order_by' => \$order });
-eval { $rs->first };
-like($sql, qr/ORDER BY \Q${order}\E/, 'did not quote ORDER BY with scalarref');
-
-$schema->storage->sql_maker->quote_char([qw/[ ]/]);
-$schema->storage->sql_maker->name_sep('.');
-
-$rs = $schema->resultset('CD')->search(
-           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
-           { join => 'artist' });
-eval { $rs->count };
-is_same_sql_bind(
-  $sql, \@bind,
-  "SELECT COUNT( * ) FROM cd [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
-  'got correct SQL for count query with bracket quoting'
-);
-
-my %data = (
-       name => 'Bill',
-       order => '12'
-);
-
-$schema->storage->sql_maker->quote_char('`');
-$schema->storage->sql_maker->name_sep('.');
-
-is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');

Deleted: DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes_newstyle.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes_newstyle.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,92 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use IO::File;
-
-use lib qw(t/lib);
-use DBIC::SqlMakerTest;
-
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 7 );
-}
-
-use_ok('DBICTest');
-use_ok('DBIC::DebugObj');
-
-my $schema = DBICTest->init_schema();
-
-#diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
-
-my $dsn = $schema->storage->_dbi_connect_info->[0];
-$schema->connection(
-  $dsn,
-  undef,
-  undef,
-  { AutoCommit => 1 },
-  { quote_char => '`', name_sep => '.' },
-);
-
-my ($sql, @bind);
-$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)),
-$schema->storage->debug(1);
-
-my $rs;
-
-$rs = $schema->resultset('CD')->search(
-           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
-           { join => 'artist' });
-eval { $rs->count };
-is_same_sql_bind(
-  $sql, \@bind,
-  "SELECT COUNT( * ) FROM cd `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
-  'got correct SQL for count query with quoting'
-);
-
-my $order = 'year DESC';
-$rs = $schema->resultset('CD')->search({},
-            { 'order_by' => $order });
-eval { $rs->first };
-like($sql, qr/ORDER BY `\Q${order}\E`/, 'quoted ORDER BY with DESC (should use a scalarref anyway)');
-
-$rs = $schema->resultset('CD')->search({},
-            { 'order_by' => \$order });
-eval { $rs->first };
-like($sql, qr/ORDER BY \Q${order}\E/, 'did not quote ORDER BY with scalarref');
-
-$schema->connection(
-  $dsn,
-  undef,
-  undef,
-  { AutoCommit => 1, quote_char => [qw/[ ]/], name_sep => '.' }
-);
-
-$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)),
-$schema->storage->debug(1);
-
-$rs = $schema->resultset('CD')->search(
-           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
-           { join => 'artist' });
-eval { $rs->count };
-is_same_sql_bind(
-  $sql, \@bind,
-  "SELECT COUNT( * ) FROM cd [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
-  'got correct SQL for count query with bracket quoting'
-);
-
-my %data = (
-       name => 'Bill',
-       order => '12'
-);
-
-$schema->connection(
-  $dsn,
-  undef,
-  undef,
-  { AutoCommit => 1, quote_char => '`', name_sep => '.' }
-);
-
-is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/20setuperrors.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/20setuperrors.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/20setuperrors.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,15 +1,19 @@
-#!/usr/bin/perl
+use warnings;
+use strict;
 
-use Test::More tests => 1;
+use Test::More;
+use Test::Exception;
 
-eval {
-  package BuggyTable;
-  use base 'DBIx::Class';
+throws_ok (
+  sub {
+    package BuggyTable;
+    use base 'DBIx::Class::Core';
 
-  __PACKAGE__->load_components qw/Core/;
-  __PACKAGE__->table('buggy_table');
-  __PACKAGE__->columns qw/this doesnt work as expected/;
-};
+    __PACKAGE__->table('buggy_table');
+    __PACKAGE__->columns qw/this doesnt work as expected/;
+  },
+  qr/\bcolumns\(\) is a read-only/,
+  'columns() error when apparently misused',
+);
 
-like($@,qr/\bcolumns\(\) is a read-only/,
-     "columns() error when apparently misused");
+done_testing;

Deleted: DBIx-Class/0.08/branches/dbicadmin_refactor/t/42toplimit.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/42toplimit.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/42toplimit.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,152 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use lib qw(t/lib);
-use DBICTest;
-use DBIC::SqlMakerTest;
-
-my $schema = DBICTest->init_schema;
-
-# Trick the sqlite DB to use Top limit emulation
-# We could test all of this via $sq->$op directly,
-# but some conditions need a $rsrc
-delete $schema->storage->_sql_maker->{_cached_syntax};
-$schema->storage->_sql_maker->limit_dialect ('Top');
-
-my $rs = $schema->resultset ('BooksInLibrary')->search ({}, { prefetch => 'owner', rows => 1, offset => 3 });
-
-sub default_test_order {
-   my $order_by = shift;
-   is_same_sql_bind(
-      $rs->search ({}, {order_by => $order_by})->as_query,
-      "(SELECT
-        TOP 1 me__id, source, owner, title, price, owner__id, name FROM
-         (SELECT
-           TOP 4 me.id AS me__id, me.source, me.owner, me.title, me.price, owner.id AS owner__id, owner.name
-           FROM books me
-           JOIN owners owner ON
-           owner.id = me.owner
-           WHERE ( source = ? )
-           ORDER BY me__id ASC
-         ) me ORDER BY me__id DESC
-       )",
-    [ [ source => 'Library' ] ],
-  );
-}
-
-sub test_order {
-  my $args = shift;
-
-  my $req_order = $args->{order_req}
-    ? "ORDER BY $args->{order_req}"
-    : ''
-  ;
-
-  is_same_sql_bind(
-    $rs->search ({}, {order_by => $args->{order_by}})->as_query,
-    "(SELECT
-      me__id, source, owner, title, price, owner__id, name FROM
-      (SELECT
-        TOP 1 me__id, source, owner, title, price, owner__id, name FROM
-         (SELECT
-           TOP 4 me.id AS me__id, me.source, me.owner, me.title, me.price, owner.id AS owner__id, owner.name FROM
-           books me
-           JOIN owners owner ON owner.id = me.owner
-           WHERE ( source = ? )
-           ORDER BY $args->{order_inner}
-         ) me ORDER BY $args->{order_outer}
-      ) me $req_order
-    )",
-    [ [ source => 'Library' ] ],
-  );
-}
-
-my @tests = (
-  {
-    order_by => \'foo DESC',
-    order_req => 'foo DESC',
-    order_inner => 'foo DESC',
-    order_outer => 'foo ASC'
-  },
-  {
-    order_by => { -asc => 'foo'  },
-    order_req => 'foo ASC',
-    order_inner => 'foo ASC',
-    order_outer => 'foo DESC',
-  },
-  {
-    order_by => 'foo',
-    order_req => 'foo',
-    order_inner => 'foo ASC',
-    order_outer => 'foo DESC',
-  },
-  {
-    order_by => [ qw{ foo bar}   ],
-    order_req => 'foo, bar',
-    order_inner => 'foo ASC,bar ASC',
-    order_outer => 'foo DESC, bar DESC',
-  },
-  {
-    order_by => { -desc => 'foo' },
-    order_req => 'foo DESC',
-    order_inner => 'foo DESC',
-    order_outer => 'foo ASC',
-  },
-  {
-    order_by => ['foo', { -desc => 'bar' } ],
-    order_req => 'foo, bar DESC',
-    order_inner => 'foo ASC, bar DESC',
-    order_outer => 'foo DESC, bar ASC',
-  },
-  {
-    order_by => { -asc => [qw{ foo bar }] },
-    order_req => 'foo ASC, bar ASC',
-    order_inner => 'foo ASC, bar ASC',
-    order_outer => 'foo DESC, bar DESC',
-  },
-  {
-    order_by => [
-      { -asc => 'foo' },
-      { -desc => [qw{bar}] },
-      { -asc  => [qw{hello sensors}]},
-    ],
-    order_req => 'foo ASC, bar DESC, hello ASC, sensors ASC',
-    order_inner => 'foo ASC, bar DESC, hello ASC, sensors ASC',
-    order_outer => 'foo DESC, bar ASC, hello DESC, sensors DESC',
-  },
-);
-
-my @default_tests = ( undef, '', {}, [] );
-
-plan (tests => scalar @tests + scalar @default_tests + 1);
-
-test_order ($_) for @tests;
-default_test_order ($_) for @default_tests;
-
-
-is_same_sql_bind (
-  $rs->search ({}, { group_by => 'title', order_by => 'title' })->as_query,
-'(SELECT
-me.id, me.source, me.owner, me.title, me.price, owner.id, owner.name FROM
-   ( SELECT
-      id, source, owner, title, price FROM
-      ( SELECT
-         TOP 1 id, source, owner, title, price FROM
-         ( SELECT
-            TOP 4 me.id, me.source, me.owner, me.title, me.price FROM
-            books me  JOIN
-            owners owner ON owner.id = me.owner
-            WHERE ( source = ? )
-            GROUP BY title
-            ORDER BY title ASC
-         ) me
-         ORDER BY title DESC
-      ) me
-      ORDER BY title
-   ) me  JOIN
-   owners owner ON owner.id = me.owner WHERE
-   ( source = ? )
-   ORDER BY title)' ,
-  [ [ source => 'Library' ], [ source => 'Library' ] ],
-);

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threads.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threads.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threads.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -8,7 +8,7 @@
 
 BEGIN {
     plan skip_all => 'Your perl does not support ithreads'
-        if !$Config{useithreads} || $] < 5.008;
+        if !$Config{useithreads};
 }
 
 use threads;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threadtxn.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threadtxn.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/51threadtxn.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -8,7 +8,7 @@
 
 BEGIN {
     plan skip_all => 'Your perl does not support ithreads'
-        if !$Config{useithreads} || $] < 5.008;
+        if !$Config{useithreads};
 }
 
 use threads;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/52cycle.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/52cycle.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/52cycle.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -8,16 +8,36 @@
   eval { require Test::Memory::Cycle; require Devel::Cycle };
   if ($@ or Devel::Cycle->VERSION < 1.10) {
     plan skip_all => "leak test needs Test::Memory::Cycle and Devel::Cycle >= 1.10";
-  } else {
-    plan tests => 1;
-  }
+  };
 }
 
 use DBICTest;
 use DBICTest::Schema;
+use Scalar::Util ();
 
 import Test::Memory::Cycle;
 
-my $s = DBICTest::Schema->clone;
+my $weak;
 
-memory_cycle_ok($s, 'No cycles in schema');
+{
+  my $s = $weak->{schema} = DBICTest->init_schema;
+  memory_cycle_ok($s, 'No cycles in schema');
+
+  my $rs = $weak->{resultset} = $s->resultset ('Artist');
+  memory_cycle_ok($rs, 'No cycles in resultset');
+
+  my $rsrc = $weak->{resultsource} = $rs->result_source;
+  memory_cycle_ok($rsrc, 'No cycles in resultsource');
+
+  my $row = $weak->{row} = $rs->first;
+  memory_cycle_ok($row, 'No cycles in row');
+
+  Scalar::Util::weaken ($_) for values %$weak;
+  memory_cycle_ok($weak, 'No cycles in weak object collection');
+}
+
+for (keys %$weak) {
+  ok (! $weak->{$_}, "No $_ leaks");
+}
+
+done_testing;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/60core.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/60core.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/60core.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -109,10 +109,12 @@
 {
   ok(my $artist = $schema->resultset('Artist')->create({name => 'store_column test'}));
   is($artist->name, 'X store_column test'); # used to be 'X X store...'
-  
+
   # call store_column even though the column doesn't seem to be dirty
-  ok($artist->update({name => 'X store_column test'}));
+  $artist->name($artist->name);
   is($artist->name, 'X X store_column test');
+  ok($artist->is_column_changed('name'), 'changed column marked as dirty');
+
   $artist->delete;
 }
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/71mysql.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/71mysql.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/71mysql.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -225,6 +225,23 @@
       => 'Nothing Found!';
 }
 
+# check for proper grouped counts
+{
+  my $ansi_schema = DBICTest::Schema->connect ($dsn, $user, $pass, { on_connect_call => 'set_strict_mode' });
+  my $rs = $ansi_schema->resultset('CD');
+
+  my $years;
+  $years->{$_->year|| scalar keys %$years}++ for $rs->all;  # NULL != NULL, thus the keys eval
+
+  lives_ok ( sub {
+    is (
+      $rs->search ({}, { group_by => 'year'})->count,
+      scalar keys %$years,
+      'grouped count correct',
+    );
+  }, 'Grouped count does not throw');
+}
+
 ZEROINSEARCH: {
   my $cds_per_year = {
     2001 => 2,
@@ -243,11 +260,11 @@
   is ($rs->count, 6, 'CDs created successfully');
 
   $rs = $rs->search ({}, {
-    select => [ {year => 'year'} ], as => ['y'], distinct => 1, order_by => 'year',
+    select => [ \ 'YEAR(year)' ], as => ['y'], distinct => 1,
   });
 
   is_deeply (
-    [ $rs->get_column ('y')->all ],
+    [ sort ($rs->get_column ('y')->all) ],
     [ sort keys %$cds_per_year ],
     'Years group successfully',
   );
@@ -255,7 +272,7 @@
   $rs->create ({ artist => 1, year => '0-1-1', title => 'Jesus Rap' });
 
   is_deeply (
-    [ $rs->get_column ('y')->all ],
+    [ sort $rs->get_column ('y')->all ],
     [ 0, sort keys %$cds_per_year ],
     'Zero-year groups successfully',
   );

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/72pg.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/72pg.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/72pg.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -126,9 +126,8 @@
 
   use strict;
   use warnings;
-  use base 'DBIx::Class';
+  use base 'DBIx::Class::Core';
 
-  __PACKAGE__->load_components(qw/Core/);
   __PACKAGE__->table('dbic_t_schema.array_test');
   __PACKAGE__->add_columns(qw/id arrayfield/);
   __PACKAGE__->column_info_from_storage(1);
@@ -173,9 +172,8 @@
 
   use strict;
   use warnings;
-  use base 'DBIx::Class';
+  use base 'DBIx::Class::Core';
 
-  __PACKAGE__->load_components(qw/Core/);
   __PACKAGE__->table('dbic_t_schema.casecheck');
   __PACKAGE__->add_columns(qw/id name NAME uc_name/);
   __PACKAGE__->column_info_from_storage(1);
@@ -455,9 +453,8 @@
 
   use strict;
   use warnings;
-  use base 'DBIx::Class';
+  use base 'DBIx::Class::Core';
 
-  __PACKAGE__->load_components(qw/Core/);
   __PACKAGE__->table('apk');
 
   @eapk_id_columns = qw( id1 id2 id3 id4 );

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/73oracle.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/73oracle.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/73oracle.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -40,8 +40,6 @@
   ' as well as following sequences: \'pkid1_seq\', \'pkid2_seq\' and \'nonpkid_seq\''
   unless ($dsn && $user && $pass);
 
-plan tests => 36;
-
 DBICTest::Schema->load_classes('ArtistFQN');
 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
 
@@ -65,7 +63,7 @@
 $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), 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 cd (cdid NUMBER(12), artist NUMBER(12), title VARCHAR(255), year VARCHAR(4), genreid NUMBER(12), single_track NUMBER(12))");
 $dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE, last_updated_at DATE, small_dt DATE)");
 
 $dbh->do("ALTER TABLE artist ADD (CONSTRAINT artist_pk PRIMARY KEY (artistid))");
@@ -124,12 +122,39 @@
 is($new->artistid, 1, "Oracle Auto-PK worked");
 
 my $cd = $schema->resultset('CD')->create({ artist => 1, title => 'EP C', year => '2003' });
-is($new->artistid, 1, "Oracle Auto-PK worked - using scalar ref as table name");
+is($cd->cdid, 1, "Oracle Auto-PK worked - using scalar ref as table name");
 
 # test again with fully-qualified table name
 $new = $schema->resultset('ArtistFQN')->create( { name => 'bar' } );
 is( $new->artistid, 2, "Oracle Auto-PK worked with fully-qualified tablename" );
 
+# test rel names over the 30 char limit
+my $query = $schema->resultset('Artist')->search({
+  artistid => 1 
+}, {
+  prefetch => 'cds_very_very_very_long_relationship_name'
+});
+
+lives_and {
+  is $query->first->cds_very_very_very_long_relationship_name->first->cdid, 1
+} 'query with rel name over 30 chars survived and worked';
+
+# rel name over 30 char limit with user condition
+# This requires walking the SQLA data structure.
+{
+  local $TODO = 'user condition on rel longer than 30 chars';
+
+  $query = $schema->resultset('Artist')->search({
+    'cds_very_very_very_long_relationship_name.title' => 'EP C'
+  }, {
+    prefetch => 'cds_very_very_very_long_relationship_name'
+  });
+
+  lives_and {
+    is $query->first->cds_very_very_very_long_relationship_name->first->cdid, 1
+  } 'query with rel name over 30 chars and user condition survived and worked';
+}
+
 # test join with row count ambiguity
 
 my $track = $schema->resultset('Track')->create({ trackid => 1, cd => 1,
@@ -228,6 +253,8 @@
 	}
 }
 
+done_testing;
+
 # clean up our mess
 END {
     if($schema && ($dbh = $schema->storage->dbh)) {

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/746mssql.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/746mssql.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -28,6 +28,11 @@
 
 isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' );
 
+{
+  my $schema2 = $schema->connect ($schema->storage->connect_info);
+  ok (! $schema2->storage->connected, 'a re-connected cloned schema starts unconnected');
+}
+
 $schema->storage->dbh_do (sub {
     my ($storage, $dbh) = @_;
     eval { $dbh->do("DROP TABLE artist") };
@@ -173,10 +178,10 @@
 
 $schema->storage->dbh_do (sub {
     my ($storage, $dbh) = @_;
-    eval { $dbh->do("DROP TABLE Owners") };
-    eval { $dbh->do("DROP TABLE Books") };
+    eval { $dbh->do("DROP TABLE owners") };
+    eval { $dbh->do("DROP TABLE books") };
     $dbh->do(<<'SQL');
-CREATE TABLE Books (
+CREATE TABLE books (
    id INT IDENTITY (1, 1) NOT NULL,
    source VARCHAR(100),
    owner INT,
@@ -184,7 +189,7 @@
    price INT NULL
 )
 
-CREATE TABLE Owners (
+CREATE TABLE owners (
    id INT IDENTITY (1, 1) NOT NULL,
    name VARCHAR(100),
 )
@@ -200,10 +205,10 @@
     [qw/1   wiggle/],
     [qw/2   woggle/],
     [qw/3   boggle/],
-    [qw/4   fREW/],
-    [qw/5   fRIOUX/],
-    [qw/6   fROOH/],
-    [qw/7   fRUE/],
+    [qw/4   fRIOUX/],
+    [qw/5   fRUE/],
+    [qw/6   fREW/],
+    [qw/7   fROOH/],
     [qw/8   fISMBoC/],
     [qw/9   station/],
     [qw/10   mirror/],
@@ -215,11 +220,12 @@
   ]);
 }, 'populate with PKs supplied ok' );
 
+
 lives_ok (sub {
   # start a new connection, make sure rebless works
   # test an insert with a supplied identity, followed by one without
   my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
-  for (1..2) {
+  for (2, 1) {
     my $id = $_ * 20 ;
     $schema->resultset ('Owners')->create ({ id => $id, name => "troglodoogle $id" });
     $schema->resultset ('Owners')->create ({ name => "troglodoogle " . ($id + 1) });
@@ -249,6 +255,129 @@
   ]);
 }, 'populate without PKs supplied ok' );
 
+# plain ordered subqueries throw
+throws_ok (sub {
+  $schema->resultset('Owners')->search ({}, { order_by => 'name' })->as_query
+}, qr/ordered subselect encountered/, 'Ordered Subselect detection throws ok');
+
+# make sure ordered subselects *somewhat* work
+{
+  my $owners = $schema->resultset ('Owners')->search ({}, { order_by => 'name', offset => 2, rows => 3, unsafe_subselect_ok => 1 });
+
+  my $al = $owners->current_source_alias;
+  my $sealed_owners = $owners->result_source->resultset->search (
+    {},
+    {
+      alias => $al,
+      from => [{
+        -alias => $al,
+        -source_handle => $owners->result_source->handle,
+        $al => $owners->as_query,
+      }],
+    },
+  );
+
+  is_deeply (
+    [ map { $_->name } ($sealed_owners->all) ],
+    [ map { $_->name } ($owners->all) ],
+    'Sort preserved from within a subquery',
+  );
+}
+
+TODO: {
+  local $TODO = "This porbably will never work, but it isn't critical either afaik";
+
+  my $book_owner_ids = $schema->resultset ('BooksInLibrary')
+                               ->search ({}, { join => 'owner', distinct => 1, order_by => 'owner.name', unsafe_subselect_ok => 1 })
+                                ->get_column ('owner');
+
+  my $book_owners = $schema->resultset ('Owners')->search ({
+    id => { -in => $book_owner_ids->as_query }
+  });
+
+  is_deeply (
+    [ map { $_->id } ($book_owners->all) ],
+    [ $book_owner_ids->all ],
+    'Sort is preserved across IN subqueries',
+  );
+}
+
+# This is known not to work - thus the negative test
+{
+  my $owners = $schema->resultset ('Owners')->search ({}, { order_by => 'name', offset => 2, rows => 3, unsafe_subselect_ok => 1 });
+  my $corelated_owners = $owners->result_source->resultset->search (
+    {
+      id => { -in => $owners->get_column('id')->as_query },
+    },
+    {
+      order_by => 'name' #reorder because of what is shown above
+    },
+  );
+
+  cmp_ok (
+    join ("\x00", map { $_->name } ($corelated_owners->all) ),
+      'ne',
+    join ("\x00", map { $_->name } ($owners->all) ),
+    'Sadly sort not preserved from within a corelated subquery',
+  );
+
+  cmp_ok (
+    join ("\x00", sort map { $_->name } ($corelated_owners->all) ),
+      'ne',
+    join ("\x00", sort map { $_->name } ($owners->all) ),
+    'Which in fact gives a completely wrong dataset',
+  );
+}
+
+
+# make sure right-join-side single-prefetch ordering limit works
+{
+  my $rs = $schema->resultset ('BooksInLibrary')->search (
+    {
+      'owner.name' => { '!=', 'woggle' },
+    },
+    {
+      prefetch => 'owner',
+      order_by => 'owner.name',
+    }
+  );
+  # this is the order in which they should come from the above query
+  my @owner_names = qw/boggle fISMBoC fREW fRIOUX fROOH fRUE wiggle wiggle/;
+
+  is ($rs->all, 8, 'Correct amount of objects from right-sorted joined resultset');
+  is_deeply (
+    [map { $_->owner->name } ($rs->all) ],
+    \@owner_names,
+    'Rows were properly ordered'
+  );
+
+  my $limited_rs = $rs->search ({}, {rows => 7, offset => 2, unsafe_subselect_ok => 1});
+  is ($limited_rs->count, 6, 'Correct count of limited right-sorted joined resultset');
+  is ($limited_rs->count_rs->next, 6, 'Correct count_rs of limited right-sorted joined resultset');
+
+  my $queries;
+  $schema->storage->debugcb(sub { $queries++; });
+  $schema->storage->debug(1);
+
+  is_deeply (
+    [map { $_->owner->name } ($limited_rs->all) ],
+    [@owner_names[2 .. 7]],
+    'Limited rows were properly ordered'
+  );
+  is ($queries, 1, 'Only one query with prefetch');
+
+  $schema->storage->debugcb(undef);
+  $schema->storage->debug(0);
+
+
+  is_deeply (
+    [map { $_->name } ($limited_rs->search_related ('owner')->all) ],
+    [@owner_names[2 .. 7]],
+    'Rows are still properly ordered after search_related'
+  );
+}
+
+
 #
 # try a prefetch on tables with identically named columns
 #
@@ -259,84 +388,65 @@
 
 {
   # try a ->has_many direction
-  my $owners = $schema->resultset ('Owners')->search ({
-      'books.id' => { '!=', undef }
-    }, {
+  my $owners = $schema->resultset ('Owners')->search (
+    {
+      'books.id' => { '!=', undef },
+      'me.name' => { '!=', 'somebogusstring' },
+    },
+    {
       prefetch => 'books',
-      order_by => 'name',
+      order_by => { -asc => \['name + ?', [ test => 'xxx' ]] }, # test bindvar propagation
       rows     => 3,  # 8 results total
-    });
+      unsafe_subselect_ok => 1,
+    },
+  );
 
+  my ($sql, @bind) = @${$owners->page(3)->as_query};
+  is_deeply (
+    \@bind,
+    [ ([ 'me.name' => 'somebogusstring' ], [ test => 'xxx' ]) x 2 ],  # double because of the prefetch subq
+  );
+
   is ($owners->page(1)->all, 3, 'has_many prefetch returns correct number of rows');
   is ($owners->page(1)->count, 3, 'has-many prefetch returns correct count');
 
-  TODO: {
-    local $TODO = 'limit past end of resultset problem';
-    is ($owners->page(3)->all, 2, 'has_many prefetch returns correct number of rows');
-    is ($owners->page(3)->count, 2, 'has-many prefetch returns correct count');
-    is ($owners->page(3)->count_rs->next, 2, 'has-many prefetch returns correct count_rs');
+  is ($owners->page(3)->all, 2, 'has_many prefetch returns correct number of rows');
+  is ($owners->page(3)->count, 2, 'has-many prefetch returns correct count');
+  is ($owners->page(3)->count_rs->next, 2, 'has-many prefetch returns correct count_rs');
 
-    # make sure count does not become overly complex
-    is_same_sql_bind (
-      $owners->page(3)->count_rs->as_query,
-      '(
-        SELECT COUNT( * )
-          FROM (
-            SELECT TOP 3 [me].[id]
-              FROM [owners] [me]
-              LEFT JOIN [books] [books] ON [books].[owner] = [me].[id]
-            WHERE ( [books].[id] IS NOT NULL )
-            GROUP BY [me].[id]
-            ORDER BY [me].[id] DESC
-          ) [count_subq]
-      )',
-      [],
-    );
-  }
 
   # try a ->belongs_to direction (no select collapse, group_by should work)
-  my $books = $schema->resultset ('BooksInLibrary')->search ({
+  my $books = $schema->resultset ('BooksInLibrary')->search (
+    {
       'owner.name' => [qw/wiggle woggle/],
-    }, {
+    },
+    {
       distinct => 1,
+      having => \['1 = ?', [ test => 1 ] ], #test having propagation
       prefetch => 'owner',
       rows     => 2,  # 3 results total
       order_by => { -desc => 'owner' },
-      # there is no sane way to order by the right side of a grouped prefetch currently :(
-      #order_by => { -desc => 'owner.name' },
-    });
+      unsafe_subselect_ok => 1,
+    },
+  );
 
+  ($sql, @bind) = @${$books->page(3)->as_query};
+  is_deeply (
+    \@bind,
+    [
+      # inner
+      [ 'owner.name' => 'wiggle' ], [ 'owner.name' => 'woggle' ], [ source => 'Library' ], [ test => '1' ],
+      # outer
+      [ 'owner.name' => 'wiggle' ], [ 'owner.name' => 'woggle' ], [ source => 'Library' ],
+    ],
+  );
 
   is ($books->page(1)->all, 2, 'Prefetched grouped search returns correct number of rows');
   is ($books->page(1)->count, 2, 'Prefetched grouped search returns correct count');
 
-  TODO: {
-    local $TODO = 'limit past end of resultset problem';
-    is ($books->page(2)->all, 1, 'Prefetched grouped search returns correct number of rows');
-    is ($books->page(2)->count, 1, 'Prefetched grouped search returns correct count');
-    is ($books->page(2)->count_rs->next, 1, 'Prefetched grouped search returns correct count_rs');
-
-    # make sure count does not become overly complex (FIXME - the distinct-induced group_by is incorrect)
-    is_same_sql_bind (
-      $books->page(2)->count_rs->as_query,
-      '(
-        SELECT COUNT( * )
-          FROM (
-            SELECT TOP 2 [me].[id]
-              FROM [books] [me]
-              JOIN [owners] [owner] ON [owner].[id] = [me].[owner]
-            WHERE ( ( ( [owner].[name] = ? OR [owner].[name] = ? ) AND [source] = ? ) )
-            GROUP BY [me].[id], [me].[source], [me].[owner], [me].[title], [me].[price]
-            ORDER BY [me].[id] DESC
-          ) [count_subq]
-      )',
-      [
-        [ 'owner.name' => 'wiggle' ],
-        [ 'owner.name' => 'woggle' ],
-        [ 'source' => 'Library' ],
-      ],
-    );
-  }
+  is ($books->page(2)->all, 1, 'Prefetched grouped search returns correct number of rows');
+  is ($books->page(2)->count, 1, 'Prefetched grouped search returns correct count');
+  is ($books->page(2)->count_rs->next, 1, 'Prefetched grouped search returns correct count_rs');
 }
 
 done_testing;
@@ -345,7 +455,7 @@
 END {
   if (my $dbh = eval { $schema->storage->_dbh }) {
     eval { $dbh->do("DROP TABLE $_") }
-      for qw/artist money_test Books Owners/;
+      for qw/artist money_test books owners/;
   }
 }
 # vim:sw=2 sts=2

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/747mssql_ado.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/747mssql_ado.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/747mssql_ado.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -11,8 +11,6 @@
 plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ADO_DSN}, _USER and _PASS to run this test'
   unless ($dsn && $user);
 
-plan tests => 12;
-
 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
 $schema->storage->ensure_connected;
 
@@ -48,7 +46,7 @@
 is $found->get_column('foo_50'), 'foo', 'last item in big column list';
 
 # create a few more rows
-for (1..6) {
+for (1..12) {
   $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
 }
 
@@ -60,6 +58,17 @@
   ok eval { $rs2->next }, 'multiple active cursors';
 }
 
+# test bug where ADO blows up if the first bindparam is shorter than the second
+is $schema->resultset('Artist')->search({ artistid => 2 })->first->name,
+  'Artist 1',
+  'short bindparam';
+
+is $schema->resultset('Artist')->search({ artistid => 13 })->first->name,
+  'Artist 12',
+  'longer bindparam';
+
+done_testing;
+
 # clean up our mess
 END {
   if (my $dbh = eval { $schema->storage->_dbh }) {

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/74mssql.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/74mssql.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/74mssql.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -31,14 +31,19 @@
 
   $schema = DBICTest::Schema->clone;
 
+  $schema->connection($dsn, $user, $pass);
+
   if ($storage_idx != 0) { # autodetect
-    $schema->storage_type("::$storage_type");
+    no warnings 'redefine';
+    local *DBIx::Class::Storage::DBI::_typeless_placeholders_supported =
+      sub { 0 };
+#    $schema->storage_type("::$storage_type");
+    $schema->storage->ensure_connected;
   }
+  else {
+    $schema->storage->ensure_connected;
+  }
 
-  $schema->connection($dsn, $user, $pass);
-
-  $schema->storage->ensure_connected;
-
   if ($storage_idx == 0 && ref($schema->storage) =~ /NoBindVars\z/) {
     my $tb = Test::More->builder;
     $tb->skip('no placeholders') for 1..$NUMBER_OF_TESTS_IN_BLOCK;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/85utf8.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/85utf8.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/85utf8.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,23 +1,28 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
+use Test::Warn;
 use lib qw(t/lib);
 use DBICTest;
+use utf8;
 
-my $schema = DBICTest->init_schema();
+warning_like (sub {
 
-if ($] <= 5.008000) {
+  package A::Comp;
+  use base 'DBIx::Class';
+  sub store_column { shift->next::method (@_) };
+  1;
 
-    eval 'use Encode; 1' or plan skip_all => 'Need Encode run this test';
+  package A::Test;
+  use base 'DBIx::Class::Core';
+  __PACKAGE__->load_components(qw(UTF8Columns +A::Comp));
+  1;
+}, qr/Incorrect loading order of DBIx::Class::UTF8Columns/ );
 
-} else {
 
-    eval 'use utf8; 1' or plan skip_all => 'Need utf8 run this test';
-}
+my $schema = DBICTest->init_schema();
 
-plan tests => 6;
-
 DBICTest::Schema::CD->load_components('UTF8Columns');
 DBICTest::Schema::CD->utf8_columns('title');
 Class::C3->reinitialize();
@@ -26,12 +31,12 @@
 my $utf8_char = 'uniuni';
 
 
-ok( _is_utf8( $cd->title ), 'got title with utf8 flag' );
-ok(! _is_utf8( $cd->year ), 'got year without utf8 flag' );
+ok( utf8::is_utf8( $cd->title ), 'got title with utf8 flag' );
+ok(! utf8::is_utf8( $cd->year ), 'got year without utf8 flag' );
 
-_force_utf8($utf8_char);
+utf8::decode($utf8_char);
 $cd->title($utf8_char);
-ok(! _is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
+ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
 
 
 my $v_utf8 = "\x{219}";
@@ -47,24 +52,7 @@
 TODO: {
   local $TODO = 'There is currently no way to propagate aliases to inflate_result()';
   $cd = $schema->resultset('CD')->find ({ title => $v_utf8 }, { select => 'title', as => 'name' });
-  ok (_is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');
+  ok (utf8::is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');
 }
 
-
-sub _force_utf8 {
-  if ($] <= 5.008000) {
-    Encode::_utf8_on ($_[0]);
-  }
-  else {
-    utf8::decode ($_[0]);
-  }
-}
-
-sub _is_utf8 {
-  if ($] <= 5.008000) {
-    return Encode::is_utf8 (shift);
-  }
-  else {
-    return utf8::is_utf8 (shift);
-  }
-}
+done_testing;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/86might_have.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/86might_have.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/86might_have.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -2,6 +2,7 @@
 use warnings;  
 
 use Test::More;
+use Test::Warn;
 use lib qw(t/lib);
 use DBICTest;
 
@@ -11,8 +12,6 @@
 $schema->storage->debugcb( sub{ $queries++ } );
 my $sdebug = $schema->storage->debug;
 
-plan tests => 2;
-
 my $cd = $schema->resultset("CD")->find(1);
 $cd->title('test');
 
@@ -40,4 +39,26 @@
 is($queries, 1, 'liner_notes (might_have) prefetched - do not load 
 liner_notes on update');
 
+warning_like {
+  DBICTest::Schema::Bookmark->might_have(
+    linky => 'DBICTest::Schema::Link',
+    { "foreign.id" => "self.link" },
+  );
+}
+  qr{"might_have/has_one" must not be on columns with is_nullable set to true},
+  'might_have should warn if the self.id column is nullable';
+
+{
+  local $ENV{DBIC_DONT_VALIDATE_RELS} = 1;
+  warning_is { 
+    DBICTest::Schema::Bookmark->might_have(
+      slinky => 'DBICTest::Schema::Link',
+      { "foreign.id" => "self.link" },
+    );
+  }
+  undef,
+  'Setting DBIC_DONT_VALIDATE_RELS suppresses nullable relation warnings';
+}
+
 $schema->storage->debug($sdebug);
+done_testing();

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/86sqlt.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/86sqlt.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/86sqlt.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -14,6 +14,36 @@
 
 my $schema = DBICTest->init_schema (no_deploy => 1);
 
+
+# Check deployment statements ctx sensitivity
+{
+  my $not_first_table_creation_re = qr/CREATE TABLE fourkeys_to_twokeys/;
+
+
+  my $statements = $schema->deployment_statements;
+  like (
+    $statements,
+    $not_first_table_creation_re,
+    'All create statements returned in 1 string in scalar ctx'
+  );
+
+  my @statements = $schema->deployment_statements;
+  cmp_ok (scalar @statements, '>', 1, 'Multiple statement lines in array ctx');
+
+  my $i = 0;
+  while ($i <= $#statements) {
+    last if $statements[$i] =~ $not_first_table_creation_re;
+    $i++;
+  }
+
+  ok (
+    ($i > 0) && ($i <= $#statements),
+    "Creation statement was found somewherere within array ($i)"
+  );
+}
+
+
+
 # replace the sqlt calback with a custom version ading an index
 $schema->source('Track')->sqlt_deploy_callback(sub {
   my ($self, $sqlt_table) = @_;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/88result_set_column.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/88result_set_column.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/88result_set_column.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -9,8 +9,15 @@
 
 my $schema = DBICTest->init_schema();
 
-my $rs = $schema->resultset("CD")->search({}, { order_by => 'cdid' });
+my $rs = $schema->resultset("CD");
 
+cmp_ok (
+  $rs->count,
+    '!=',
+  $rs->search ({}, {columns => ['year'], distinct => 1})->count,
+  'At least one year is the same in rs'
+);
+
 my $rs_title = $rs->get_column('title');
 my $rs_year = $rs->get_column('year');
 my $max_year = $rs->get_column(\'MAX (year)');
@@ -36,6 +43,14 @@
   is($rs_year->single, 1999, "single okay");
 }, qr/Query returned more than one row/, 'single warned');
 
+
+# test distinct propagation
+is_deeply (
+  [$rs->search ({}, { distinct => 1 })->get_column ('year')->all],
+  [$rs_year->func('distinct')],
+  'distinct => 1 is passed through properly',
+);
+
 # test +select/+as for single column
 my $psrs = $schema->resultset('CD')->search({},
     {

Deleted: DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,78 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use Test::Exception;
-
-use lib qw(t/lib);
-use DBIC::SqlMakerTest;
-
-use_ok('DBICTest');
-
-my $schema = DBICTest->init_schema(no_deploy => 1);
-
-my $sql_maker = $schema->storage->sql_maker;
-
-
-{
-  my ($sql, @bind) = $sql_maker->insert(
-            'lottery',
-            {
-              'day' => '2008-11-16',
-              'numbers' => [13, 21, 34, 55, 89]
-            }
-  );
-
-  is_same_sql_bind(
-    $sql, \@bind,
-    q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/,
-      [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
-    'sql_maker passes arrayrefs in insert'
-  );
-
-
-  ($sql, @bind) = $sql_maker->update(
-            'lottery',
-            {
-              'day' => '2008-11-16',
-              'numbers' => [13, 21, 34, 55, 89]
-            }
-  );
-
-  is_same_sql_bind(
-    $sql, \@bind,
-    q/UPDATE lottery SET day = ?, numbers = ?/,
-      [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
-    'sql_maker passes arrayrefs in update'
-  );
-}
-
-# make sure the cookbook caveat of { $op, \'...' } no longer applies
-{
-  my ($sql, @bind) = $sql_maker->where({
-    last_attempt => \ '< now() - interval "12 hours"',
-    next_attempt => { '<', \ 'now() - interval "12 hours"' },
-    created => [
-      { '<=', \ '1969' },
-      \ '> 1984',
-    ],
-  });
-  is_same_sql_bind(
-    $sql,
-    \@bind,
-    'WHERE
-          (created <= 1969 OR created > 1984 )
-      AND last_attempt < now() - interval "12 hours"
-      AND next_attempt < now() - interval "12 hours"
-    ',
-    [],
-  );
-}
-
-# Make sure the carp/croak override in SQLA works (via SQLAHacks)
-my $file = quotemeta (__FILE__);
-throws_ok (sub {
-  $schema->resultset ('Artist')->search ({}, { order_by => { -asc => 'stuff', -desc => 'staff' } } )->as_query;
-}, qr/$file/, 'Exception correctly croak()ed');
-
-done_testing;

Deleted: DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker_quote.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker_quote.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker_quote.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,357 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-use lib qw(t/lib);
-use DBIC::SqlMakerTest;
-
-use_ok('DBICTest');
-
-my $schema = DBICTest->init_schema();
-
-my $sql_maker = $schema->storage->sql_maker;
-
-$sql_maker->quote_char('`');
-$sql_maker->name_sep('.');
-
-my ($sql, @bind) = $sql_maker->select(
-          [
-            {
-              'me' => 'cd'
-            },
-            [
-              {
-                'artist' => 'artist',
-                '-join_type' => ''
-              },
-              {
-                'artist.artistid' => 'me.artist'
-              }
-            ],
-            [
-              {
-                'tracks' => 'tracks',
-                '-join_type' => 'left'
-              },
-              {
-                'tracks.cd' => 'me.cdid'
-              }
-            ],
-          ],
-          [
-            'me.cdid',
-            { count => 'tracks.cd' },
-            { min => 'me.year', -as => 'me.minyear' },
-          ],
-          {
-            'artist.name' => 'Caterwauler McCrae',
-            'me.year' => 2001
-          },
-          [],
-          undef,
-          undef
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/
-    SELECT `me`.`cdid`, COUNT( `tracks`.`cd` ), MIN( `me`.`year` ) AS `me`.`minyear`
-      FROM `cd` `me`
-      JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` )
-      LEFT JOIN `tracks` `tracks` ON ( `tracks`.`cd` = `me`.`cdid` )
-    WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )
-  /,
-  [ ['artist.name' => 'Caterwauler McCrae'], ['me.year' => 2001] ],
-  'got correct SQL and bind parameters for complex select query with quoting'
-);
-
-
-($sql, @bind) = $sql_maker->select(
-          [
-            {
-              'me' => 'cd'
-            }
-          ],
-          [
-            'me.cdid',
-            'me.artist',
-            'me.title',
-            'me.year'
-          ],
-          undef,
-          'year DESC',
-          undef,
-          undef
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year DESC`/, [],
-  'scalar ORDER BY okay (single value)'
-);
-
-
-($sql, @bind) = $sql_maker->select(
-          [
-            {
-              'me' => 'cd'
-            }
-          ],
-          [
-            'me.cdid',
-            'me.artist',
-            'me.title',
-            'me.year'
-          ],
-          undef,
-          [
-            'year DESC',
-            'title ASC'
-          ],
-          undef,
-          undef
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year DESC`, `title ASC`/, [],
-  'scalar ORDER BY okay (multiple values)'
-);
-
-{
-  ($sql, @bind) = $sql_maker->select(
-            [
-              {
-                'me' => 'cd'
-              }
-            ],
-            [
-              'me.cdid',
-              'me.artist',
-              'me.title',
-              'me.year'
-            ],
-            undef,
-            { -desc => 'year' },
-            undef,
-            undef
-  );
-
-  is_same_sql_bind(
-    $sql, \@bind,
-    q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC/, [],
-    'hashref ORDER BY okay (single value)'
-  );
-
-
-  ($sql, @bind) = $sql_maker->select(
-            [
-              {
-                'me' => 'cd'
-              }
-            ],
-            [
-              'me.cdid',
-              'me.artist',
-              'me.title',
-              'me.year'
-            ],
-            undef,
-            [
-              { -desc => 'year' },
-              { -asc => 'title' }
-            ],
-            undef,
-            undef
-  );
-
-  is_same_sql_bind(
-    $sql, \@bind,
-    q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC, `title` ASC/, [],
-    'hashref ORDER BY okay (multiple values)'
-  );
-
-}
-
-
-($sql, @bind) = $sql_maker->select(
-          [
-            {
-              'me' => 'cd'
-            }
-          ],
-          [
-            'me.cdid',
-            'me.artist',
-            'me.title',
-            'me.year'
-          ],
-          undef,
-          \'year DESC',
-          undef,
-          undef
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC/, [],
-  'did not quote ORDER BY with scalarref (single value)'
-);
-
-
-($sql, @bind) = $sql_maker->select(
-          [
-            {
-              'me' => 'cd'
-            }
-          ],
-          [
-            'me.cdid',
-            'me.artist',
-            'me.title',
-            'me.year'
-          ],
-          undef,
-          [
-            \'year DESC',
-            \'title ASC'
-          ],
-          undef,
-          undef
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC, title ASC/, [],
-  'did not quote ORDER BY with scalarref (multiple values)'
-);
-
-
-($sql, @bind) = $sql_maker->select(
-  [ { me => 'cd' }                  ],
-  [qw/ me.cdid me.artist me.title  /],
-  { cdid => \['rlike ?', [cdid => 'X'] ]       },
-  { group_by => 'title', having => \['count(me.artist) > ?', [ cnt => 2] ] },
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title` FROM `cd` `me` WHERE ( `cdid` rlike ? ) GROUP BY `title` HAVING count(me.artist) > ?/,
-  [ [ cdid => 'X'], ['cnt' => '2'] ],
-  'Quoting works with where/having arrayrefsrefs',
-);
-
-
-($sql, @bind) = $sql_maker->select(
-  [ { me => 'cd' }                  ],
-  [qw/ me.cdid me.artist me.title  /],
-  { cdid => \'rlike X'              },
-  { group_by => 'title', having => \'count(me.artist) > 2' },
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title` FROM `cd` `me` WHERE ( `cdid` rlike X ) GROUP BY `title` HAVING count(me.artist) > 2/,
-  [],
-  'Quoting works with where/having scalarrefs',
-);
-
-
-($sql, @bind) = $sql_maker->update(
-          'group',
-          {
-            'order' => '12',
-            'name' => 'Bill'
-          }
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/UPDATE `group` SET `name` = ?, `order` = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
-  'quoted table names for UPDATE'
-);
-
-{
-  ($sql, @bind) = $sql_maker->select(
-        [
-          {
-            'me' => 'cd'
-          }
-        ],
-        [
-          'me.*'
-        ],
-        undef,
-        [],
-        undef,
-        undef    
-  );
-
-  is_same_sql_bind(
-    $sql, \@bind,
-    q/SELECT `me`.* FROM `cd` `me`/, [],
-    'select attr with me.* is right'
-  );
-}
-
-
-$sql_maker->quote_char([qw/[ ]/]);
-
-($sql, @bind) = $sql_maker->select(
-          [
-            {
-              'me' => 'cd'
-            },
-            [
-              {
-                'artist' => 'artist',
-                '-join_type' => ''
-              },
-              {
-                'artist.artistid' => 'me.artist'
-              }
-            ]
-          ],
-          [
-            {
-              max => 'rank',
-              -as => 'max_rank',
-            },
-            'rank',
-            {
-              'count' => '*',
-              -as => 'cnt',
-            }
-          ],
-          {
-            'artist.name' => 'Caterwauler McCrae',
-            'me.year' => 2001
-          },
-          [],
-          undef,
-          undef
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/SELECT MAX ( [rank] ) AS [max_rank], [rank], COUNT( * ) AS [cnt] FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/, [ ['artist.name' => 'Caterwauler McCrae'], ['me.year' => 2001] ],
-  'got correct SQL and bind parameters for count query with bracket quoting'
-);
-
-
-($sql, @bind) = $sql_maker->update(
-          'group',
-          {
-            'order' => '12',
-            'name' => 'Bill'
-          }
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/UPDATE [group] SET [name] = ?, [order] = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
-  'bracket quoted table names for UPDATE'
-);
-
-done_testing;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/99dbic_sqlt_parser.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/99dbic_sqlt_parser.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/99dbic_sqlt_parser.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,9 +1,12 @@
-#!/usr/bin/perl
 use strict;
 use warnings;
+
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
+use DBICTest::Schema;
+use Scalar::Util ();
 
 BEGIN {
   require DBIx::Class::Storage::DBI;
@@ -12,6 +15,16 @@
     if not DBIx::Class::Storage::DBI->_sqlt_version_ok;
 }
 
+# Test for SQLT-related leaks
+{
+  my $s = DBICTest::Schema->clone;
+  create_schema ({ schema => $s });
+  Scalar::Util::weaken ($s);
+
+  ok (!$s, 'Schema not leaked');
+}
+
+
 my $schema = DBICTest->init_schema();
 # Dummy was yanked out by the sqlt hook test
 # CustomSql tests the horrific/deprecated ->name(\$sql) hack
@@ -23,64 +36,103 @@
 ;
 
 { 
-	my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { } } });
+  my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { } } });
 
-	foreach my $source (@sources) {
-		my $table = get_table($sqlt_schema, $schema, $source);
+  foreach my $source (@sources) {
+    my $table = get_table($sqlt_schema, $schema, $source);
 
-		my $fk_count = scalar(grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints);
-		my @indices = $table->get_indices;
-		my $index_count = scalar(@indices);
+    my $fk_count = scalar(grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints);
+    my @indices = $table->get_indices;
+    my $index_count = scalar(@indices);
     $index_count++ if ($source eq 'TwoKeys'); # TwoKeys has the index turned off on the rel def
-		is($index_count, $fk_count, "correct number of indices for $source with no args");
-	}
+    is($index_count, $fk_count, "correct number of indices for $source with no args");
+  }
 }
 
 { 
-	my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { add_fk_index => 1 } } });
+  my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { add_fk_index => 1 } } });
 
-	foreach my $source (@sources) {
-		my $table = get_table($sqlt_schema, $schema, $source);
+  foreach my $source (@sources) {
+    my $table = get_table($sqlt_schema, $schema, $source);
 
-		my $fk_count = scalar(grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints);
-		my @indices = $table->get_indices;
-		my $index_count = scalar(@indices);
+    my $fk_count = scalar(grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints);
+    my @indices = $table->get_indices;
+    my $index_count = scalar(@indices);
     $index_count++ if ($source eq 'TwoKeys'); # TwoKeys has the index turned off on the rel def
-		is($index_count, $fk_count, "correct number of indices for $source with add_fk_index => 1");
-	}
+    is($index_count, $fk_count, "correct number of indices for $source with add_fk_index => 1");
+  }
 }
 
 { 
-	my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { add_fk_index => 0 } } });
+  my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { add_fk_index => 0 } } });
 
-	foreach my $source (@sources) {
-		my $table = get_table($sqlt_schema, $schema, $source);
+  foreach my $source (@sources) {
+    my $table = get_table($sqlt_schema, $schema, $source);
 
-		my @indices = $table->get_indices;
-		my $index_count = scalar(@indices);
-		is($index_count, 0, "correct number of indices for $source with add_fk_index => 0");
-	}
+    my @indices = $table->get_indices;
+    my $index_count = scalar(@indices);
+    is($index_count, 0, "correct number of indices for $source with add_fk_index => 0");
+  }
 }
 
+{ 
+    {
+        package # hide from PAUSE
+            DBICTest::Schema::NoViewDefinition;
+
+        use base qw/DBICTest::BaseResult/;
+
+        __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
+        __PACKAGE__->table('noviewdefinition');
+
+        1;
+    }
+
+    my $schema_invalid_view = $schema->clone;
+    $schema_invalid_view->register_class('NoViewDefinition', 'DBICTest::Schema::NoViewDefinition');
+
+    throws_ok { create_schema({ schema => $schema_invalid_view }) }
+        qr/view noviewdefinition is missing a view_definition/,
+        'parser detects views with a view_definition';
+}
+
+lives_ok (sub {
+  my $sqlt_schema = create_schema ({
+    schema => $schema,
+    args => {
+      parser_args => {
+        sources => ['CD']
+      },
+    },
+  });
+
+  is_deeply (
+    [$sqlt_schema->get_tables ],
+    ['cd'],
+    'sources limitng with relationships works',
+  );
+
+});
+
 done_testing;
 
 sub create_schema {
-	my $args = shift;
+  my $args = shift;
 
-	my $schema = $args->{schema};
-	my $additional_sqltargs = $args->{args} || {};
+  my $schema = $args->{schema};
+  my $additional_sqltargs = $args->{args} || {};
 
-	my $sqltargs = {
-		add_drop_table => 1, 
-		ignore_constraint_names => 1,
-		ignore_index_names => 1,
-		%{$additional_sqltargs}
-		};
+  my $sqltargs = {
+    add_drop_table => 1, 
+    ignore_constraint_names => 1,
+    ignore_index_names => 1,
+    %{$additional_sqltargs}
+  };
 
-	my $sqlt = SQL::Translator->new( $sqltargs );
+  my $sqlt = SQL::Translator->new( $sqltargs );
 
-	$sqlt->parser('SQL::Translator::Parser::DBIx::Class');
-	return $sqlt->translate({ data => $schema }) or die $sqlt->error;
+  $sqlt->parser('SQL::Translator::Parser::DBIx::Class');
+  return $sqlt->translate({ data => $schema }) || die $sqlt->error;
 }
 
 sub get_table {

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/count/prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/count/prefetch.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/count/prefetch.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -54,19 +54,15 @@
         FROM (
           SELECT genre.genreid
             FROM (
-              SELECT cds.cdid, cds.artist, cds.title, cds.year, cds.genreid, cds.single_track
-                FROM (
-                  SELECT me.artistid, me.name, me.rank, me.charfield
-                    FROM artist me GROUP BY me.artistid, me.name, me.rank, me.charfield
-                ) me
-                LEFT JOIN cd cds ON cds.artist = me.artistid
-              GROUP BY cds.cdid, cds.artist, cds.title, cds.year, cds.genreid, cds.single_track
-            ) cds
+              SELECT me.artistid, me.name, me.rank, me.charfield
+                FROM artist me GROUP BY me.artistid, me.name, me.rank, me.charfield
+            ) me
+            JOIN cd cds ON cds.artist = me.artistid
             JOIN genre genre ON genre.genreid = cds.genreid
             LEFT JOIN cd cds_2 ON cds_2.genreid = genre.genreid
-          WHERE ( genre.name = ? )
-          GROUP BY genre.genreid
-        ) count_subq
+          WHERE ( genre.name = ? ) GROUP BY genre.genreid
+        )
+      count_subq
     )',
     [ [ 'genre.name' => 'emo' ] ],
   );

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/core.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/core.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/core.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -16,8 +16,10 @@
       deflate => sub { shift->year } }
 );
 
+my $rs = $schema->resultset('CD');
+
 # inflation test
-my $cd = $schema->resultset("CD")->find(3);
+my $cd = $rs->find(3);
 
 is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
 
@@ -45,7 +47,7 @@
 $cd->year( $now );
 $cd->update;
 
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 is( $cd->year->year, $now->year, 'deflate ok' );
 
 # set_inflated_column test
@@ -53,29 +55,23 @@
 ok(!$@, 'set_inflated_column with DateTime object');
 $cd->update;
 
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 is( $cd->year->year, $now->year, 'deflate ok' );
 
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 my $before_year = $cd->year->year;
 eval { $cd->set_inflated_column('year', \'year + 1') };
 ok(!$@, 'set_inflated_column to "year + 1"');
 $cd->update;
 
-TODO: {
-  local $TODO = 'this was left in without a TODO - should it work?';
+$cd->store_inflated_column('year', \'year + 1');
+is_deeply( $cd->year, \'year + 1', 'scalarref deflate passthrough ok' );
 
-  lives_ok (sub {
-    $cd->store_inflated_column('year', \'year + 1');
-    is_deeply( $cd->year, \'year + 1', 'deflate ok' );
-  }, 'store_inflated_column to "year + 1"');
-}
-
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 is( $cd->year->year, $before_year+1, 'deflate ok' );
 
 # store_inflated_column test
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 eval { $cd->store_inflated_column('year', $now) };
 ok(!$@, 'store_inflated_column with DateTime object');
 $cd->update;
@@ -83,21 +79,21 @@
 is( $cd->year->year, $now->year, 'deflate ok' );
 
 # update tests
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 eval { $cd->update({'year' => $now}) };
 ok(!$@, 'update using DateTime object ok');
 is($cd->year->year, $now->year, 'deflate ok');
 
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 $before_year = $cd->year->year;
 eval { $cd->update({'year' => \'year + 1'}) };
 ok(!$@, 'update using scalarref ok');
 
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 is($cd->year->year, $before_year + 1, 'deflate ok');
 
 # discard_changes test
-$cd = $schema->resultset("CD")->find(3);
+$cd = $rs->find(3);
 # inflate the year
 $before_year = $cd->year->year;
 $cd->update({ year => \'year + 1'});
@@ -107,6 +103,45 @@
 
 my $copy = $cd->copy({ year => $now, title => "zemoose" });
 
-isnt( $copy->year->year, $before_year, "copy" );
+is( $copy->year->year, $now->year, "copy" );
 
+
+
+my $artist = $cd->artist;
+my $sval = \ '2012';
+
+$cd = $rs->create ({
+        artist => $artist,
+        year => $sval,
+        title => 'create with scalarref',
+});
+
+is ($cd->year, $sval, 'scalar value retained');
+my $cd2 = $cd->copy ({ title => 'copy with scalar in coldata' });
+is ($cd2->year, $sval, 'copied scalar value retained');
+
+$cd->discard_changes;
+is ($cd->year->year, 2012, 'infation upon reload');
+
+$cd2->discard_changes;
+is ($cd2->year->year, 2012, 'infation upon reload of copy');
+
+
+my $precount = $rs->count;
+$cd = $rs->update_or_create ({artist => $artist, title => 'nonexisting update/create test row', year => $sval });
+is ($rs->count, $precount + 1, 'Row created');
+
+is ($cd->year, $sval, 'scalar value retained on creating update_or_create');
+$cd->discard_changes;
+is ($cd->year->year, 2012, 'infation upon reload');
+
+my $sval2 = \ '2013';
+
+$cd = $rs->update_or_create ({artist => $artist, title => 'nonexisting update/create test row', year => $sval2 });
+is ($rs->count, $precount + 1, 'No more rows created');
+
+is ($cd->year, $sval2, 'scalar value retained on updating update_or_create');
+$cd->discard_changes;
+is ($cd->year->year, 2013, 'infation upon reload');
+
 done_testing;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/hri.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/hri.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/inflate/hri.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -45,7 +45,7 @@
             my @dbic_reltable = $dbic_obj->$col;
             my @hashref_reltable = @{$datahashref->{$col}};
   
-            is (scalar @hashref_reltable, scalar @dbic_reltable, 'number of related entries');
+            is (scalar @dbic_reltable, scalar @hashref_reltable, 'number of related entries');
 
             # for my $index (0..scalar @hashref_reltable) {
             for my $index (0..scalar @dbic_reltable) {

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/A.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/A.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/A.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::Bogus::A;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('a');
 __PACKAGE__->add_columns('a');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/B.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/B.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Bogus/B.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::Result::B;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('b');
 __PACKAGE__->add_columns('b');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/OtherRslt/D.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/OtherRslt/D.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/OtherRslt/D.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::OtherRslt::D;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('d');
 __PACKAGE__->add_columns('d');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/A.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/A.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/A.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::Result::A;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('a');
 __PACKAGE__->add_columns('a');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/B.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/B.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Result/B.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::Result::B;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('b');
 __PACKAGE__->add_columns('b');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/A.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/A.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/A.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::Rslt::A;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('a');
 __PACKAGE__->add_columns('a');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/B.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/B.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/Rslt/B.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,6 +1,5 @@
 package DBICNSTest::Rslt::B;
-use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/PK::Auto Core/);
+use base qw/DBIx::Class::Core/;
 __PACKAGE__->table('b');
 __PACKAGE__->add_columns('b');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema/Foo.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema/Foo.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema/Foo.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,8 +1,7 @@
 package DBICNSTest::RtBug41083::Schema::Foo;
 use strict;
 use warnings;
-use base 'DBIx::Class';
-__PACKAGE__->load_components('Core');
+use base 'DBIx::Class::Core';
 __PACKAGE__->table('foo');
 __PACKAGE__->add_columns('foo');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,8 +1,7 @@
 package DBICNSTest::RtBug41083::Schema_A::A;
 use strict;
 use warnings;
-use base 'DBIx::Class';
-__PACKAGE__->load_components('Core');
+use base 'DBIx::Class::Core';
 __PACKAGE__->table('a');
 __PACKAGE__->add_columns('a');
 1;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/BaseResult.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/BaseResult.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/BaseResult.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -4,10 +4,9 @@
 use strict;
 use warnings;
 
-use base qw/DBIx::Class/;
+use base qw/DBIx::Class::Core/;
 use DBICTest::BaseResultSet;
 
-__PACKAGE__->load_components (qw/Core/);
 __PACKAGE__->table ('bogus');
 __PACKAGE__->resultset_class ('DBICTest::BaseResultSet');
 

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/ResultSetManager/Foo.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/ResultSetManager/Foo.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/ResultSetManager/Foo.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,8 +1,8 @@
 package # hide from PAUSE 
     DBICTest::ResultSetManager::Foo;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 
-__PACKAGE__->load_components(qw/ ResultSetManager Core /);
+__PACKAGE__->load_components(qw/ ResultSetManager /);
 __PACKAGE__->table('foo');
 
 sub bar : ResultSet { 'good' }

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/Schema/Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/Schema/Artist.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest/Schema/Artist.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -44,6 +44,9 @@
 __PACKAGE__->has_many(
     cds_unordered => 'DBICTest::Schema::CD'
 );
+__PACKAGE__->has_many(
+    cds_very_very_very_long_relationship_name => 'DBICTest::Schema::CD'
+);
 
 __PACKAGE__->has_many( twokeys => 'DBICTest::Schema::TwoKeys' );
 __PACKAGE__->has_many( onekeys => 'DBICTest::Schema::OneKey' );

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICTest.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -127,7 +127,7 @@
     my $args = shift || {};
 
     if ($ENV{"DBICTEST_SQLT_DEPLOY"}) { 
-        $schema->deploy($args);    
+        $schema->deploy($args);
     } else {
         open IN, "t/lib/sqlite.sql";
         my $sql;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionNew.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionNew.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionNew.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,10 +1,9 @@
 package DBICVersion::Table;
 
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 use strict;
 use warnings;
 
-__PACKAGE__->load_components(qw/ Core/);
 __PACKAGE__->table('TestVersion');
 
 __PACKAGE__->add_columns

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionOrig.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionOrig.pm	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/lib/DBICVersionOrig.pm	2010-01-17 16:20:32 UTC (rev 8345)
@@ -1,10 +1,9 @@
 package DBICVersion::Table;
 
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 use strict;
 use warnings;
 
-__PACKAGE__->load_components(qw/ Core/);
 __PACKAGE__->table('TestVersion');
 
 __PACKAGE__->add_columns

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/double_prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/double_prefetch.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/double_prefetch.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -27,7 +27,7 @@
       single_track_2.trackid, single_track_2.cd, single_track_2.position, single_track_2.title, single_track_2.last_updated_on, single_track_2.last_updated_at, single_track_2.small_dt,
       cd.cdid, cd.artist, cd.title, cd.year, cd.genreid, cd.single_track
     FROM artist me
-      LEFT JOIN cd cds ON cds.artist = me.artistid
+      JOIN cd cds ON cds.artist = me.artistid
       LEFT JOIN track single_track ON single_track.trackid = cds.single_track
       LEFT JOIN track single_track_2 ON single_track_2.trackid = cds.single_track
       LEFT JOIN cd cd ON cd.cdid = single_track_2.cd

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/via_search_related.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/via_search_related.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/prefetch/via_search_related.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -109,27 +109,31 @@
     is($rs->search_related('cds')->count, 4, 'prefetch without distinct (count)');
 
 
-    $rs = $artist_rs->search(undef, {distinct => 1})
-                ->search_related('cds')->search_related('genre',
+    $rs = $artist_rs->search_related('cds', {}, { distinct => 1})->search_related('genre',
                     { 'genre.name' => 'vague genre' },
                  );
+    is($rs->all, 2, 'distinct does not propagate over search_related (objects)');
+    is($rs->count, 2, 'distinct does not propagate over search_related (count)');
+
+    $rs = $rs->search ({}, { distinct => 1} );
     is($rs->all, 1, 'distinct without prefetch (objects)');
     is($rs->count, 1, 'distinct without prefetch (count)');
 
 
-    $rs = $artist_rs->search({}, {distinct => 1})
-                ->search_related('cds')->search_related('genre',
+    $rs = $artist_rs->search_related('cds')->search_related('genre',
                     { 'genre.name' => 'vague genre' },
-                    { prefetch => 'cds' },
+                    { prefetch => 'cds', distinct => 1 },
                  );
     is($rs->all, 1, 'distinct with prefetch (objects)');
     is($rs->count, 1, 'distinct with prefetch (count)');
+
+  TODO: {
+    local $TODO = "This makes another 2 trips to the database, it can't be right";
     # artist -> 2 cds -> 2 genres -> 2 cds for each genre + distinct = 2
     is($rs->search_related('cds')->all, 2, 'prefetched distinct with prefetch (objects)');
     is($rs->search_related('cds')->count, 2, 'prefetched distinct with prefetch (count)');
+  }
 
-
-
 }, 'distinct generally works with prefetch on deep search_related chains');
 
 done_testing;

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/relationship/core.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/relationship/core.t	2010-01-17 15:46:20 UTC (rev 8344)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/relationship/core.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -268,7 +268,7 @@
   '(
     SELECT artist_undirected_maps.id1, artist_undirected_maps.id2
       FROM artist me
-      LEFT JOIN artist_undirected_map artist_undirected_maps
+      JOIN artist_undirected_map artist_undirected_maps
         ON artist_undirected_maps.id1 = me.artistid OR artist_undirected_maps.id2 = me.artistid
     WHERE ( artistid = ? )
   )',

Added: DBIx-Class/0.08/branches/dbicadmin_refactor/t/resultset/nulls_only.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/resultset/nulls_only.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/resultset/nulls_only.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+
+use lib qw(t/lib);
+use Test::More;
+use Test::Exception;
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+
+my $cd_rs = $schema->resultset('CD')->search ({ genreid => undef }, { columns => [ 'genreid' ]} );
+my $count = $cd_rs->count;
+cmp_ok ( $count, '>', 1, 'several CDs with no genre');
+
+my @objects = $cd_rs->all;
+is (scalar @objects, $count, 'Correct amount of objects without limit');
+isa_ok ($_, 'DBICTest::CD') for @objects;
+
+is_deeply (
+  [ map { values %{{$_->get_columns}} } (@objects) ],
+  [ (undef) x $count ],
+  'All values are indeed undef'
+);
+
+
+isa_ok ($cd_rs->search ({}, { rows => 1 })->single, 'DBICTest::CD');
+
+done_testing;

Added: DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/anon.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/anon.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/anon.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+use DBICTest;
+
+lives_ok (sub {
+  DBICTest->init_schema()->resultset('Artist')->find({artistid => 1 })->update({name => 'anon test'});
+}, 'Schema object not lost in chaining');
+
+done_testing;

Added: DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/clone.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/clone.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/schema/clone.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use Test::More;
+
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+my $clone = $schema->clone;
+cmp_ok ($clone->storage, 'eq', $schema->storage, 'Storage copied into new schema (not a new instance)');
+
+done_testing;

Added: DBIx-Class/0.08/branches/dbicadmin_refactor/t/search/related_strip_prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/search/related_strip_prefetch.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/search/related_strip_prefetch.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+my $rs = $schema->resultset('CD')->search (
+  { 'tracks.id' => { '!=', 666 }},
+  { join => 'artist', prefetch => 'tracks', rows => 2 }
+);
+
+my $rel_rs = $rs->search_related ('tags', { 'tags.tag' => { '!=', undef }}, { distinct => 1});
+
+is_same_sql_bind (
+  $rel_rs->as_query,
+  '(
+    SELECT tags.tagid, tags.cd, tags.tag
+      FROM (
+        SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track
+          FROM cd me
+          JOIN artist artist ON artist.artistid = me.artist
+          LEFT JOIN track tracks ON tracks.cd = me.cdid
+        WHERE ( tracks.id != ? )
+        LIMIT 2
+      ) me
+      JOIN artist artist ON artist.artistid = me.artist
+      LEFT JOIN track tracks ON tracks.cd = me.cdid
+      JOIN tags tags ON tags.cd = me.cdid
+    WHERE ( tags.tag IS NOT NULL )
+    GROUP BY tags.tagid, tags.cd, tags.tag
+  )',
+
+  [ [ 'tracks.id' => 666 ] ],
+  'Prefetch spec successfully stripped on search_related'
+);
+
+done_testing;

Copied: DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/limit_dialects/toplimit.t (from rev 7989, DBIx-Class/0.08/branches/dbicadmin_refactor/t/42toplimit.t)
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/limit_dialects/toplimit.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/limit_dialects/toplimit.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,152 @@
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+use DBIC::SqlMakerTest;
+
+my $schema = DBICTest->init_schema;
+
+# Trick the sqlite DB to use Top limit emulation
+# We could test all of this via $sq->$op directly,
+# but some conditions need a $rsrc
+delete $schema->storage->_sql_maker->{_cached_syntax};
+$schema->storage->_sql_maker->limit_dialect ('Top');
+
+my $rs = $schema->resultset ('BooksInLibrary')->search ({}, { prefetch => 'owner', rows => 1, offset => 3 });
+
+sub default_test_order {
+   my $order_by = shift;
+   is_same_sql_bind(
+      $rs->search ({}, {order_by => $order_by})->as_query,
+      "(SELECT
+        TOP 1 me__id, source, owner, title, price, owner__id, name FROM
+         (SELECT
+           TOP 4 me.id AS me__id, me.source, me.owner, me.title, me.price, owner.id AS owner__id, owner.name
+           FROM books me
+           JOIN owners owner ON
+           owner.id = me.owner
+           WHERE ( source = ? )
+           ORDER BY me__id ASC
+         ) me ORDER BY me__id DESC
+       )",
+    [ [ source => 'Library' ] ],
+  );
+}
+
+sub test_order {
+  my $args = shift;
+
+  my $req_order = $args->{order_req}
+    ? "ORDER BY $args->{order_req}"
+    : ''
+  ;
+
+  is_same_sql_bind(
+    $rs->search ({}, {order_by => $args->{order_by}})->as_query,
+    "(SELECT
+      me__id, source, owner, title, price, owner__id, name FROM
+      (SELECT
+        TOP 1 me__id, source, owner, title, price, owner__id, name FROM
+         (SELECT
+           TOP 4 me.id AS me__id, me.source, me.owner, me.title, me.price, owner.id AS owner__id, owner.name FROM
+           books me
+           JOIN owners owner ON owner.id = me.owner
+           WHERE ( source = ? )
+           ORDER BY $args->{order_inner}
+         ) me ORDER BY $args->{order_outer}
+      ) me $req_order
+    )",
+    [ [ source => 'Library' ] ],
+  );
+}
+
+my @tests = (
+  {
+    order_by => \'foo DESC',
+    order_req => 'foo DESC',
+    order_inner => 'foo DESC',
+    order_outer => 'foo ASC'
+  },
+  {
+    order_by => { -asc => 'foo'  },
+    order_req => 'foo ASC',
+    order_inner => 'foo ASC',
+    order_outer => 'foo DESC',
+  },
+  {
+    order_by => 'foo',
+    order_req => 'foo',
+    order_inner => 'foo ASC',
+    order_outer => 'foo DESC',
+  },
+  {
+    order_by => [ qw{ foo bar}   ],
+    order_req => 'foo, bar',
+    order_inner => 'foo ASC,bar ASC',
+    order_outer => 'foo DESC, bar DESC',
+  },
+  {
+    order_by => { -desc => 'foo' },
+    order_req => 'foo DESC',
+    order_inner => 'foo DESC',
+    order_outer => 'foo ASC',
+  },
+  {
+    order_by => ['foo', { -desc => 'bar' } ],
+    order_req => 'foo, bar DESC',
+    order_inner => 'foo ASC, bar DESC',
+    order_outer => 'foo DESC, bar ASC',
+  },
+  {
+    order_by => { -asc => [qw{ foo bar }] },
+    order_req => 'foo ASC, bar ASC',
+    order_inner => 'foo ASC, bar ASC',
+    order_outer => 'foo DESC, bar DESC',
+  },
+  {
+    order_by => [
+      { -asc => 'foo' },
+      { -desc => [qw{bar}] },
+      { -asc  => [qw{hello sensors}]},
+    ],
+    order_req => 'foo ASC, bar DESC, hello ASC, sensors ASC',
+    order_inner => 'foo ASC, bar DESC, hello ASC, sensors ASC',
+    order_outer => 'foo DESC, bar ASC, hello DESC, sensors DESC',
+  },
+);
+
+my @default_tests = ( undef, '', {}, [] );
+
+plan (tests => scalar @tests + scalar @default_tests + 1);
+
+test_order ($_) for @tests;
+default_test_order ($_) for @default_tests;
+
+
+is_same_sql_bind (
+  $rs->search ({}, { group_by => 'title', order_by => 'title' })->as_query,
+'(SELECT
+me.id, me.source, me.owner, me.title, me.price, owner.id, owner.name FROM
+   ( SELECT
+      id, source, owner, title, price FROM
+      ( SELECT
+         TOP 1 id, source, owner, title, price FROM
+         ( SELECT
+            TOP 4 me.id, me.source, me.owner, me.title, me.price FROM
+            books me  JOIN
+            owners owner ON owner.id = me.owner
+            WHERE ( source = ? )
+            GROUP BY title
+            ORDER BY title ASC
+         ) me
+         ORDER BY title DESC
+      ) me
+      ORDER BY title
+   ) me  JOIN
+   owners owner ON owner.id = me.owner WHERE
+   ( source = ? )
+   ORDER BY title)' ,
+  [ [ source => 'Library' ], [ source => 'Library' ] ],
+);

Copied: DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes.t (from rev 7989, DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes.t)
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,75 @@
+use strict;
+use warnings;
+
+use Test::More;
+use IO::File;
+
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+
+BEGIN {
+    eval "use DBD::SQLite";
+    plan $@
+        ? ( skip_all => 'needs DBD::SQLite for testing' )
+        : ( tests => 7 );
+}
+
+
+use_ok('DBICTest');
+use_ok('DBIC::DebugObj');
+my $schema = DBICTest->init_schema();
+
+#diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
+
+$schema->storage->sql_maker->quote_char('`');
+$schema->storage->sql_maker->name_sep('.');
+
+my ($sql, @bind);
+$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
+$schema->storage->debug(1);
+
+my $rs;
+
+$rs = $schema->resultset('CD')->search(
+           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
+           { join => 'artist' });
+eval { $rs->count };
+is_same_sql_bind(
+  $sql, \@bind,
+  "SELECT COUNT( * ) FROM cd `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
+  'got correct SQL for count query with quoting'
+);
+
+my $order = 'year DESC';
+$rs = $schema->resultset('CD')->search({},
+            { 'order_by' => $order });
+eval { $rs->first };
+like($sql, qr/ORDER BY `\Q${order}\E`/, 'quoted ORDER BY with DESC (should use a scalarref anyway)');
+
+$rs = $schema->resultset('CD')->search({},
+            { 'order_by' => \$order });
+eval { $rs->first };
+like($sql, qr/ORDER BY \Q${order}\E/, 'did not quote ORDER BY with scalarref');
+
+$schema->storage->sql_maker->quote_char([qw/[ ]/]);
+$schema->storage->sql_maker->name_sep('.');
+
+$rs = $schema->resultset('CD')->search(
+           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
+           { join => 'artist' });
+eval { $rs->count };
+is_same_sql_bind(
+  $sql, \@bind,
+  "SELECT COUNT( * ) FROM cd [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
+  'got correct SQL for count query with bracket quoting'
+);
+
+my %data = (
+       name => 'Bill',
+       order => '12'
+);
+
+$schema->storage->sql_maker->quote_char('`');
+$schema->storage->sql_maker->name_sep('.');
+
+is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');

Copied: DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes_newstyle.t (from rev 7989, DBIx-Class/0.08/branches/dbicadmin_refactor/t/19quotes_newstyle.t)
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes_newstyle.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/quotes/quotes_newstyle.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,92 @@
+use strict;
+use warnings;
+
+use Test::More;
+use IO::File;
+
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+
+BEGIN {
+    eval "use DBD::SQLite";
+    plan $@
+        ? ( skip_all => 'needs DBD::SQLite for testing' )
+        : ( tests => 7 );
+}
+
+use_ok('DBICTest');
+use_ok('DBIC::DebugObj');
+
+my $schema = DBICTest->init_schema();
+
+#diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
+
+my $dsn = $schema->storage->_dbi_connect_info->[0];
+$schema->connection(
+  $dsn,
+  undef,
+  undef,
+  { AutoCommit => 1 },
+  { quote_char => '`', name_sep => '.' },
+);
+
+my ($sql, @bind);
+$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)),
+$schema->storage->debug(1);
+
+my $rs;
+
+$rs = $schema->resultset('CD')->search(
+           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
+           { join => 'artist' });
+eval { $rs->count };
+is_same_sql_bind(
+  $sql, \@bind,
+  "SELECT COUNT( * ) FROM cd `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
+  'got correct SQL for count query with quoting'
+);
+
+my $order = 'year DESC';
+$rs = $schema->resultset('CD')->search({},
+            { 'order_by' => $order });
+eval { $rs->first };
+like($sql, qr/ORDER BY `\Q${order}\E`/, 'quoted ORDER BY with DESC (should use a scalarref anyway)');
+
+$rs = $schema->resultset('CD')->search({},
+            { 'order_by' => \$order });
+eval { $rs->first };
+like($sql, qr/ORDER BY \Q${order}\E/, 'did not quote ORDER BY with scalarref');
+
+$schema->connection(
+  $dsn,
+  undef,
+  undef,
+  { AutoCommit => 1, quote_char => [qw/[ ]/], name_sep => '.' }
+);
+
+$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)),
+$schema->storage->debug(1);
+
+$rs = $schema->resultset('CD')->search(
+           { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
+           { join => 'artist' });
+eval { $rs->count };
+is_same_sql_bind(
+  $sql, \@bind,
+  "SELECT COUNT( * ) FROM cd [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
+  'got correct SQL for count query with bracket quoting'
+);
+
+my %data = (
+       name => 'Bill',
+       order => '12'
+);
+
+$schema->connection(
+  $dsn,
+  undef,
+  undef,
+  { AutoCommit => 1, quote_char => '`', name_sep => '.' }
+);
+
+is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');

Copied: DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker.t (from rev 7989, DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker.t)
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,78 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+
+use_ok('DBICTest');
+
+my $schema = DBICTest->init_schema(no_deploy => 1);
+
+my $sql_maker = $schema->storage->sql_maker;
+
+
+{
+  my ($sql, @bind) = $sql_maker->insert(
+            'lottery',
+            {
+              'day' => '2008-11-16',
+              'numbers' => [13, 21, 34, 55, 89]
+            }
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/,
+      [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
+    'sql_maker passes arrayrefs in insert'
+  );
+
+
+  ($sql, @bind) = $sql_maker->update(
+            'lottery',
+            {
+              'day' => '2008-11-16',
+              'numbers' => [13, 21, 34, 55, 89]
+            }
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/UPDATE lottery SET day = ?, numbers = ?/,
+      [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
+    'sql_maker passes arrayrefs in update'
+  );
+}
+
+# make sure the cookbook caveat of { $op, \'...' } no longer applies
+{
+  my ($sql, @bind) = $sql_maker->where({
+    last_attempt => \ '< now() - interval "12 hours"',
+    next_attempt => { '<', \ 'now() - interval "12 hours"' },
+    created => [
+      { '<=', \ '1969' },
+      \ '> 1984',
+    ],
+  });
+  is_same_sql_bind(
+    $sql,
+    \@bind,
+    'WHERE
+          (created <= 1969 OR created > 1984 )
+      AND last_attempt < now() - interval "12 hours"
+      AND next_attempt < now() - interval "12 hours"
+    ',
+    [],
+  );
+}
+
+# Make sure the carp/croak override in SQLA works (via SQLAHacks)
+my $file = quotemeta (__FILE__);
+throws_ok (sub {
+  $schema->resultset ('Artist')->search ({}, { order_by => { -asc => 'stuff', -desc => 'staff' } } )->as_query;
+}, qr/$file/, 'Exception correctly croak()ed');
+
+done_testing;

Copied: DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker_quote.t (from rev 7989, DBIx-Class/0.08/branches/dbicadmin_refactor/t/95sql_maker_quote.t)
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker_quote.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/sqlahacks/sql_maker/sql_maker_quote.t	2010-01-17 16:20:32 UTC (rev 8345)
@@ -0,0 +1,357 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+
+use_ok('DBICTest');
+
+my $schema = DBICTest->init_schema();
+
+my $sql_maker = $schema->storage->sql_maker;
+
+$sql_maker->quote_char('`');
+$sql_maker->name_sep('.');
+
+my ($sql, @bind) = $sql_maker->select(
+          [
+            {
+              'me' => 'cd'
+            },
+            [
+              {
+                'artist' => 'artist',
+                '-join_type' => ''
+              },
+              {
+                'artist.artistid' => 'me.artist'
+              }
+            ],
+            [
+              {
+                'tracks' => 'tracks',
+                '-join_type' => 'left'
+              },
+              {
+                'tracks.cd' => 'me.cdid'
+              }
+            ],
+          ],
+          [
+            'me.cdid',
+            { count => 'tracks.cd' },
+            { min => 'me.year', -as => 'me.minyear' },
+          ],
+          {
+            'artist.name' => 'Caterwauler McCrae',
+            'me.year' => 2001
+          },
+          [],
+          undef,
+          undef
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/
+    SELECT `me`.`cdid`, COUNT( `tracks`.`cd` ), MIN( `me`.`year` ) AS `me`.`minyear`
+      FROM `cd` `me`
+      JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` )
+      LEFT JOIN `tracks` `tracks` ON ( `tracks`.`cd` = `me`.`cdid` )
+    WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )
+  /,
+  [ ['artist.name' => 'Caterwauler McCrae'], ['me.year' => 2001] ],
+  'got correct SQL and bind parameters for complex select query with quoting'
+);
+
+
+($sql, @bind) = $sql_maker->select(
+          [
+            {
+              'me' => 'cd'
+            }
+          ],
+          [
+            'me.cdid',
+            'me.artist',
+            'me.title',
+            'me.year'
+          ],
+          undef,
+          'year DESC',
+          undef,
+          undef
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year DESC`/, [],
+  'scalar ORDER BY okay (single value)'
+);
+
+
+($sql, @bind) = $sql_maker->select(
+          [
+            {
+              'me' => 'cd'
+            }
+          ],
+          [
+            'me.cdid',
+            'me.artist',
+            'me.title',
+            'me.year'
+          ],
+          undef,
+          [
+            'year DESC',
+            'title ASC'
+          ],
+          undef,
+          undef
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year DESC`, `title ASC`/, [],
+  'scalar ORDER BY okay (multiple values)'
+);
+
+{
+  ($sql, @bind) = $sql_maker->select(
+            [
+              {
+                'me' => 'cd'
+              }
+            ],
+            [
+              'me.cdid',
+              'me.artist',
+              'me.title',
+              'me.year'
+            ],
+            undef,
+            { -desc => 'year' },
+            undef,
+            undef
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC/, [],
+    'hashref ORDER BY okay (single value)'
+  );
+
+
+  ($sql, @bind) = $sql_maker->select(
+            [
+              {
+                'me' => 'cd'
+              }
+            ],
+            [
+              'me.cdid',
+              'me.artist',
+              'me.title',
+              'me.year'
+            ],
+            undef,
+            [
+              { -desc => 'year' },
+              { -asc => 'title' }
+            ],
+            undef,
+            undef
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC, `title` ASC/, [],
+    'hashref ORDER BY okay (multiple values)'
+  );
+
+}
+
+
+($sql, @bind) = $sql_maker->select(
+          [
+            {
+              'me' => 'cd'
+            }
+          ],
+          [
+            'me.cdid',
+            'me.artist',
+            'me.title',
+            'me.year'
+          ],
+          undef,
+          \'year DESC',
+          undef,
+          undef
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC/, [],
+  'did not quote ORDER BY with scalarref (single value)'
+);
+
+
+($sql, @bind) = $sql_maker->select(
+          [
+            {
+              'me' => 'cd'
+            }
+          ],
+          [
+            'me.cdid',
+            'me.artist',
+            'me.title',
+            'me.year'
+          ],
+          undef,
+          [
+            \'year DESC',
+            \'title ASC'
+          ],
+          undef,
+          undef
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC, title ASC/, [],
+  'did not quote ORDER BY with scalarref (multiple values)'
+);
+
+
+($sql, @bind) = $sql_maker->select(
+  [ { me => 'cd' }                  ],
+  [qw/ me.cdid me.artist me.title  /],
+  { cdid => \['rlike ?', [cdid => 'X'] ]       },
+  { group_by => 'title', having => \['count(me.artist) > ?', [ cnt => 2] ] },
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title` FROM `cd` `me` WHERE ( `cdid` rlike ? ) GROUP BY `title` HAVING count(me.artist) > ?/,
+  [ [ cdid => 'X'], ['cnt' => '2'] ],
+  'Quoting works with where/having arrayrefsrefs',
+);
+
+
+($sql, @bind) = $sql_maker->select(
+  [ { me => 'cd' }                  ],
+  [qw/ me.cdid me.artist me.title  /],
+  { cdid => \'rlike X'              },
+  { group_by => 'title', having => \'count(me.artist) > 2' },
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title` FROM `cd` `me` WHERE ( `cdid` rlike X ) GROUP BY `title` HAVING count(me.artist) > 2/,
+  [],
+  'Quoting works with where/having scalarrefs',
+);
+
+
+($sql, @bind) = $sql_maker->update(
+          'group',
+          {
+            'order' => '12',
+            'name' => 'Bill'
+          }
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/UPDATE `group` SET `name` = ?, `order` = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
+  'quoted table names for UPDATE'
+);
+
+{
+  ($sql, @bind) = $sql_maker->select(
+        [
+          {
+            'me' => 'cd'
+          }
+        ],
+        [
+          'me.*'
+        ],
+        undef,
+        [],
+        undef,
+        undef    
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/SELECT `me`.* FROM `cd` `me`/, [],
+    'select attr with me.* is right'
+  );
+}
+
+
+$sql_maker->quote_char([qw/[ ]/]);
+
+($sql, @bind) = $sql_maker->select(
+          [
+            {
+              'me' => 'cd'
+            },
+            [
+              {
+                'artist' => 'artist',
+                '-join_type' => ''
+              },
+              {
+                'artist.artistid' => 'me.artist'
+              }
+            ]
+          ],
+          [
+            {
+              max => 'rank',
+              -as => 'max_rank',
+            },
+            'rank',
+            {
+              'count' => '*',
+              -as => 'cnt',
+            }
+          ],
+          {
+            'artist.name' => 'Caterwauler McCrae',
+            'me.year' => 2001
+          },
+          [],
+          undef,
+          undef
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT MAX ( [rank] ) AS [max_rank], [rank], COUNT( * ) AS [cnt] FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/, [ ['artist.name' => 'Caterwauler McCrae'], ['me.year' => 2001] ],
+  'got correct SQL and bind parameters for count query with bracket quoting'
+);
+
+
+($sql, @bind) = $sql_maker->update(
+          'group',
+          {
+            'order' => '12',
+            'name' => 'Bill'
+          }
+);
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q/UPDATE [group] SET [name] = ?, [order] = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
+  'bracket quoted table names for UPDATE'
+);
+
+done_testing;




More information about the Bast-commits mailing list