[Bast-commits] r6421 - in DBIx-Class/0.08/branches/multi_stuff: .
examples/Schema examples/Schema/MyDatabase
examples/Schema/MyDatabase/Main/Result examples/Schema/db
lib/DBIx lib/DBIx/Class lib/DBIx/Class/CDBICompat
lib/DBIx/Class/ClassResolver lib/DBIx/Class/InflateColumn
lib/DBIx/Class/Manual lib/DBIx/Class/PK
lib/DBIx/Class/PK/Auto lib/DBIx/Class/Relationship
lib/DBIx/Class/ResultClass lib/DBIx/Class/ResultSource
lib/DBIx/Class/ResultSourceProxy lib/DBIx/Class/SQLAHacks
lib/DBIx/Class/Schema lib/DBIx/Class/Serialize
lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI
lib/DBIx/Class/Storage/DBI/ODBC lib/DBIx/Class/Storage/DBI/Oracle
lib/DBIx/Class/Storage/DBI/Replicated
lib/DBIx/Class/Storage/DBI/Replicated/Balancer
lib/DBIx/Class/Storage/DBI/Role lib/DBIx/Class/Storage/DBI/Sybase
lib/SQL/Translator/Parser/DBIx
lib/SQL/Translator/Producer/DBIx/Class maint script t
t/96multi_create t/cdbi t/cdbi/DeepAbstractSearch
t/cdbi/abstract t/cdbi/sweet t/cdbi/testlib
t/cdbi/testlib/DBIC/Test t/count t/delete t/lib t/lib/DBIC
t/lib/DBICNSTest t/lib/DBICNSTest/OtherRslt
t/lib/DBICNSTest/RSet t/lib/DBICNSTest/Result
t/lib/DBICNSTest/ResultSet t/lib/DBICNSTest/Rslt
t/lib/DBICNSTest/RtBug41083 t/lib/DBICNSTest/RtBug41083/ResultSet
t/lib/DBICNSTest/RtBug41083/ResultSet_A
t/lib/DBICNSTest/RtBug41083/Schema
t/lib/DBICNSTest/RtBug41083/Schema/Foo
t/lib/DBICNSTest/RtBug41083/Schema_A
t/lib/DBICNSTest/RtBug41083/Schema_A/A t/lib/DBICTest
t/lib/DBICTest/ForeignComponent t/lib/DBICTest/Plain
t/lib/DBICTest/ResultSetManager t/lib/DBICTest/Schema
t/lib/DBICTest/Taint/Classes
t/lib/DBICTest/Taint/Namespaces/Result t/ordered t/prefetch
t/resultset t/search
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Mon May 25 16:47:00 GMT 2009
Author: ribasushi
Date: 2009-05-25 16:46:59 +0000 (Mon, 25 May 2009)
New Revision: 6421
Added:
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks/
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks/OracleJoins.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiColumnIn.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/WithDSN.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
DBIx-Class/0.08/branches/multi_stuff/t/746sybase.t
DBIx-Class/0.08/branches/multi_stuff/t/count/
DBIx-Class/0.08/branches/multi_stuff/t/count/distinct.t
DBIx-Class/0.08/branches/multi_stuff/t/count/grouped_pager.t
DBIx-Class/0.08/branches/multi_stuff/t/count/in_subquery.t
DBIx-Class/0.08/branches/multi_stuff/t/count/joined.t
DBIx-Class/0.08/branches/multi_stuff/t/count/prefetch.t
DBIx-Class/0.08/branches/multi_stuff/t/delete/
DBIx-Class/0.08/branches/multi_stuff/t/delete/m2m.t
DBIx-Class/0.08/branches/multi_stuff/t/delete/related.t
DBIx-Class/0.08/branches/multi_stuff/t/from_subquery.t
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/AuthorCheck.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResult.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResultSet.pm
DBIx-Class/0.08/branches/multi_stuff/t/prefetch/diamond.t
DBIx-Class/0.08/branches/multi_stuff/t/resultset/update_delete.t
DBIx-Class/0.08/branches/multi_stuff/t/zzzzzzz_perl_perf_bug.t
Removed:
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm
DBIx-Class/0.08/branches/multi_stuff/t/53delete_chained.t
DBIx-Class/0.08/branches/multi_stuff/t/53delete_related.t
DBIx-Class/0.08/branches/multi_stuff/t/99rh_perl_perf_bug.t
DBIx-Class/0.08/branches/multi_stuff/t/deleting_many_to_many.t
Modified:
DBIx-Class/0.08/branches/multi_stuff/
DBIx-Class/0.08/branches/multi_stuff/Changes
DBIx-Class/0.08/branches/multi_stuff/Features_09
DBIx-Class/0.08/branches/multi_stuff/MANIFEST.SKIP
DBIx-Class/0.08/branches/multi_stuff/Makefile.PL
DBIx-Class/0.08/branches/multi_stuff/TODO
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main.pm
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main/Result/Artist.pm
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main/Result/Cd.pm
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main/Result/Track.pm
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/db/example.sql
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/insertdb.pl
DBIx-Class/0.08/branches/multi_stuff/examples/Schema/testdb.pl
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/AccessorGroup.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AbstractSearch.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AccessorMapping.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AttributeAPI.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AutoUpdate.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ColumnCase.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ColumnGroups.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ColumnsAsHash.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Constraints.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Constructor.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Copy.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/DestroyWarning.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/GetSet.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ImaDBI.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Iterator.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LazyLoading.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/NoObjectIndex.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Pager.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ReadOnly.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Relationship.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Relationships.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Retrieve.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/SQLTransformer.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Stringify.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/TempColumns.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Triggers.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ClassResolver/PassThrough.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Componentised.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Core.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Cursor.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/DB.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Exception.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/DateTime.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/File.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Component.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Cookbook.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/DocMap.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Example.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/FAQ.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Glossary.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Intro.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Joining.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Reading.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Troubleshooting.pod
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Ordered.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/DB2.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/MSSQL.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/MySQL.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/Pg.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/SQLite.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Accessor.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Base.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/BelongsTo.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/CascadeActions.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/HasMany.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/HasOne.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Helpers.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ManyToMany.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ProxyMethods.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultClass/HashRefInflator.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetColumn.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetManager.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetProxy.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource/Table.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource/View.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceHandle.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceProxy.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceProxy/Table.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Row.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema/Versioned.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Serialize/Storable.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/StartupCheck.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Cursor.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/DB2.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MSSQL.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/NoBindVars.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Pg.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Role/QueryCounter.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/SQLite.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/mysql.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/Statistics.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/TxnScopeGuard.pm
DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/UTF8Columns.pm
DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Parser/DBIx/Class.pm
DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Producer/DBIx/Class/File.pm
DBIx-Class/0.08/branches/multi_stuff/maint/benchmark_hashrefinflator.pl
DBIx-Class/0.08/branches/multi_stuff/maint/gen-pod-index.pl
DBIx-Class/0.08/branches/multi_stuff/maint/gen-schema.pl
DBIx-Class/0.08/branches/multi_stuff/maint/gen-tests.pl
DBIx-Class/0.08/branches/multi_stuff/maint/inheritance_pod.pl
DBIx-Class/0.08/branches/multi_stuff/maint/steal-svn-log.sh
DBIx-Class/0.08/branches/multi_stuff/maint/svn-log.perl
DBIx-Class/0.08/branches/multi_stuff/script/dbicadmin
DBIx-Class/0.08/branches/multi_stuff/t/02pod.t
DBIx-Class/0.08/branches/multi_stuff/t/03podcoverage.t
DBIx-Class/0.08/branches/multi_stuff/t/04dont_break_c3.t
DBIx-Class/0.08/branches/multi_stuff/t/05components.t
DBIx-Class/0.08/branches/multi_stuff/t/100extra_source.t
DBIx-Class/0.08/branches/multi_stuff/t/100populate.t
DBIx-Class/0.08/branches/multi_stuff/t/101populate_rs.t
DBIx-Class/0.08/branches/multi_stuff/t/102load_classes.t
DBIx-Class/0.08/branches/multi_stuff/t/103many_to_many_warning.t
DBIx-Class/0.08/branches/multi_stuff/t/104view.t
DBIx-Class/0.08/branches/multi_stuff/t/18inserterror.t
DBIx-Class/0.08/branches/multi_stuff/t/19quotes.t
DBIx-Class/0.08/branches/multi_stuff/t/19quotes_newstyle.t
DBIx-Class/0.08/branches/multi_stuff/t/20setuperrors.t
DBIx-Class/0.08/branches/multi_stuff/t/26dumper.t
DBIx-Class/0.08/branches/multi_stuff/t/30dbicplain.t
DBIx-Class/0.08/branches/multi_stuff/t/31stats.t
DBIx-Class/0.08/branches/multi_stuff/t/32connect_code_ref.t
DBIx-Class/0.08/branches/multi_stuff/t/33storage_reconnect.t
DBIx-Class/0.08/branches/multi_stuff/t/34exception_action.t
DBIx-Class/0.08/branches/multi_stuff/t/35disable_sth_caching.t
DBIx-Class/0.08/branches/multi_stuff/t/36datetime.t
DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_1.t
DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_2.t
DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_3.t
DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_4.t
DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_rt41083.t
DBIx-Class/0.08/branches/multi_stuff/t/40resultsetmanager.t
DBIx-Class/0.08/branches/multi_stuff/t/41orrible.t
DBIx-Class/0.08/branches/multi_stuff/t/42toplimit.t
DBIx-Class/0.08/branches/multi_stuff/t/46where_attribute.t
DBIx-Class/0.08/branches/multi_stuff/t/47bind_attribute.t
DBIx-Class/0.08/branches/multi_stuff/t/50fork.t
DBIx-Class/0.08/branches/multi_stuff/t/51threads.t
DBIx-Class/0.08/branches/multi_stuff/t/51threadtxn.t
DBIx-Class/0.08/branches/multi_stuff/t/52cycle.t
DBIx-Class/0.08/branches/multi_stuff/t/54taint.t
DBIx-Class/0.08/branches/multi_stuff/t/55storage_stress.t
DBIx-Class/0.08/branches/multi_stuff/t/60core.t
DBIx-Class/0.08/branches/multi_stuff/t/61findnot.t
DBIx-Class/0.08/branches/multi_stuff/t/63register_class.t
DBIx-Class/0.08/branches/multi_stuff/t/63register_source.t
DBIx-Class/0.08/branches/multi_stuff/t/64db.t
DBIx-Class/0.08/branches/multi_stuff/t/65multipk.t
DBIx-Class/0.08/branches/multi_stuff/t/66relationship.t
DBIx-Class/0.08/branches/multi_stuff/t/67pager.t
DBIx-Class/0.08/branches/multi_stuff/t/68inflate.t
DBIx-Class/0.08/branches/multi_stuff/t/68inflate_resultclass_hashrefinflator.t
DBIx-Class/0.08/branches/multi_stuff/t/68inflate_serialize.t
DBIx-Class/0.08/branches/multi_stuff/t/69update.t
DBIx-Class/0.08/branches/multi_stuff/t/70auto.t
DBIx-Class/0.08/branches/multi_stuff/t/71mysql.t
DBIx-Class/0.08/branches/multi_stuff/t/72pg.t
DBIx-Class/0.08/branches/multi_stuff/t/73oracle.t
DBIx-Class/0.08/branches/multi_stuff/t/73oracle_inflate.t
DBIx-Class/0.08/branches/multi_stuff/t/745db2.t
DBIx-Class/0.08/branches/multi_stuff/t/746db2_400.t
DBIx-Class/0.08/branches/multi_stuff/t/746mssql.t
DBIx-Class/0.08/branches/multi_stuff/t/74mssql.t
DBIx-Class/0.08/branches/multi_stuff/t/75limit.t
DBIx-Class/0.08/branches/multi_stuff/t/76joins.t
DBIx-Class/0.08/branches/multi_stuff/t/76select.t
DBIx-Class/0.08/branches/multi_stuff/t/77join_count.t
DBIx-Class/0.08/branches/multi_stuff/t/78self_referencial.t
DBIx-Class/0.08/branches/multi_stuff/t/79aliasing.t
DBIx-Class/0.08/branches/multi_stuff/t/80unique.t
DBIx-Class/0.08/branches/multi_stuff/t/81transactions.t
DBIx-Class/0.08/branches/multi_stuff/t/82cascade_copy.t
DBIx-Class/0.08/branches/multi_stuff/t/83cache.t
DBIx-Class/0.08/branches/multi_stuff/t/84serialize.t
DBIx-Class/0.08/branches/multi_stuff/t/85utf8.t
DBIx-Class/0.08/branches/multi_stuff/t/86might_have.t
DBIx-Class/0.08/branches/multi_stuff/t/86sqlt.t
DBIx-Class/0.08/branches/multi_stuff/t/87ordered.t
DBIx-Class/0.08/branches/multi_stuff/t/88result_set_column.t
DBIx-Class/0.08/branches/multi_stuff/t/89dbicadmin.t
DBIx-Class/0.08/branches/multi_stuff/t/89inflate_datetime.t
DBIx-Class/0.08/branches/multi_stuff/t/90ensure_class_loaded.t
DBIx-Class/0.08/branches/multi_stuff/t/90join_torture.t
DBIx-Class/0.08/branches/multi_stuff/t/91debug.t
DBIx-Class/0.08/branches/multi_stuff/t/91merge_attr.t
DBIx-Class/0.08/branches/multi_stuff/t/92storage.t
DBIx-Class/0.08/branches/multi_stuff/t/92storage_on_connect_do.t
DBIx-Class/0.08/branches/multi_stuff/t/93nobindvars.t
DBIx-Class/0.08/branches/multi_stuff/t/93single_accessor_object.t
DBIx-Class/0.08/branches/multi_stuff/t/93storage_replication.t
DBIx-Class/0.08/branches/multi_stuff/t/94pk_mutation.t
DBIx-Class/0.08/branches/multi_stuff/t/94versioning.t
DBIx-Class/0.08/branches/multi_stuff/t/95sql_maker.t
DBIx-Class/0.08/branches/multi_stuff/t/95sql_maker_quote.t
DBIx-Class/0.08/branches/multi_stuff/t/96_is_deteministic_value.t
DBIx-Class/0.08/branches/multi_stuff/t/96file_column.t
DBIx-Class/0.08/branches/multi_stuff/t/96multi_create.t
DBIx-Class/0.08/branches/multi_stuff/t/96multi_create/cd_single.t
DBIx-Class/0.08/branches/multi_stuff/t/96multi_create/multilev_might_have_PKeqFK.t
DBIx-Class/0.08/branches/multi_stuff/t/96multi_create_new.t
DBIx-Class/0.08/branches/multi_stuff/t/96multi_create_torture.t
DBIx-Class/0.08/branches/multi_stuff/t/97result_class.t
DBIx-Class/0.08/branches/multi_stuff/t/98savepoints.t
DBIx-Class/0.08/branches/multi_stuff/t/99dbic_sqlt_parser.t
DBIx-Class/0.08/branches/multi_stuff/t/bindtype_columns.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/01-columns.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/02-Film.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/03-subclassing.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/04-lazy.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/06-hasa.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/08-inheritcols.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/09-has_many.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/11-triggers.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/12-filter.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/13-constraint.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/14-might_have.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/15-accessor.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/16-reserved.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/18-has_a.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/19-set_sql.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/21-iterator.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/22-deflate_order.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/22-self_referential.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/23-cascade.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/24-meta_info.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/26-mutator.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/30-pager.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/68-inflate_has_a.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/98-failure.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/DeepAbstractSearch/01_search.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/abstract/search_where.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/columns_as_hashes.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/columns_dont_override_custom_accessors.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/construct.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/copy.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/early_column_heisenbug.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/has_many_loads_foreign_class.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/hasa_without_loading.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/max_min_value_of.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/mk_group_accessors.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/multi_column_set.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/object_cache.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/retrieve_from_sql_with_limit.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/set_to_undef.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/set_vs_DateTime.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/sweet/08pager.t
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Actor.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/ActorAlias.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Binary.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Blurb.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/CDBase.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/DBIC/Test/SQLite.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Director.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Film.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Lazy.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Log.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyBase.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyFilm.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyFoo.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyStar.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyStarLink.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyStarLinkMCPK.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Order.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/OtherFilm.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/OtherThing.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/PgBase.pm
DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Thing.pm
DBIx-Class/0.08/branches/multi_stuff/t/dbh_do.t
DBIx-Class/0.08/branches/multi_stuff/t/discard_changes_in_DESTROY.t
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBIC/SqlMakerTest.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/OtherRslt/D.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RSBase.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RSet/A.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RSet/C.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Result/A.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Result/B.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/ResultSet/A.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/ResultSet/C.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Rslt/A.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Rslt/B.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/ResultSet.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/ResultSet/Foo.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema/Foo.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema/Foo/Sub.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema_A/A/Sub.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ErrorComponent.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/FakeComponent.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ForeignComponent.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ForeignComponent/TestComp.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/OptionalComponent.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Plain.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Plain/Test.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ResultSetManager.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ResultSetManager/Foo.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artist.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistSourceName.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistSubclass.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork_to_Artist.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BindType.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Bookmark.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BooksInLibrary.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD_to_Producer.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Collection.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CollectionObject.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Dummy.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Employee.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Encoded.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Event.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZ.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZDeprecated.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FileColumn.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ForceForeign.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Genre.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Image.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LinerNotes.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Link.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LyricVersion.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Lyrics.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoPrimaryKey.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoSuchClass.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/OneKey.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Owners.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Producer.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRef.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRefAlias.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SequenceTest.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Serialized.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Tag.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Track.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TreeLike.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeys.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TypedObject.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year1999CDs.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year2000CDs.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Stats.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/SyntaxErrorComponent1.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/SyntaxErrorComponent2.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/SyntaxErrorComponent3.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Taint/Classes/Auto.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Taint/Classes/Manual.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Taint/Namespaces/Result/Test.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICVersionNew.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICVersionOrig.pm
DBIx-Class/0.08/branches/multi_stuff/t/lib/sqlite.sql
DBIx-Class/0.08/branches/multi_stuff/t/ordered/cascade_delete.t
DBIx-Class/0.08/branches/multi_stuff/t/prefetch/attrs_untouched.t
DBIx-Class/0.08/branches/multi_stuff/t/prefetch/multiple_hasmany.t
DBIx-Class/0.08/branches/multi_stuff/t/prefetch/pollute_already_joined.t
DBIx-Class/0.08/branches/multi_stuff/t/prefetch/rows_bug.t
DBIx-Class/0.08/branches/multi_stuff/t/prefetch/standard.t
DBIx-Class/0.08/branches/multi_stuff/t/relationship_after_update.t
DBIx-Class/0.08/branches/multi_stuff/t/relationship_doesnt_exist.t
DBIx-Class/0.08/branches/multi_stuff/t/resultset/as_query.t
DBIx-Class/0.08/branches/multi_stuff/t/resultset_class.t
DBIx-Class/0.08/branches/multi_stuff/t/resultset_overload.t
DBIx-Class/0.08/branches/multi_stuff/t/search/subquery.t
Log:
r6110 at Thesaurus (orig r6109): plu | 2009-05-02 21:11:40 +0200
Failing testcase for using subselect (as_query)
r6111 at Thesaurus (orig r6110): ribasushi | 2009-05-03 02:00:19 +0200
Failing test without immediate fixes go to branches, not to trunk
r6114 at Thesaurus (orig r6113): ribasushi | 2009-05-03 10:23:28 +0200
Bump SQLA ependencies so parenthesis_significant is guaranteed to be there
r6127 at Thesaurus (orig r6126): arcanez | 2009-05-05 09:27:56 +0200
r6037 at mullet (orig r6036): arcanez | 2009-04-30 01:24:41 -0700
branch to work on Sybase/MSSQL subtleties
r6038 at mullet (orig r6037): arcanez | 2009-04-30 01:27:11 -0700
jump to ::DBI::Sybase::MSSQL if we are using MSSQL through Sybase
r6062 at mullet (orig r6061): arcanez | 2009-04-30 14:05:24 -0700
fixes for MSSQL via Sybase
r6126 at mullet (orig r6125): arcanez | 2009-05-05 00:27:13 -0700
add a line to Changes and add a CAVEAT
r6164 at Thesaurus (orig r6163): ribasushi | 2009-05-07 19:09:01 +0200
r6115 at Thesaurus (orig r6114): plu | 2009-05-03 10:39:16 +0200
new branch to fix $rs->update and $rs->delete using the new as_query method
r6116 at Thesaurus (orig r6115): plu | 2009-05-03 10:52:07 +0200
Methods update/delete on resultset use now new as_query method to updated/delete properly on joined/prefetched resultset using a subquery. Therefore some tests have been added and some have been changed as well as the warnings around $rs->update/delete have been removed. Cheers!
r6117 at Thesaurus (orig r6116): plu | 2009-05-03 11:13:48 +0200
Using "is" instead of "cmp_ok"
r6160 at Thesaurus (orig r6159): ribasushi | 2009-05-07 11:58:14 +0200
Back out skip_parens support in as_query
r6161 at Thesaurus (orig r6160): ribasushi | 2009-05-07 19:00:48 +0200
This test is completely borked, needs a rewrite
r6162 at Thesaurus (orig r6161): ribasushi | 2009-05-07 19:07:19 +0200
Temporary fix or the IN ( ( ... ) ) problem until we get proper SQLA AST (needs SQLA released with commit 6158 to work)
r6165 at Thesaurus (orig r6164): ribasushi | 2009-05-07 19:11:46 +0200
Changes, remove merged branch
r6169 at Thesaurus (orig r6168): ribasushi | 2009-05-07 19:24:54 +0200
Bump SQLA dependency so -in/-between workarounds overload properly
r6172 at Thesaurus (orig r6171): ribasushi | 2009-05-07 20:49:26 +0200
Cookbook cleanup
r6174 at Thesaurus (orig r6173): ribasushi | 2009-05-08 10:13:30 +0200
Throw away some debugging code
r6175 at Thesaurus (orig r6174): ribasushi | 2009-05-08 10:21:53 +0200
Documentation patch by nniuq
r6176 at Thesaurus (orig r6175): plu | 2009-05-08 10:30:20 +0200
Set NLS_LANG so we have a predictable date format when using MON
r6177 at Thesaurus (orig r6176): ribasushi | 2009-05-08 12:15:15 +0200
Fix POD
r6179 at Thesaurus (orig r6178): jgoulah | 2009-05-08 16:27:49 +0200
renaming rh performance test so it will show up at the end of test output
r6195 at Thesaurus (orig r6194): caelum | 2009-05-09 15:46:55 +0200
added postgres default port stuff to FAQ
r6199 at Thesaurus (orig r6198): mo | 2009-05-10 17:37:16 +0200
set_$rel accepts now a $link_vals hashref like add_to_$rel does
r6202 at Thesaurus (orig r6201): ribasushi | 2009-05-10 19:57:31 +0200
Require DBICTest.pm in all tests even if it is not needed at all
r6203 at Thesaurus (orig r6202): ribasushi | 2009-05-10 20:17:09 +0200
No more 'I forgot to run perl Makefile.PL'
r6204 at Thesaurus (orig r6203): ribasushi | 2009-05-10 21:35:03 +0200
Switch the m2m method warnings from warnings::register to $ENV{DBIC_METHOD_CLOBBER_OK} = 1
r6206 at Thesaurus (orig r6205): ribasushi | 2009-05-11 12:50:54 +0200
Change the makefile to test r6202
r6218 at Thesaurus (orig r6217): ribasushi | 2009-05-12 07:02:14 +0200
Trying to untangle failing merge (whitespace change)
r6220 at Thesaurus (orig r6219): ribasushi | 2009-05-12 07:02:56 +0200
r5757 at Thesaurus (orig r5756): arcanez | 2009-03-14 14:55:55 +0100
created count_distinct branch
r5758 at Thesaurus (orig r5757): arcanez | 2009-03-14 15:33:03 +0100
* change count with group_by (distinct) to use a subquery
* rewrite of _bind_to_sql (uses placeholders and bindvars)
* tests for count distinct
* fixed tests for from subquery
r5760 at Thesaurus (orig r5759): arcanez | 2009-03-16 16:48:28 +0100
don't remove the where clause unless we're doing distinct, it needs to be there
r5850 at Thesaurus (orig r5849): arcanez | 2009-03-30 21:40:05 +0200
* add more tests
* remove old cruft
* remove old note
r6035 at Thesaurus (orig r6034): ribasushi | 2009-04-30 09:10:36 +0200
Add joined count test
r6079 at Thesaurus (orig r6078): arcanez | 2009-05-01 08:41:34 +0200
cleanup/fix some broken tests
r6097 at Thesaurus (orig r6096): arcanez | 2009-05-01 19:37:04 +0200
make sure merge bind
test for aformentioned
TODO count_joined test for a little while
r6105 at Thesaurus (orig r6104): arcanez | 2009-05-02 02:33:49 +0200
remove hackish ways
r6106 at Thesaurus (orig r6105): arcanez | 2009-05-02 03:20:04 +0200
more fixes to tests
r6107 at Thesaurus (orig r6106): arcanez | 2009-05-02 03:33:47 +0200
remove DBIx::Class::Storage::DBI::MultiDistinctEmulation
r6111 at Thesaurus (orig r6110): ribasushi | 2009-05-03 02:00:19 +0200
Failing test without immediate fixes go to branches, not to trunk
r6114 at Thesaurus (orig r6113): ribasushi | 2009-05-03 10:23:28 +0200
Bump SQLA ependencies so parenthesis_significant is guaranteed to be there
r6148 at Thesaurus (orig r6147): ribasushi | 2009-05-06 17:40:31 +0200
Add subquery/from test by michaelr (copied from subquery branch r5742)
r6151 at Thesaurus (orig r6150): ribasushi | 2009-05-06 17:56:07 +0200
TODOify sqla-dependent tests
r6152 at Thesaurus (orig r6151): arcanez | 2009-05-06 18:33:58 +0200
fix old test using new bind vars (no more interpolating)
r6154 at Thesaurus (orig r6153): ribasushi | 2009-05-07 00:56:40 +0200
Rename internal function to clarify what it does
r6171 at Thesaurus (orig r6170): ribasushi | 2009-05-07 19:53:30 +0200
Adjust tests for the IN fixes
r6187 at Thesaurus (orig r6186): ribasushi | 2009-05-08 23:11:43 +0200
Final count tests
r6188 at Thesaurus (orig r6187): arcanez | 2009-05-09 03:50:12 +0200
rewrite DISTINCT/COUNT(DISTINCT) Cookbook entries
r6213 at Thesaurus (orig r6212): arcanez | 2009-05-11 22:41:21 +0200
warn/die based on { select => { distinct => { } } }
r6214 at Thesaurus (orig r6213): arcanez | 2009-05-11 23:21:11 +0200
use carp instead of warn
r6216 at Thesaurus (orig r6215): arcanez | 2009-05-11 23:45:05 +0200
make sure we get just a string
r6217 at Thesaurus (orig r6216): arcanez | 2009-05-11 23:52:11 +0200
oops
r6222 at Thesaurus (orig r6221): ribasushi | 2009-05-12 08:11:27 +0200
r6112 at Thesaurus (orig r6111): nniuq | 2009-05-03 02:36:33 +0200
Initially, fixes to enable saving of LOB types in Oracle. Possibly timestamp tweaks.
r6113 at Thesaurus (orig r6112): nniuq | 2009-05-03 03:52:29 +0200
Support for saving CLOB and BLOB types in Oracle.
r6118 at Thesaurus (orig r6117): nniuq | 2009-05-04 03:58:03 +0200
Proper support for timestamp inflation. Added last_updated_at to DBICTest::Schema::Track as a date by default, initialized in sqlite loader, redefined to timestamp for Oracle tests.
r6119 at Thesaurus (orig r6118): nniuq | 2009-05-04 04:03:28 +0200
Re-added last_updated_at to create table statement.
r6134 at Thesaurus (orig r6133): nniuq | 2009-05-05 15:11:49 +0200
Added self to contributors; clarified comment on :ora_types imports.
r6182 at Thesaurus (orig r6181): nniuq | 2009-05-08 17:10:58 +0200
Refactored to call _{inflate_to,deflate_from}_datetime through a _flate_or_fallback wrapper handling a parser's lack of support for the requested type.
r6183 at Thesaurus (orig r6182): ribasushi | 2009-05-08 17:24:54 +0200
Remove redundant var
r6189 at Thesaurus (orig r6188): nniuq | 2009-05-09 03:59:20 +0200
Changed test of lob values from is to ok on an eq expr, to avoid a huge got/expected diagnosis. In doing so, discovered it was testing undef vs undef! Whoops. Fixed.
r6210 at Thesaurus (orig r6209): nniuq | 2009-05-11 16:24:27 +0200
Moved DBIC::SQL::Abstract inner classes to DBIx::Class::SQLAHacks namespace to decouple 41orrible.t tests from use of DBD::Oracle in Oracle Generic driver.
r6224 at Thesaurus (orig r6223): ribasushi | 2009-05-12 08:13:31 +0200
r6223 at Thesaurus (orig r6222): ribasushi | 2009-05-12 08:12:50 +0200
Whops, forgotten post-merge tweaks
r6226 at Thesaurus (orig r6225): ribasushi | 2009-05-12 08:43:58 +0200
Cleanup
r6227 at Thesaurus (orig r6226): ribasushi | 2009-05-12 09:42:45 +0200
Shuffle delete tests, and sanify the delete related ones
r6228 at Thesaurus (orig r6227): ribasushi | 2009-05-12 09:54:37 +0200
Rename m2m warn disable envvar
r6229 at Thesaurus (orig r6228): ribasushi | 2009-05-12 10:20:08 +0200
Switch warn to carp and die to throw_exception where possible
r6230 at Thesaurus (orig r6229): bricas | 2009-05-12 13:31:35 +0200
added info to Changes from my DateTime::InflateColumn modifications
r6231 at Thesaurus (orig r6230): nniuq | 2009-05-12 15:08:14 +0200
Added synopsis of merged oracle-tweaks branch to Changes
r6233 at Thesaurus (orig r6232): debolaz | 2009-05-12 17:17:09 +0200
Test for failing code related to many to many in MySQL
r6234 at Thesaurus (orig r6233): arcanez | 2009-05-12 17:33:56 +0200
Changes for count_distinct branch merge
r6235 at Thesaurus (orig r6234): ribasushi | 2009-05-12 18:09:14 +0200
Some more die/croak conversions
r6236 at Thesaurus (orig r6235): ribasushi | 2009-05-12 18:51:38 +0200
Fix shot test
r6244 at Thesaurus (orig r6243): ribasushi | 2009-05-13 03:02:11 +0200
fix bogus test
r6245 at Thesaurus (orig r6244): ribasushi | 2009-05-13 03:06:42 +0200
Fix _select_for_update/delete - bring back old code, use subqueries only when resultset attributes call for it
r6252 at Thesaurus (orig r6251): ribasushi | 2009-05-14 01:41:31 +0200
Better testing and heuristics for subqueried _cond_for_update_delete
r6253 at Thesaurus (orig r6252): ribasushi | 2009-05-14 01:54:41 +0200
join can be found without seen_join
r6255 at Thesaurus (orig r6254): ribasushi | 2009-05-14 12:12:44 +0200
Sometimes _prepare_for_execute may not return a set of bind vars - guard against that
r6256 at Thesaurus (orig r6255): ribasushi | 2009-05-14 12:14:19 +0200
Clarify test
r6264 at Thesaurus (orig r6263): ribasushi | 2009-05-14 15:40:19 +0200
r6121 at Thesaurus (orig r6120): caelum | 2009-05-04 17:13:22 +0200
Making new branch for storage tweaking
r6122 at Thesaurus (orig r6121): caelum | 2009-05-04 20:07:47 +0200
support hashrefs for connect_replicants
r6123 at Thesaurus (orig r6122): caelum | 2009-05-04 23:07:43 +0200
::Replicated - test hashref for connect_replicants and croak on coderef, switch to MX::Types, make test less noisy
r6143 at Thesaurus (orig r6142): caelum | 2009-05-06 05:13:56 +0200
fix ::DBI::Replicated::all_storages
r6144 at Thesaurus (orig r6143): caelum | 2009-05-06 05:25:04 +0200
Replicated - fixup types and namespace::clean
r6147 at Thesaurus (orig r6146): caelum | 2009-05-06 15:29:39 +0200
::DBI:Replicated - merge connect_info from master to replicants
r6184 at Thesaurus (orig r6183): caelum | 2009-05-08 18:08:29 +0200
support ::DBI::Replicated opts in connect_info
r6190 at Thesaurus (orig r6189): caelum | 2009-05-09 05:31:15 +0200
::DBI::Replicated - add master_read_weight to ::Random balancer_type
r6191 at Thesaurus (orig r6190): caelum | 2009-05-09 12:50:25 +0200
::DBI::Replicated - fix fallback to master, test for the warning, other cleanups
r6193 at Thesaurus (orig r6192): caelum | 2009-05-09 13:52:52 +0200
updated Changes
r6194 at Thesaurus (orig r6193): caelum | 2009-05-09 14:21:44 +0200
::DBI::Replicated - don't build pool/balancer from connect_info unless necessary
r6268 at Thesaurus (orig r6267): caelum | 2009-05-15 04:04:12 +0200
minor replication changes - use a real hash merge, clarify master_read_weight, really done with this now.
r6272 at Thesaurus (orig r6271): abraxxa | 2009-05-15 13:45:54 +0200
added Static sub-classing DBIx::Class result classes section to the cookbook
r6277 at Thesaurus (orig r6276): ribasushi | 2009-05-16 00:46:00 +0200
Optimize some Ordered.pm code
r6278 at Thesaurus (orig r6277): ribasushi | 2009-05-16 08:02:18 +0200
Cleanup tests
r6280 at Thesaurus (orig r6279): ribasushi | 2009-05-16 09:30:05 +0200
Not sure what this part of the test is for, but it breaks custom resultsets, and the test passes without it. Removing as a possible remnant of an ancient civilization
r6281 at Thesaurus (orig r6280): ribasushi | 2009-05-16 09:33:24 +0200
Add default resultclass/resultsetclass to the entire test schema, as I am tired of typing extra shit for debugging purposes
r6282 at Thesaurus (orig r6281): ribasushi | 2009-05-16 09:34:21 +0200
Now we can do diag $rs->hri_dump, ain't that nice
r6290 at Thesaurus (orig r6289): ribasushi | 2009-05-17 00:06:40 +0200
Rewrite SqlMakerTest to fully depend on SQLA::Test
Allow is_same_sql_bind to accept an arrayrefref instead of any pair of $sql, \@bind
r6299 at Thesaurus (orig r6298): frew | 2009-05-18 18:16:44 +0200
Fix order by clauses for MSSQL
r6304 at Thesaurus (orig r6303): frew | 2009-05-18 21:43:48 +0200
Test to show problem
r6305 at Thesaurus (orig r6304): ribasushi | 2009-05-18 22:12:35 +0200
Failing tests go to branches
r6306 at Thesaurus (orig r6305): ribasushi | 2009-05-18 22:14:26 +0200
Require bugfixed sqla
r6312 at Thesaurus (orig r6311): ribasushi | 2009-05-18 23:05:10 +0200
r6157 at Thesaurus (orig r6156): ribasushi | 2009-05-07 10:28:14 +0200
new branch for the diamond join/prefetch bug
r6158 at Thesaurus (orig r6157): ribasushi | 2009-05-07 11:12:41 +0200
Add failing test by gheift
r6294 at Thesaurus (orig r6293): ribasushi | 2009-05-18 01:10:22 +0200
Fixes for the diamond-relationship prefetch/join problem
The core of the issue was that resolve_prefetch calculated duplicate join alias numbers separate from resolve_join
In order to solve this, now the only join alias calculation happens in resolve_join (with prefetch being always merged as extra joins), and each join arrayref in from is labeled with the full relationship chain from me to the particular join. Then resolve_prefetch has to walk this chain and pull the necessary alias in order to generate the correct select
r6296 at Thesaurus (orig r6295): ribasushi | 2009-05-18 14:05:31 +0200
Add a comment about a small resolve_join omission
r6314 at Thesaurus (orig r6313): frew | 2009-05-18 23:56:37 +0200
cleanup for ribasushi
r6316 at Thesaurus (orig r6315): frew | 2009-05-19 01:10:20 +0200
I contributed!
r6317 at Thesaurus (orig r6316): arcanez | 2009-05-19 05:30:18 +0200
doc patch per amiri
r6318 at Thesaurus (orig r6317): arcanez | 2009-05-19 05:33:47 +0200
I think I got it right this time
r6322 at Thesaurus (orig r6321): abraxxa | 2009-05-19 19:07:08 +0200
added test for total_entries on a paged resultset
r6326 at Thesaurus (orig r6325): ribasushi | 2009-05-19 19:34:45 +0200
r6258 at Thesaurus (orig r6257): ribasushi | 2009-05-14 13:18:58 +0200
Refactor count handling - use a different code path depending on the complexity of the resultset query, allows proper collapsing of count results via group_by subqueries
r6327 at Thesaurus (orig r6326): ribasushi | 2009-05-19 19:34:53 +0200
r6259 at Thesaurus (orig r6258): ribasushi | 2009-05-14 13:19:35 +0200
Straightforward test changes
r6328 at Thesaurus (orig r6327): ribasushi | 2009-05-19 19:35:00 +0200
r6260 at Thesaurus (orig r6259): ribasushi | 2009-05-14 13:19:59 +0200
Questionable test changes - need a review
r6329 at Thesaurus (orig r6328): ribasushi | 2009-05-19 19:35:07 +0200
r6269 at Thesaurus (orig r6268): ribasushi | 2009-05-15 10:43:04 +0200
Add failing multikey rs delete (and by implication update) test
r6330 at Thesaurus (orig r6329): ribasushi | 2009-05-19 19:35:14 +0200
r6276 at Thesaurus (orig r6275): ribasushi | 2009-05-15 23:35:06 +0200
A workable fix for the resultset multicol update/delete debacle - by default fallback to per-row deletions, with the ability to overide this behavior for various storage drivers
r6331 at Thesaurus (orig r6330): ribasushi | 2009-05-19 19:35:20 +0200
r6279 at Thesaurus (orig r6278): ribasushi | 2009-05-16 08:36:45 +0200
Rename tests
r6332 at Thesaurus (orig r6331): ribasushi | 2009-05-19 19:36:37 +0200
r6284 at Thesaurus (orig r6283): ribasushi | 2009-05-16 10:40:44 +0200
Test and fixed for paged grouped count
r6333 at Thesaurus (orig r6332): ribasushi | 2009-05-19 19:38:00 +0200
r6301 at Thesaurus (orig r6300): ribasushi | 2009-05-18 19:32:42 +0200
pager optimization
r6334 at Thesaurus (orig r6333): ribasushi | 2009-05-19 19:39:27 +0200
r6321 at Thesaurus (orig r6320): ribasushi | 2009-05-19 18:11:00 +0200
Make select always equal group by on count subqueries
Make sure offset does not increment boundlessly on every _resolved_attrs run
r6335 at Thesaurus (orig r6334): ribasushi | 2009-05-19 19:39:34 +0200
r6323 at Thesaurus (orig r6322): ribasushi | 2009-05-19 19:26:21 +0200
Make sure pg test can restart after half-way failures
r6336 at Thesaurus (orig r6335): ribasushi | 2009-05-19 19:39:42 +0200
r6324 at Thesaurus (orig r6323): ribasushi | 2009-05-19 19:34:19 +0200
Hide resultsource methods that should have never been documented
r6337 at Thesaurus (orig r6336): ribasushi | 2009-05-19 19:42:59 +0200
Add files dropped by the screwed up merge - I suck
r6338 at Thesaurus (orig r6337): ribasushi | 2009-05-19 19:43:56 +0200
Adjust dependencies - most of them pull in bugfixes
r6339 at Thesaurus (orig r6338): ribasushi | 2009-05-19 19:52:39 +0200
Make podcoverage happy (deprecated, undocumented methods)
r6340 at Thesaurus (orig r6339): ribasushi | 2009-05-19 20:46:40 +0200
Simplify __count() - explicitly specify which attributes to copy, instead of deleting a whole bunch of them
r6342 at Thesaurus (orig r6341): dandv | 2009-05-20 02:56:57 +0200
Tiny POD formatting fix
r6343 at Thesaurus (orig r6342): caelum | 2009-05-20 05:11:12 +0200
add mysql lost password faq
r6344 at Thesaurus (orig r6343): caelum | 2009-05-20 05:58:36 +0200
add test for distinct result of sql function
r6345 at Thesaurus (orig r6344): ribasushi | 2009-05-20 09:03:08 +0200
Make joined rs counts backwards compatible - we do not collapse a result exploded by a has_many join unless it is explicitly requested by distinct => 1, OR unless we have collapse set which implies prefetch
r6347 at Thesaurus (orig r6346): ribasushi | 2009-05-20 12:44:54 +0200
detect/purge having bind for compeleteness
r6348 at Thesaurus (orig r6347): ribasushi | 2009-05-20 12:51:05 +0200
Bring back the old code from resolve_prefetch so ash's code can work
Add tests to make sure we throw it away in 09
r6349 at Thesaurus (orig r6348): ribasushi | 2009-05-20 14:30:40 +0200
Add explicit grouping for rs update/delete operations if the parameters warrant it (tests coming tonight)
r6350 at Thesaurus (orig r6349): ribasushi | 2009-05-20 15:32:27 +0200
Make sure we always work with resolved rs attributes while counting (and test)
r6351 at Thesaurus (orig r6350): ribasushi | 2009-05-20 15:42:48 +0200
More explicit attribute deletion/detection - a lof of this is probably redundant, as _resoved_attrs() should flatten them away (i.e. prefetch to collapse and distinct to group_by). Nevertheless keep them there for explcetness ( delete() is cheap )
r6352 at Thesaurus (orig r6351): arcanez | 2009-05-20 17:04:17 +0200
update to Changes
r6353 at Thesaurus (orig r6352): arcanez | 2009-05-20 17:06:50 +0200
fix for sql functions in group_by
r6354 at Thesaurus (orig r6353): frew | 2009-05-20 18:03:55 +0200
fix test for people with spaces in path
r6355 at Thesaurus (orig r6354): ribasushi | 2009-05-20 22:59:10 +0200
POD fixes
r6356 at Thesaurus (orig r6355): ribasushi | 2009-05-20 23:00:13 +0200
Switch as_query testing to direct specification in is_same_sql_bind
r6357 at Thesaurus (orig r6356): ribasushi | 2009-05-20 23:47:05 +0200
on_connect_do now accepts a single string like it does an arrayref (patch by prema)
r6358 at Thesaurus (orig r6357): ribasushi | 2009-05-21 09:45:52 +0200
Clarify usage of _resolved_attrs by adding the explicit _resolved_attrs_copy
Clarify code in ResultSetColumn
r6359 at Thesaurus (orig r6358): ribasushi | 2009-05-21 09:59:50 +0200
Duh, no point of having ordered subqueries while counting, Debolaz++
r6367 at Thesaurus (orig r6366): caelum | 2009-05-22 04:54:12 +0200
add some support for trying to determine storage driver without being connected
r6368 at Thesaurus (orig r6367): caelum | 2009-05-22 06:52:47 +0200
comment addition
r6369 at Thesaurus (orig r6368): caelum | 2009-05-22 08:09:05 +0200
fix limit for DB2
r6370 at Thesaurus (orig r6369): ribasushi | 2009-05-22 10:28:58 +0200
Extend DB2 test
r6371 at Thesaurus (orig r6370): ribasushi | 2009-05-22 10:31:25 +0200
Some attributes require a grouped count subquery, some - just a subquery. Differentiate properly
r6372 at Thesaurus (orig r6371): ribasushi | 2009-05-22 10:35:36 +0200
duh
r6374 at Thesaurus (orig r6373): caelum | 2009-05-22 15:50:45 +0200
::Replicated -- check for master rebless and reapply role if necessary
r6376 at Thesaurus (orig r6375): ash | 2009-05-22 18:54:00 +0200
Make distinct calculate columns *after* prefetch has been resolved. Tests to come
r6380 at Thesaurus (orig r6379): ribasushi | 2009-05-23 10:09:46 +0200
Refactor rs_update_delete (too many methods for no reason)
Make mysql use _per_row_update_delete by default as this is the only thing it understands: http://dev.mysql.com/doc/refman/5.0/en/subquery-errors.html
r6381 at Thesaurus (orig r6380): caelum | 2009-05-23 16:44:59 +0200
Sybase autopk, and a test, no limit support yet
r6382 at Thesaurus (orig r6381): ribasushi | 2009-05-23 21:33:28 +0200
Tests and test schema adjustments for resultset update/delete
r6383 at Thesaurus (orig r6382): ribasushi | 2009-05-23 21:35:59 +0200
Add storage component of multipk resultset update/delete for multicolumn IN capable rdbms
Switch Pg to that (tested via DBICTEST_DSN)
r6384 at Thesaurus (orig r6383): caelum | 2009-05-23 21:46:11 +0200
Sybase bindvar and IC::DT support
r6385 at Thesaurus (orig r6384): caelum | 2009-05-23 21:57:08 +0200
hide internal Sybase classes from PAUSE
r6387 at Thesaurus (orig r6386): caelum | 2009-05-23 22:28:42 +0200
revert last Sybase changes
r6390 at Thesaurus (orig r6389): ribasushi | 2009-05-23 22:59:17 +0200
Extra test and count fixes for prefetch + distinct
r6391 at Thesaurus (orig r6390): caelum | 2009-05-23 23:04:01 +0200
minor clean up
r6392 at Thesaurus (orig r6391): ribasushi | 2009-05-23 23:37:19 +0200
Make sure MultiColumnIn quotes column names while munging literal sql
Tested by running t/resultset/update_delete against pg with quote char " and name sep .
r6393 at Thesaurus (orig r6392): ribasushi | 2009-05-24 00:47:40 +0200
update changes
r6394 at Thesaurus (orig r6393): ribasushi | 2009-05-24 00:50:08 +0200
Extend distinct deprecation tests and clarify warnings
r6396 at Thesaurus (orig r6395): ribasushi | 2009-05-24 10:47:03 +0200
MSSQL through ODBC does not like unfinished statements - make sure we finish the scope identity retrieval
(This worked before because of the automatic retry on exception, essentially running any select after insert twice)
r6397 at Thesaurus (orig r6396): ribasushi | 2009-05-24 11:42:01 +0200
Make sure we do not clobber search attributes when using subqueries
r6398 at Thesaurus (orig r6397): ribasushi | 2009-05-24 11:43:32 +0200
SUPER is so last century
r6399 at Thesaurus (orig r6398): ribasushi | 2009-05-24 14:12:39 +0200
Deprecate ::DBI::Sybase::MSSQL
r6400 at Thesaurus (orig r6399): ribasushi | 2009-05-24 15:00:50 +0200
eol adjustments
r6401 at Thesaurus (orig r6400): ribasushi | 2009-05-24 15:07:45 +0200
Switch trunk to native eol-style
r6402 at Thesaurus (orig r6401): ribasushi | 2009-05-24 15:35:07 +0200
Failing test about warnings triggered in SQLA::Limit when using a subquery
r6406 at Thesaurus (orig r6405): ribasushi | 2009-05-24 22:53:15 +0200
Switch around inheritance of MSSQL drivers, remove some duplicate code
r6407 at Thesaurus (orig r6406): caelum | 2009-05-25 01:49:17 +0200
fix double connect for ODBC/MSSQL
r6408 at Thesaurus (orig r6407): caelum | 2009-05-25 01:53:12 +0200
added test to make sure only one connection to ODBC/MSSQL is made
r6411 at Thesaurus (orig r6410): ribasushi | 2009-05-25 08:48:38 +0200
Factor out the order_by sqlahacks resolver
r6412 at Thesaurus (orig r6411): ribasushi | 2009-05-25 09:42:45 +0200
Move the DB2 Limit syntax setting into the storage class
r6413 at Thesaurus (orig r6412): ribasushi | 2009-05-25 09:47:01 +0200
Forgotten podcoverage override
r6414 at Thesaurus (orig r6413): ribasushi | 2009-05-25 11:11:01 +0200
Define how Top limit emulation should behave
r6419 at Thesaurus (orig r6418): ribasushi | 2009-05-25 16:53:13 +0200
Actually don't need this anymore
r6421 at Thesaurus (orig r6420): tomboh | 2009-05-25 18:33:46 +0200
Small documentation improvement: link to a documented method.
Property changes on: DBIx-Class/0.08/branches/multi_stuff
___________________________________________________________________
Name: svk:merge
- 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5969
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:11142
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
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/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/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/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:6038
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
+ 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5969
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:11142
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
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/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
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/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/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:6420
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/multi_stuff/Changes
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/Changes 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/Changes 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,5 +1,37 @@
Revision history for DBIx::Class
+ - Multiple $resultset -> count/update/delete fixes. Now any
+ of these operations will succeed, regardless of the complexity
+ of $resultset. distinct, group_by, join, prefetch are all
+ supported with expected results
+ - don't pass SQL functions into GROUP BY
+ - Remove MultiDistinctEmulation.pm, effectively deprecating
+ { select => { distinct => [ qw/col1 col2/ ] } }
+ - Change ->count code to work correctly with DISTINCT (distinct => 1)
+ via GROUP BY
+ - Removed interpolation of bind vars for as_query - placeholders
+ are preserved and nested query bind variables are properly
+ merged in the correct order
+ - Refactor DBIx::Class::Storage::DBI::Sybase to automatically
+ load a subclass, namely Microsoft_SQL_Server.pm
+ (similar to DBIx::Class::Storage::DBI::ODBC)
+ - Refactor InflateColumn::DateTime to allow components to
+ circumvent DateTime parsing
+ - Support inflation of timestamp datatype
+ - Support BLOB and CLOB datatypes on Oracle
+ - Storage::DBI::Replicated::Balancer::Random:
+ added master_read_weight
+ - Storage::DBI::Replicated: storage opts from connect_info,
+ connect_info merging to replicants, hashref connect_info support,
+ improved trace output, other bug fixes/cleanups
+ - distinct => 1 with prefetch now groups by all columns
+ - on_connect_do accepts a single string equivalent to a one
+ element arrayref (RT#45159)
+ - DB2 limit + offset now works correctly
+ - Sybase now supports autoinc PKs (RT#40265)
+ - Prefetch on joins over duplicate relations now works
+ correctly (RT#28451)
+
0.08102 2009-04-30 08:29:00 (UTC)
- Fixed two subtle bugs when using columns or select/as
paired with a join (limited prefetch)
Property changes on: DBIx-Class/0.08/branches/multi_stuff/Changes
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/Features_09
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/MANIFEST.SKIP
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/Makefile.PL 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/Makefile.PL 2009-05-25 16:46:59 UTC (rev 6421)
@@ -13,28 +13,31 @@
# remove once test deprecated
configure_requires 'DBD::SQLite';
-requires 'DBD::SQLite' => 1.23;
+requires 'DBD::SQLite' => 1.25;
requires 'Data::Page' => 2.00;
-requires 'Scalar::Util' => 0;
-requires 'SQL::Abstract' => 1.51;
+requires 'SQL::Abstract' => 1.55;
requires 'SQL::Abstract::Limit' => 0.13;
requires 'Class::C3::Componentised' => 1.0005;
-requires 'Storable' => 0;
-requires 'Carp::Clan' => 0;
-requires 'DBI' => 1.40;
-requires 'Module::Find' => 0;
-requires 'Class::Inspector' => 0;
+requires 'Carp::Clan' => 6.0;
+requires 'DBI' => 1.605;
+requires 'Module::Find' => 0.06;
+requires 'Class::Inspector' => 1.24;
requires 'Class::Accessor::Grouped' => 0.08003;
-requires 'JSON::Any' => 1.17;
+requires 'JSON::Any' => 1.18;
requires 'Scope::Guard' => 0.03;
-requires 'Path::Class' => 0;
-requires 'List::Util' => 1.19;
+requires 'Path::Class' => 0.16;
requires 'Sub::Name' => 0.04;
requires 'MRO::Compat' => 0.09;
+# Core
+requires 'List::Util' => 0;
+requires 'Scalar::Util' => 0;
+requires 'Storable' => 0;
+
# Perl 5.8.0 doesn't have utf8::is_utf8()
-requires 'Encode' => 0 if ($] <= 5.008000);
+requires 'Encode' => 0 if ($] <= 5.008000);
+test_requires 'Test::More' => 0.82;
test_requires 'Test::Builder' => 0.33;
test_requires 'Test::Warn' => 0.11;
test_requires 'Test::Exception' => 0;
@@ -77,10 +80,11 @@
,
# t/93storage_replication.t
- 'Moose', => 0.54,
- 'Moose::Util::TypeConstraints' => 0.54,
+ 'Moose', => 0.77,
'MooseX::AttributeHelpers' => 0.12,
- 'Class::MOP' => 0.63,
+ 'MooseX::Types', => 0.10,
+ 'namespace::clean' => 0.11,
+ 'Hash::Merge', => 0.11,
# t/96_is_deteministic_value.t
'DateTime::Format::Strptime' => 0,
@@ -190,6 +194,7 @@
. 'Do you really want to continue?',
'no',
);
+
exit 0 unless ($ans =~ /^y(es)?$/i);
}
}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/Makefile.PL
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/TODO
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main/Result/Artist.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main/Result/Cd.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main/Result/Track.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/MyDatabase/Main.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/db/example.sql
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/insertdb.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/examples/Schema/testdb.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/AccessorGroup.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AbstractSearch.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AccessorMapping.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AttributeAPI.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/AutoUpdate.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ColumnCase.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ColumnGroups.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ColumnsAsHash.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Constraints.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Constructor.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Copy.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/DestroyWarning.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/GetSet.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ImaDBI.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ImaDBI.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ImaDBI.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -55,7 +55,7 @@
$self->throw_exception( "No relationship to JOIN from ${from_class} to ${to_class}" )
unless $rel_obj;
my $join = $from_class->storage->sql_maker->_join_condition(
- $from_class->result_source_instance->resolve_condition(
+ $from_class->result_source_instance->_resolve_condition(
$rel_obj->{cond}, $to, $from) );
return $join;
}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ImaDBI.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Iterator.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LazyLoading.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -51,15 +51,15 @@
sub insert {
my ($self, @rest) = @_;
$self->next::method(@rest);
-
+
return $self if $self->nocache;
- # Because the insert will die() if it can't insert into the db (or should)
- # we can be sure the object *was* inserted if we got this far. In which
- # case, given primary keys are unique and ID only returns a
- # value if the object has all its primary keys, we can be sure there
- # isn't a real one in the object index already because such a record
- # cannot have existed without the insert failing.
+ # Because the insert will die() if it can't insert into the db (or should)
+ # we can be sure the object *was* inserted if we got this far. In which
+ # case, given primary keys are unique and ID only returns a
+ # value if the object has all its primary keys, we can be sure there
+ # isn't a real one in the object index already because such a record
+ # cannot have existed without the insert failing.
if (my $key = $self->ID) {
my $live = $self->live_object_index;
weaken($live->{$key} = $self);
@@ -67,7 +67,7 @@
if ++$self->live_object_init_count->{count}
% $self->purge_object_index_every == 0;
}
- #use Data::Dumper; warn Dumper($self);
+
return $self;
}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/NoObjectIndex.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Pager.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Pager.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Pager.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,19 +1,19 @@
package # hide from PAUSE
DBIx::Class::CDBICompat::Pager;
-
+
use strict;
use warnings FATAL => 'all';
-
+
*pager = \&page;
-
+
sub page {
my $class = shift;
-
+
my $rs = $class->search(@_);
unless ($rs->{attrs}{page}) {
$rs = $rs->page(1);
}
return ( $rs->pager, $rs );
}
-
+
1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Pager.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/ReadOnly.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Relationship.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Relationships.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Retrieve.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/SQLTransformer.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Stringify.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/TempColumns.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat/Triggers.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/CDBICompat.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ClassResolver/PassThrough.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Componentised.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Componentised.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Componentised.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -17,7 +17,7 @@
foreach my $first_comp (@comps) {
if ($to eq 'DBIx::Class::Core' &&
$target->isa("DBIx::Class::${first_comp}")) {
- warn "Possible incorrect order of components in ".
+ carp "Possible incorrect order of components in ".
"${target}::load_components($first_comp) call: Core loaded ".
"before $first_comp. See the documentation for ".
"DBIx::Class::$first_comp for more information";
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Componentised.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Core.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Cursor.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/DB.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Exception.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/DateTime.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/DateTime.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,6 +3,7 @@
use strict;
use warnings;
use base qw/DBIx::Class/;
+use Carp::Clan qw/^DBIx::Class/;
=head1 NAME
@@ -94,7 +95,7 @@
my $type;
- for (qw/date datetime/) {
+ for (qw/date datetime timestamp/) {
my $key = "inflate_${_}";
next unless exists $info->{$key};
@@ -106,19 +107,18 @@
unless ($type) {
$type = lc($info->{data_type});
- $type = 'datetime' if ($type =~ /^timestamp/);
}
my $timezone;
if ( defined $info->{extra}{timezone} ) {
- warn "Putting timezone into extra => { timezone => '...' } has been deprecated, ".
+ carp "Putting timezone into extra => { timezone => '...' } has been deprecated, ".
"please put it directly into the columns definition.";
$timezone = $info->{extra}{timezone};
}
my $locale;
if ( defined $info->{extra}{locale} ) {
- warn "Putting locale into extra => { locale => '...' } has been deprecated, ".
+ carp "Putting locale into extra => { locale => '...' } has been deprecated, ".
"please put it directly into the columns definition.";
$locale = $info->{extra}{locale};
}
@@ -128,37 +128,24 @@
my $undef_if_invalid = $info->{datetime_undef_if_invalid};
- if ($type eq 'datetime' || $type eq 'date') {
- my ($parse, $format) = ("parse_${type}", "format_${type}");
+ if ($type eq 'datetime' || $type eq 'date' || $type eq 'timestamp') {
+ # This shallow copy of %info avoids t/52_cycle.t treating
+ # the resulting deflator as a circular reference.
+ my %info = ( '_ic_dt_method' => $type , %{ $info } );
- # This assignment must happen here, otherwise Devel::Cycle treats
- # the resulting deflator as a circular reference (go figure):
- #
- # Cycle #1
- # DBICTest::Schema A->{source_registrations} => %B
- # %B->{Event} => DBIx::Class::ResultSource::Table C
- # DBIx::Class::ResultSource::Table C->{_columns} => %D
- # %D->{created_on} => %E
- # %E->{_inflate_info} => %F
- # %F->{deflate} => &G
- # closure &G, $info => $H
- # $H => %E
- #
- my $floating_tz_ok;
if (defined $info->{extra}{floating_tz_ok}) {
- warn "Putting floating_tz_ok into extra => { floating_tz_ok => 1 } has been deprecated, ".
+ carp "Putting floating_tz_ok into extra => { floating_tz_ok => 1 } has been deprecated, ".
"please put it directly into the columns definition.";
- $floating_tz_ok = $info->{extra}{floating_tz_ok};
+ $info{floating_tz_ok} = $info->{extra}{floating_tz_ok};
}
- $floating_tz_ok = $info->{floating_tz_ok} if defined $info->{floating_tz_ok};
$self->inflate_column(
$column =>
{
inflate => sub {
my ($value, $obj) = @_;
- my $dt = eval { $obj->_datetime_parser->$parse($value); };
- die "Error while inflating ${value} for ${column} on ${self}: $@"
+ my $dt = eval { $obj->_inflate_to_datetime( $value, \%info ) };
+ $self->throw_exception ("Error while inflating ${value} for ${column} on ${self}: $@")
if $@ and not $undef_if_invalid;
$dt->set_time_zone($timezone) if $timezone;
$dt->set_locale($locale) if $locale;
@@ -167,21 +154,41 @@
deflate => sub {
my ($value, $obj) = @_;
if ($timezone) {
- warn "You're using a floating timezone, please see the documentation of"
+ carp "You're using a floating timezone, please see the documentation of"
. " DBIx::Class::InflateColumn::DateTime for an explanation"
if ref( $value->time_zone ) eq 'DateTime::TimeZone::Floating'
- and not $floating_tz_ok
+ and not $info{floating_tz_ok}
and not $ENV{DBIC_FLOATING_TZ_OK};
$value->set_time_zone($timezone);
$value->set_locale($locale) if $locale;
}
- $obj->_datetime_parser->$format($value);
+ $obj->_deflate_from_datetime( $value, \%info );
},
}
);
}
}
+sub _flate_or_fallback
+{
+ my( $self, $value, $info, $method_fmt ) = @_;
+
+ my $parser = $self->_datetime_parser;
+ my $preferred_method = sprintf($method_fmt, $info->{ _ic_dt_method });
+ my $method = $parser->can($preferred_method) ? $preferred_method : sprintf($method_fmt, 'datetime');
+ return $parser->$method($value);
+}
+
+sub _inflate_to_datetime {
+ my( $self, $value, $info ) = @_;
+ return $self->_flate_or_fallback( $value, $info, 'parse_%s' );
+}
+
+sub _deflate_from_datetime {
+ my( $self, $value, $info ) = @_;
+ return $self->_flate_or_fallback( $value, $info, 'format_%s' );
+}
+
sub _datetime_parser {
my $self = shift;
if (my $parser = $self->__datetime_parser) {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/DateTime.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn/File.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/InflateColumn.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Component.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Cookbook.pod 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Cookbook.pod 2009-05-25 16:46:59 UTC (rev 6421)
@@ -237,30 +237,50 @@
=head2 SELECT DISTINCT with multiple columns
- my $rs = $schema->resultset('Foo')->search(
+ my $rs = $schema->resultset('Artist')->search(
{},
{
- select => [
- { distinct => [ $source->columns ] }
- ],
- as => [ $source->columns ] # remember 'as' is not the same as SQL AS :-)
+ columns => [ qw/artistid name rank/ ],
+ distinct => 1
+ }
+ );
+
+ my $rs = $schema->resultset('Artist')->search(
+ {},
+ {
+ columns => [ qw/artistid name rank/ ],
+ group_by => [ qw/artistid name rank/ ],
}
);
+ # Equivalent SQL:
+ # SELECT me.artistid, me.name, me.rank
+ # FROM artist me
+ # GROUP BY artistid, name, rank
+
=head2 SELECT COUNT(DISTINCT colname)
- my $rs = $schema->resultset('Foo')->search(
+ my $rs = $schema->resultset('Artist')->search(
{},
{
- select => [
- { count => { distinct => 'colname' } }
- ],
- as => [ 'count' ]
+ columns => [ qw/name/ ],
+ distinct => 1
}
);
- my $count = $rs->next->get_column('count');
+ my $rs = $schema->resultset('Artist')->search(
+ {},
+ {
+ columns => [ qw/name/ ],
+ group_by => [ qw/name/ ],
+ }
+ );
+ my $count = $rs->count;
+
+ # Equivalent SQL:
+ # SELECT COUNT( DISTINCT( me.name ) ) FROM artist me
+
=head2 Grouping results
L<DBIx::Class> supports C<GROUP BY> as follows:
@@ -497,9 +517,6 @@
so no additional SQL statements are executed. You now have a much more
efficient query.
-Note that as of L<DBIx::Class> 0.05999_01, C<prefetch> I<can> be used with
-C<has_many> relationships.
-
Also note that C<prefetch> should only be used when you know you will
definitely use data from a related table. Pre-fetching related tables when you
only need columns from the main table will make performance worse!
@@ -617,7 +634,7 @@
=head2 Multi-step prefetch
-From 0.04999_05 onwards, C<prefetch> can be nested more than one relationship
+C<prefetch> can be nested more than one relationship
deep using the same syntax as a multi-step join:
my $rs = $schema->resultset('Tag')->search(
@@ -657,8 +674,7 @@
AKA getting last_insert_id
-If you are using PK::Auto (which is a core component as of 0.07), this is
-straightforward:
+Thanks to the core component PK::Auto, this is straightforward:
my $foo = $rs->create(\%blah);
# do more stuff
@@ -717,6 +733,48 @@
# do whatever else you wanted if it was a new row
}
+=head2 Static sub-classing DBIx::Class result classes
+
+AKA adding additional relationships/methods/etc. to a model for a
+specific usage of the (shared) model.
+
+B<Schema definition>
+
+ package My::App::Schema;
+
+ use base DBIx::Class::Schema;
+
+ # load subclassed classes from My::App::Schema::Result/ResultSet
+ __PACKAGE__->load_namespaces;
+
+ # load classes from shared model
+ load_classes({
+ 'My::Shared::Model::Result' => [qw/
+ Foo
+ Bar
+ /]});
+
+ 1;
+
+B<Result-Subclass definition>
+
+ package My::App::Schema::Result::Baz;
+
+ use strict;
+ use warnings;
+ use base My::Shared::Model::Result::Baz;
+
+ # WARNING: Make sure you call table() again in your subclass,
+ # otherwise DBIx::Class::ResultSourceProxy::Table will not be called
+ # and the class name is not correctly registered as a source
+ __PACKAGE__->table('baz');
+
+ sub additional_method {
+ return "I'm an additional method only needed by this app";
+ }
+
+ 1;
+
=head2 Dynamic Sub-classing DBIx::Class proxy classes
AKA multi-class object inflation from one table
@@ -744,7 +802,9 @@
use base qw/DBIx::Class::Schema/;
- __PACKAGE__->load_namespaces;
+ __PACKAGE__->load_namespaces;
+
+ 1;
B<Proxy-Class definitions>
@@ -782,8 +842,10 @@
print "I am a regular user.\n";
return ;
}
+
+ 1;
+
-
package My::Schema::Result::User::Admin;
use strict;
@@ -800,7 +862,9 @@
{
print "I am doing admin stuff\n";
return ;
- }
+ }
+
+ 1;
B<Test File> test.pl
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Cookbook.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/DocMap.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Example.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/FAQ.pod
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/FAQ.pod 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/FAQ.pod 2009-05-25 16:46:59 UTC (rev 6421)
@@ -552,3 +552,38 @@
See L<DBIx::Class::Manual::Cookbook/Stringification>
=back
+
+=head2 Troubleshooting
+
+=over 4
+
+=item Help, I can't connect to postgresql!
+
+If you get an error such as:
+
+ DBI connect('dbname=dbic','user',...) failed: could not connect to server:
+ No such file or directory Is the server running locally and accepting
+ connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
+
+Likely you have/had two copies of postgresql installed simultaneously, the
+second one will use a default port of 5433, while L<DBD::Pg> is compiled with a
+default port of 5432.
+
+You can chance the port setting in C<postgresql.conf>.
+
+=item I've lost or forgotten my mysql password
+
+Stop mysqld and restart it with the --skip-grant-tables option.
+
+Issue the following statements in the mysql client.
+
+ UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
+ FLUSH PRIVILEGES;
+
+Restart mysql.
+
+Taken from:
+
+L<http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html>.
+
+=back
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/FAQ.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Glossary.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Intro.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Joining.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Reading.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual/Troubleshooting.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Manual.pod
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Ordered.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Ordered.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Ordered.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -272,6 +272,20 @@
return defined $lsib ? $lsib : 0;
}
+# an optimised method to get the last sibling position without inflating a row object
+sub _last_sibling_pos {
+ my $self = shift;
+ my $position_column = $self->position_column;
+
+ my $cursor = $self->next_siblings->search(
+ {},
+ { rows => 1, order_by => { '-desc' => $position_column }, columns => $position_column },
+ )->cursor;
+
+ my ($pos) = $cursor->next;
+ return $pos;
+}
+
=head2 move_previous
$item->move_previous();
@@ -427,7 +441,7 @@
if ( not defined($to_position) or $to_position > $new_group_count) {
$self->set_column(
$position_column => $new_group_count
- ? $self->_next_position_value ( $self->last_sibling->get_column ($position_column) ) # FIXME - no need to inflate last_sibling
+ ? $self->_next_position_value ( $self->_last_sibling_pos )
: $self->_initial_position_value
);
}
@@ -459,10 +473,10 @@
my $position_column = $self->position_column;
unless ($self->get_column($position_column)) {
- my $lsib = $self->last_sibling; # FIXME - no need to inflate last_sibling
+ my $lsib_pos = $self->_last_sibling_pos;
$self->set_column(
- $position_column => ($lsib
- ? $self->_next_position_value ( $lsib->get_column ($position_column) )
+ $position_column => (defined $lsib_pos
+ ? $self->_next_position_value ( $lsib_pos )
: $self->_initial_position_value
)
);
@@ -692,12 +706,22 @@
# position column is part of a unique constraint, and do a
# one-by-one update if this is the case
- if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $self->result_source->unique_constraints }} ) ) ) {
+ my $rsrc = $self->result_source;
- my $rs = $shift_rs->search ({}, { order_by => { "-$ord", $position_column } } );
- # FIXME - no need to inflate each row
- while (my $r = $rs->next) {
- $r->_ordered_internal_update ({ $position_column => \ "$position_column $op 1" } );
+ if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $rsrc->unique_constraints }} ) ) ) {
+
+ my @pcols = $rsrc->primary_columns;
+ my $cursor = $shift_rs->search ({}, { order_by => { "-$ord", $position_column }, columns => \@pcols } )->cursor;
+ my $rs = $self->result_source->resultset;
+
+ while (my @pks = $cursor->next ) {
+
+ my $cond;
+ for my $i (0.. $#pcols) {
+ $cond->{$pcols[$i]} = $pks[$i];
+ }
+
+ $rs->search($cond)->update ({ $position_column => \ "$position_column $op 1" } );
}
}
else {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Ordered.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/DB2.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/MSSQL.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/MySQL.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/Pg.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto/SQLite.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK/Auto.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/PK.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Accessor.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Accessor.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Accessor.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -27,7 +27,7 @@
} elsif (exists $self->{_relationship_data}{$rel}) {
return $self->{_relationship_data}{$rel};
} else {
- my $cond = $self->result_source->resolve_condition(
+ my $cond = $self->result_source->_resolve_condition(
$rel_info->{cond}, $rel, $self
);
if ($rel_info->{attrs}->{undef_on_null_fk}){
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Accessor.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Base.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Base.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Base.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -189,7 +189,7 @@
my $query = ((@_ > 1) ? {@_} : shift);
my $source = $self->result_source;
- my $cond = $source->resolve_condition(
+ my $cond = $source->_resolve_condition(
$rel_obj->{cond}, $rel, $self
);
if ($cond eq $DBIx::Class::ResultSource::UNRESOLVABLE_CONDITION) {
@@ -404,7 +404,7 @@
unless Scalar::Util::blessed($f_obj) and $f_obj->isa($f_class);
}
$self->set_columns(
- $self->result_source->resolve_condition(
+ $self->result_source->_resolve_condition(
$rel_obj->{cond}, $f_obj, $rel));
return 1;
}
@@ -470,7 +470,7 @@
=over 4
-=item Arguments: (\@hashrefs | \@objs)
+=item Arguments: (\@hashrefs | \@objs), $link_vals?
=back
@@ -481,6 +481,10 @@
$actor->set_roles(\@roles);
# Replaces all of $actor's previous roles with the two named
+ $actor->set_roles(\@roles, { salary => 15_000_000 });
+ # Sets a column in the link table for all roles
+
+
Replace all the related objects with the given reference to a list of
objects. This does a C<delete> B<on the link table resultset> to remove the
association between the current object and all related objects, then calls
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Base.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/BelongsTo.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/CascadeActions.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/HasMany.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/HasOne.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/Helpers.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ManyToMany.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ManyToMany.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ManyToMany.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,7 +3,8 @@
use strict;
use warnings;
-use warnings::register;
+
+use Carp::Clan qw/^DBIx::Class/;
use Sub::Name ();
sub many_to_many {
@@ -28,16 +29,20 @@
for ($add_meth, $remove_meth, $set_meth, $rs_meth) {
if ( $class->can ($_) ) {
- warnings::warnif(<<"EOW")
+ carp (<<"EOW") unless $ENV{DBIC_OVERWRITE_HELPER_METHODS_OK};
+
***************************************************************************
-The many-to-many relationship $meth is trying to create a utility method called
-$_. This will overwrite the existing method on $class. You almost certainly
-want to rename your method or the many-to-many relationship, as your method
-will not be callable (it will use the one from the relationship instead.)
+The many-to-many relationship '$meth' is trying to create a utility method
+called $_.
+This will completely overwrite one such already existing method on class
+$class.
-To disable this warning add the following to $class
+You almost certainly want to rename your method or the many-to-many
+relationship, as the functionality of the original method will not be
+accessible anymore.
- no warnings 'DBIx::Class::Relationship::ManyToMany';
+To disable this warning set to a true value the environment variable
+DBIC_OVERWRITE_HELPER_METHODS_OK
***************************************************************************
EOW
@@ -103,7 +108,7 @@
);
my @to_set = (ref($_[0]) eq 'ARRAY' ? @{ $_[0] } : @_);
$self->search_related($rel, {})->delete;
- $self->$add_meth($_) for (@to_set);
+ $self->$add_meth($_, ref($_[1]) ? $_[1] : {}) for (@to_set);
};
my $remove_meth_name = join '::', $class, $remove_meth;
@@ -114,7 +119,7 @@
my $obj = shift;
my $rel_source = $self->search_related($rel)->result_source;
my $cond = $rel_source->relationship_info($f_rel)->{cond};
- my $link_cond = $rel_source->resolve_condition(
+ my $link_cond = $rel_source->_resolve_condition(
$cond, $obj, $f_rel
);
$self->search_related($rel, $link_cond)->delete;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ManyToMany.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship/ProxyMethods.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Relationship.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultClass/HashRefInflator.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSet.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSet.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -46,30 +46,16 @@
ResultSet. The new one will contain all the conditions of the
original, plus any new conditions added in the C<search> call.
-A ResultSet is also an iterator. L</next> is used to return all the
-L<DBIx::Class::Row>s the ResultSet represents.
+A ResultSet also incorporates an implicit iterator. L</next> and L</reset>
+can be used to walk through all the L<DBIx::Class::Row>s the ResultSet
+represents.
The query that the ResultSet represents is B<only> executed against
the database when these methods are called:
+L</find> L</next> L</all> L</first> L</single> L</count>
-=over
+=head1 EXAMPLES
-=item L</find>
-
-=item L</next>
-
-=item L</all>
-
-=item L</count>
-
-=item L</single>
-
-=item L</first>
-
-=back
-
-=head1 EXAMPLES
-
=head2 Chaining resultsets
Let's say you've got a query that needs to be run to return some data
@@ -193,7 +179,7 @@
return $class->new_result(@_) if ref $class;
my ($source, $attrs) = @_;
- $source = $source->handle
+ $source = $source->handle
unless $source->isa('DBIx::Class::ResultSourceHandle');
$attrs = { %{$attrs||{}} };
@@ -296,7 +282,7 @@
unless (
(@_ && defined($_[0])) # @_ == () or (undef)
- ||
+ ||
(keys %$attrs # empty attrs or only 'safe' attrs
&& List::Util::first { !$safe{$_} } keys %$attrs)
) {
@@ -307,7 +293,7 @@
my $new_attrs = { %{$our_attrs}, %{$attrs} };
# merge new attrs into inherited
- foreach my $key (qw/join prefetch +select +as/) {
+ foreach my $key (qw/join prefetch +select +as bind/) {
next unless exists $attrs->{$key};
$new_attrs->{$key} = $self->_merge_attr($our_attrs->{$key}, $attrs->{$key});
}
@@ -393,7 +379,7 @@
resultset query.
CAVEAT: C<search_literal> is provided for Class::DBI compatibility and should
-only be used in that context. C<search_literal> is a convenience method.
+only be used in that context. C<search_literal> is a convenience method.
It is equivalent to calling $schema->search(\[]), but if you want to ensure
columns are bound correctly, use C<search>.
@@ -403,14 +389,14 @@
my @cds = $cd_rs->search(\[ 'cdid = ? AND (artist = ? OR artist = ?)', [ 'cdid', 2 ], [ 'artist', 1 ], [ 'artist', 2 ] ]);
-See L<DBIx::Class::Manual::Cookbook/Searching> and
+See L<DBIx::Class::Manual::Cookbook/Searching> and
L<DBIx::Class::Manual::FAQ/Searching> for searching techniques that do not
require C<search_literal>.
=cut
sub search_literal {
- my ($self, $sql, @bind) = @_;
+ my ($self, $sql, @bind) = @_;
my $attr;
if ( @bind && ref($bind[-1]) eq 'HASH' ) {
$attr = pop @bind;
@@ -505,7 +491,7 @@
&& ($info = $self->result_source->relationship_info($key))) {
my $val = delete $input_query->{$key};
next KEY if (ref($val) eq 'ARRAY'); # has_many for multi_create
- my $rel_q = $self->result_source->resolve_condition(
+ my $rel_q = $self->result_source->_resolve_condition(
$info->{cond}, $val, $key
);
die "Can't handle OR join condition in find" if ref($rel_q) eq 'ARRAY';
@@ -674,7 +660,7 @@
sub cursor {
my ($self) = @_;
- my $attrs = { %{$self->_resolved_attrs} };
+ my $attrs = $self->_resolved_attrs_copy;
return $self->{cursor}
||= $self->result_source->storage->select($attrs->{from}, $attrs->{select},
$attrs->{where},$attrs);
@@ -712,7 +698,7 @@
Query returned more than one row
In this case, you should be using L</first> or L</find> instead, or if you really
-know what you are doing, use the L</rows> attribute to explicitly limit the size
+know what you are doing, use the L</rows> attribute to explicitly limit the size
of the resultset.
=back
@@ -725,7 +711,7 @@
$self->throw_exception('single() only takes search conditions, no attributes. You want ->search( $cond, $attrs )->single()');
}
- my $attrs = { %{$self->_resolved_attrs} };
+ my $attrs = $self->_resolved_attrs_copy;
if ($where) {
if (defined $attrs->{where}) {
$attrs->{where} = {
@@ -796,19 +782,16 @@
if (ref $query eq 'ARRAY') {
foreach my $subquery (@$query) {
next unless ref $subquery; # -or
-# warn "ARRAY: " . Dumper $subquery;
$collapsed = $self->_collapse_query($subquery, $collapsed);
}
}
elsif (ref $query eq 'HASH') {
if (keys %$query and (keys %$query)[0] eq '-and') {
foreach my $subquery (@{$query->{-and}}) {
-# warn "HASH: " . Dumper $subquery;
$collapsed = $self->_collapse_query($subquery, $collapsed);
}
}
else {
-# warn "LEAF: " . Dumper $query;
foreach my $col (keys %$query) {
my $value = $query->{$col};
$collapsed->{$col}{$value}++;
@@ -873,10 +856,10 @@
sub search_like {
my $class = shift;
- carp join ("\n",
- 'search_like() is deprecated and will be removed in 0.09.',
- 'Instead use ->search({ x => { -like => "y%" } })',
- '(note the outer pair of {}s - they are important!)'
+ carp (
+ 'search_like() is deprecated and will be removed in DBIC version 0.09.'
+ .' Instead use ->search({ x => { -like => "y%" } })'
+ .' (note the outer pair of {}s - they are important!)'
);
my $attrs = (@_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {});
my $query = ref $_[0] eq 'HASH' ? { %{shift()} }: {@_};
@@ -1019,7 +1002,7 @@
do { # no need to check anything at the front, we always want the first row
my %const;
-
+
foreach my $this_as (@construct_as) {
$const{$this_as->[0]||''}{$this_as->[1]} = shift(@copy);
}
@@ -1066,7 +1049,7 @@
foreach my $p (@parts) {
$target = $target->[1]->{$p} ||= [];
$cur .= ".${p}";
- if ($cur eq ".${key}" && (my @ckey = @{$collapse{$cur}||[]})) {
+ if ($cur eq ".${key}" && (my @ckey = @{$collapse{$cur}||[]})) {
# collapsing at this point and on final part
my $pos = $collapse_pos{$cur};
CK: foreach my $ck (@ckey) {
@@ -1117,8 +1100,8 @@
=back
-An accessor for the class to use when creating row objects. Defaults to
-C<< result_source->result_class >> - which in most cases is the name of the
+An accessor for the class to use when creating row objects. Defaults to
+C<< result_source->result_class >> - which in most cases is the name of the
L<"table"|DBIx::Class::Manual::Glossary/"ResultSource"> class.
Note that changing the result_class will also remove any components
@@ -1148,64 +1131,97 @@
=back
Performs an SQL C<COUNT> with the same query as the resultset was built
-with to find the number of elements. If passed arguments, does a search
-on the resultset and counts the results of that.
+with to find the number of elements. Passing arguments is equivalent to
+C<< $rs->search ($cond, \%attrs)->count >>
-Note: When using C<count> with C<group_by>, L<DBIx::Class> emulates C<GROUP BY>
-using C<COUNT( DISTINCT( columns ) )>. Some databases (notably SQLite) do
-not support C<DISTINCT> with multiple columns. If you are using such a
-database, you should only use columns from the main table in your C<group_by>
-clause.
-
=cut
sub count {
my $self = shift;
return $self->search(@_)->count if @_ and defined $_[0];
return scalar @{ $self->get_cache } if $self->get_cache;
- my $count = $self->_count;
+
+ my @grouped_subq_attrs = qw/prefetch collapse distinct group_by having/;
+ my @subq_attrs = ();
+
+ my $attrs = $self->_resolved_attrs;
+ # if we are not paged - we are simply asking for a limit
+ if (not $attrs->{page} and not $attrs->{software_limit}) {
+ push @subq_attrs, qw/rows offset/;
+ }
+
+ my $need_subq = $self->_has_attr (@subq_attrs);
+ my $need_group_subq = $self->_has_attr (@grouped_subq_attrs);
+
+ return ($need_subq || $need_group_subq)
+ ? $self->_count_subq ($need_group_subq)
+ : $self->_count_simple
+}
+
+sub _count_subq {
+ my ($self, $add_group_by) = @_;
+
+ my $attrs = $self->_resolved_attrs_copy;
+
+ # copy for the subquery, we need to do some adjustments to it too
+ my $sub_attrs = { %$attrs };
+
+ # these can not go in the subquery, and there is no point of ordering it
+ delete $sub_attrs->{$_} for qw/prefetch collapse select +select as +as columns +columns order_by/;
+
+ # if needed force a group_by and the same set of columns (most databases require this)
+ if ($add_group_by) {
+
+ # if we prefetch, we group_by primary keys only as this is what we would get out of the rs via ->next/->all
+ # simply deleting group_by suffices, as the code below will re-fill it
+ # Note: we check $attrs, as $sub_attrs has collapse deleted
+ if (ref $attrs->{collapse} and keys %{$attrs->{collapse}} ) {
+ delete $sub_attrs->{group_by};
+ }
+
+ $sub_attrs->{columns} = $sub_attrs->{group_by} ||= [ map { "$attrs->{alias}.$_" } ($self->result_source->primary_columns) ];
+ }
+
+ $attrs->{from} = [{
+ count_subq => (ref $self)->new ($self->result_source, $sub_attrs )->as_query
+ }];
+
+ # the subquery replaces this
+ delete $attrs->{$_} for qw/where bind prefetch collapse distinct group_by having having_bind/;
+
+ return $self->__count ($attrs);
+}
+
+sub _count_simple {
+ my $self = shift;
+
+ my $count = $self->__count;
return 0 unless $count;
# need to take offset from resolved attrs
- $count -= $self->{_attrs}{offset} if $self->{_attrs}{offset};
- $count = $self->{attrs}{rows} if
- $self->{attrs}{rows} and $self->{attrs}{rows} < $count;
+ my $attrs = $self->_resolved_attrs;
+
+ $count -= $attrs->{offset} if $attrs->{offset};
+ $count = $attrs->{rows} if $attrs->{rows} and $attrs->{rows} < $count;
$count = 0 if ($count < 0);
return $count;
}
-sub _count { # Separated out so pager can get the full count
- my $self = shift;
- my $select = { count => '*' };
+sub __count {
+ my ($self, $attrs) = @_;
- my $attrs = { %{$self->_resolved_attrs} };
- if (my $group_by = delete $attrs->{group_by}) {
- delete $attrs->{having};
- my @distinct = (ref $group_by ? @$group_by : ($group_by));
- # todo: try CONCAT for multi-column pk
- my @pk = $self->result_source->primary_columns;
- if (@pk == 1) {
- my $alias = $attrs->{alias};
- foreach my $column (@distinct) {
- if ($column =~ qr/^(?:\Q${alias}.\E)?$pk[0]$/) {
- @distinct = ($column);
- last;
- }
- }
- }
+ $attrs ||= $self->_resolved_attrs_copy;
- $select = { count => { distinct => \@distinct } };
- }
+ # take off any column specs, any pagers, record_filter is cdbi, and no point of ordering a count
+ delete $attrs->{$_} for (qw/columns +columns select +select as +as rows offset page pager order_by record_filter/);
- $attrs->{select} = $select;
+ $attrs->{select} = { count => '*' };
$attrs->{as} = [qw/count/];
- # offset, order by and page are not needed to count. record_filter is cdbi
- delete $attrs->{$_} for qw/rows offset order_by page pager record_filter/;
-
my $tmp_rs = (ref $self)->new($self->result_source, $attrs);
my ($count) = $tmp_rs->cursor->next;
+
return $count;
}
@@ -1318,6 +1334,72 @@
return $_[0]->reset->next;
}
+
+# _rs_update_delete
+#
+# Determines whether and what type of subquery is required for the $rs operation.
+# If grouping is necessary either supplies its own, or verifies the current one
+# After all is done delegates to the proper storage method.
+
+sub _rs_update_delete {
+ my ($self, $op, $values) = @_;
+
+ my $rsrc = $self->result_source;
+
+ my $needs_group_by_subq = $self->_has_attr (qw/prefetch distinct join seen_join group_by/);
+ my $needs_subq = $self->_has_attr (qw/row offset page/);
+
+ if ($needs_group_by_subq or $needs_subq) {
+
+ # make a new $rs selecting only the PKs (that's all we really need)
+ my $attrs = $self->_resolved_attrs_copy;
+
+ delete $attrs->{$_} for qw/prefetch collapse select +select as +as columns +columns/;
+ $attrs->{columns} = [ map { "$attrs->{alias}.$_" } ($self->result_source->primary_columns) ];
+
+ if ($needs_group_by_subq) {
+ # make sure no group_by was supplied, or if there is one - make sure it matches
+ # the columns compiled above perfectly. Anything else can not be sanely executed
+ # on most databases so croak right then and there
+
+ if (my $g = $attrs->{group_by}) {
+ my @current_group_by = map
+ { $_ =~ /\./ ? $_ : "$attrs->{alias}.$_" }
+ (ref $g eq 'ARRAY' ? @$g : $g );
+
+ if (
+ join ("\x00", sort @current_group_by)
+ ne
+ join ("\x00", sort @{$attrs->{columns}} )
+ ) {
+ $self->throw_exception (
+ "You have just attempted a $op operation on a resultset which does group_by"
+ . ' on columns other than the primary keys, while DBIC internally needs to retrieve'
+ . ' the primary keys in a subselect. All sane RDBMS engines do not support this'
+ . ' kind of queries. Please retry the operation with a modified group_by or'
+ . ' without using one at all.'
+ );
+ }
+ }
+ else {
+ $attrs->{group_by} = $attrs->{columns};
+ }
+ }
+
+ my $subrs = (ref $self)->new($rsrc, $attrs);
+
+ return $self->result_source->storage->subq_update_delete($subrs, $op, $values);
+ }
+ else {
+ return $rsrc->storage->$op(
+ $rsrc,
+ $op eq 'update' ? $values : (),
+ $self->_cond_for_update_delete,
+ );
+ }
+}
+
+
# _cond_for_update_delete
#
# update/delete require the condition to be modified to handle
@@ -1347,11 +1429,9 @@
elsif (ref $full_cond eq 'HASH') {
if ((keys %{$full_cond})[0] eq '-and') {
$cond->{-and} = [];
-
my @cond = @{$full_cond->{-and}};
- for (my $i = 0; $i < @cond; $i++) {
+ for (my $i = 0; $i < @cond; $i++) {
my $entry = $cond[$i];
-
my $hash;
if (ref $entry eq 'HASH') {
$hash = $self->_cond_for_update_delete($entry);
@@ -1360,7 +1440,6 @@
$entry =~ /([^.]+)$/;
$hash->{$1} = $cond[++$i];
}
-
push @{$cond->{-and}}, $hash;
}
}
@@ -1372,9 +1451,7 @@
}
}
else {
- $self->throw_exception(
- "Can't update/delete on resultset with condition unless hash or array"
- );
+ $self->throw_exception("Can't update/delete on resultset with condition unless hash or array");
}
return $cond;
@@ -1399,19 +1476,10 @@
sub update {
my ($self, $values) = @_;
- $self->throw_exception("Values for update must be a hash")
+ $self->throw_exception('Values for update must be a hash')
unless ref $values eq 'HASH';
- carp( 'WARNING! Currently $rs->update() does not generate proper SQL'
- . ' on joined resultsets, and may affect rows well outside of the'
- . ' contents of $rs. Use at your own risk' )
- if ( $self->{attrs}{seen_join} );
-
- my $cond = $self->_cond_for_update_delete;
-
- return $self->result_source->storage->update(
- $self->result_source, $values, $cond
- );
+ return $self->_rs_update_delete ('update', $values);
}
=head2 update_all
@@ -1431,7 +1499,7 @@
sub update_all {
my ($self, $values) = @_;
- $self->throw_exception("Values for update must be a hash")
+ $self->throw_exception('Values for update_all must be a hash')
unless ref $values eq 'HASH';
foreach my $obj ($self->all) {
$obj->set_columns($values)->update;
@@ -1456,27 +1524,17 @@
delete may not generate correct SQL for a query with joins or a resultset
chained from a related resultset. In this case it will generate a warning:-
- WARNING! Currently $rs->delete() does not generate proper SQL on
- joined resultsets, and may delete rows well outside of the contents
- of $rs. Use at your own risk
-
In these cases you may find that delete_all is more appropriate, or you
need to respecify your query in a way that can be expressed without a join.
=cut
sub delete {
- my ($self) = @_;
- $self->throw_exception("Delete should not be passed any arguments")
- if $_[1];
- carp( 'WARNING! Currently $rs->delete() does not generate proper SQL'
- . ' on joined resultsets, and may delete rows well outside of the'
- . ' contents of $rs. Use at your own risk' )
- if ( $self->{attrs}{seen_join} );
- my $cond = $self->_cond_for_update_delete;
+ my $self = shift;
+ $self->throw_exception('delete does not accept any arguments')
+ if @_;
- $self->result_source->storage->delete($self->result_source, $cond);
- return 1;
+ return $self->_rs_update_delete ('delete');
}
=head2 delete_all
@@ -1495,7 +1553,10 @@
=cut
sub delete_all {
- my ($self) = @_;
+ my $self = shift;
+ $self->throw_exception('delete_all does not accept any arguments')
+ if @_;
+
$_->delete for $self->all;
return 1;
}
@@ -1513,7 +1574,7 @@
forsubmitting to a $resultset->create(...) method.
In void context, C<insert_bulk> in L<DBIx::Class::Storage::DBI> is used
-to insert the data, as this is a faster method.
+to insert the data, as this is a faster method.
Otherwise, each set of data is inserted into the database using
L<DBIx::Class::ResultSet/create>, and a arrayref of the resulting row
@@ -1522,10 +1583,10 @@
Example: Assuming an Artist Class that has many CDs Classes relating:
my $Artist_rs = $schema->resultset("Artist");
-
- ## Void Context Example
+
+ ## Void Context Example
$Artist_rs->populate([
- { artistid => 4, name => 'Manufactured Crap', cds => [
+ { artistid => 4, name => 'Manufactured Crap', cds => [
{ title => 'My First CD', year => 2006 },
{ title => 'Yet More Tweeny-Pop crap', year => 2007 },
],
@@ -1537,7 +1598,7 @@
],
},
]);
-
+
## Array Context Example
my ($ArtistOne, $ArtistTwo, $ArtistThree) = $Artist_rs->populate([
{ name => "Artist One"},
@@ -1547,7 +1608,7 @@
{ title => "Second CD", year => 2008},
]}
]);
-
+
print $ArtistOne->name; ## response is 'Artist One'
print $ArtistThree->cds->count ## reponse is '2'
@@ -1563,11 +1624,11 @@
]);
Please note an important effect on your data when choosing between void and
-wantarray context. Since void context goes straight to C<insert_bulk> in
+wantarray context. Since void context goes straight to C<insert_bulk> in
L<DBIx::Class::Storage::DBI> this will skip any component that is overriding
-c<insert>. So if you are using something like L<DBIx-Class-UUIDColumns> to
-create primary keys for you, you will find that your PKs are empty. In this
-case you will have to use the wantarray context in order to create those
+C<insert>. So if you are using something like L<DBIx-Class-UUIDColumns> to
+create primary keys for you, you will find that your PKs are empty. In this
+case you will have to use the wantarray context in order to create those
values.
=cut
@@ -1577,7 +1638,7 @@
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');
-
+
if(defined wantarray) {
my @created;
foreach my $item (@$data) {
@@ -1589,28 +1650,28 @@
my @names = grep {!ref $first->{$_}} keys %$first;
my @rels = grep { $self->result_source->has_relationship($_) } keys %$first;
- my @pks = $self->result_source->primary_columns;
+ my @pks = $self->result_source->primary_columns;
- ## do the belongs_to relationships
+ ## do the belongs_to relationships
foreach my $index (0..$#$data) {
if( grep { !defined $data->[$index]->{$_} } @pks ) {
my @ret = $self->populate($data);
return;
}
-
+
foreach my $rel (@rels) {
next unless $data->[$index]->{$rel} && ref $data->[$index]->{$rel} eq "HASH";
my $result = $self->related_resultset($rel)->create($data->[$index]->{$rel});
my ($reverse) = keys %{$self->result_source->reverse_relationship_info($rel)};
- my $related = $result->result_source->resolve_condition(
+ my $related = $result->result_source->_resolve_condition(
$result->result_source->relationship_info($reverse)->{cond},
- $self,
- $result,
+ $self,
+ $result,
);
delete $data->[$index]->{$rel};
$data->[$index] = {%{$data->[$index]}, %$related};
-
+
push @names, keys %$related if $index == 0;
}
}
@@ -1619,8 +1680,8 @@
my @values = map { [ @$_{@names} ] } @$data;
$self->result_source->storage->insert_bulk(
- $self->result_source,
- \@names,
+ $self->result_source,
+ \@names,
\@values,
);
@@ -1630,12 +1691,12 @@
foreach my $rel (@rels) {
next unless $item->{$rel} && ref $item->{$rel} eq "ARRAY";
- my $parent = $self->find(map {{$_=>$item->{$_}} } @pks)
+ my $parent = $self->find(map {{$_=>$item->{$_}} } @pks)
|| $self->throw_exception('Cannot find the relating object.');
-
+
my $child = $parent->$rel;
-
- my $related = $child->result_source->resolve_condition(
+
+ my $related = $child->result_source->_resolve_condition(
$parent->result_source->relationship_info($rel)->{cond},
$child,
$parent,
@@ -1667,7 +1728,7 @@
foreach my $index (0..$#names) {
$result_to_create{$names[$index]} = $$datum[$index];
}
- push @results_to_create, \%result_to_create;
+ push @results_to_create, \%result_to_create;
}
return \@results_to_create;
}
@@ -1692,12 +1753,25 @@
sub pager {
my ($self) = @_;
+
+ return $self->{pager} if $self->{pager};
+
my $attrs = $self->{attrs};
$self->throw_exception("Can't create pager for non-paged rs")
unless $self->{attrs}{page};
$attrs->{rows} ||= 10;
- return $self->{pager} ||= Data::Page->new(
- $self->_count, $attrs->{rows}, $self->{attrs}{page});
+
+ # throw away the paging flags and re-run the count (possibly
+ # with a subselect) to get the real total count
+ my $count_attrs = { %$attrs };
+ delete $count_attrs->{$_} for qw/rows offset page pager/;
+ my $total_count = (ref $self)->new($self->result_source, $count_attrs)->count;
+
+ return $self->{pager} = Data::Page->new(
+ $total_count,
+ $attrs->{rows},
+ $self->{attrs}{page}
+ );
}
=head2 page
@@ -1758,13 +1832,13 @@
$self->throw_exception(
"Can't abstract implicit construct, condition not a hash"
) if ($self->{cond} && !(ref $self->{cond} eq 'HASH'));
-
+
my $collapsed_cond = (
$self->{cond}
? $self->_collapse_cond($self->{cond})
: {}
);
-
+
# precendence must be given to passed values over values inherited from
# the cond, so the order here is important.
my %implied = %{$self->_remove_alias($collapsed_cond, $alias)};
@@ -1789,7 +1863,7 @@
# _is_deterministic_value
#
-# Make an effor to strip non-deterministic values from the condition,
+# Make an effor to strip non-deterministic values from the condition,
# to make sure new_result chokes less
sub _is_deterministic_value {
@@ -1801,6 +1875,50 @@
return 0;
}
+# _has_attr
+#
+# determines if the resultset defines at least one
+# of the attributes supplied
+#
+# used to determine if a subquery is neccessary
+
+sub _has_attr {
+ my ($self, @attr_names) = @_;
+
+ my $attrs = $self->_resolved_attrs;
+
+ my $join_check_req;
+
+ for my $n (@attr_names) {
+ ++$join_check_req if $n =~ /join/;
+
+ my $attr = $attrs->{$n};
+
+ next if not defined $attr;
+
+ if (ref $attr eq 'HASH') {
+ return 1 if keys %$attr;
+ }
+ elsif (ref $attr eq 'ARRAY') {
+ return 1 if @$attr;
+ }
+ else {
+ return 1 if $attr;
+ }
+ }
+
+ # a join can be expressed as a multi-level from
+ return 1 if (
+ $join_check_req
+ and
+ ref $attrs->{from} eq 'ARRAY'
+ and
+ @{$attrs->{from}} > 1
+ );
+
+ return 0;
+}
+
# _collapse_cond
#
# Recursively collapse the condition.
@@ -1813,19 +1931,16 @@
if (ref $cond eq 'ARRAY') {
foreach my $subcond (@$cond) {
next unless ref $subcond; # -or
-# warn "ARRAY: " . Dumper $subcond;
$collapsed = $self->_collapse_cond($subcond, $collapsed);
}
}
elsif (ref $cond eq 'HASH') {
if (keys %$cond and (keys %$cond)[0] eq '-and') {
foreach my $subcond (@{$cond->{-and}}) {
-# warn "HASH: " . Dumper $subcond;
$collapsed = $self->_collapse_cond($subcond, $collapsed);
}
}
else {
-# warn "LEAF: " . Dumper $cond;
foreach my $col (keys %$cond) {
my $value = $cond->{$col};
$collapsed->{$col} = $value;
@@ -1962,12 +2077,12 @@
name=>"Some Person",
email=>"somebody at someplace.com"
});
-
+
Example of creating a new row and also creating rows in a related C<has_many>
or C<has_one> resultset. Note Arrayref.
$artist_rs->create(
- { artistid => 4, name => 'Manufactured Crap', cds => [
+ { artistid => 4, name => 'Manufactured Crap', cds => [
{ title => 'My First CD', year => 2006 },
{ title => 'Yet More Tweeny-Pop crap', year => 2007 },
],
@@ -2083,10 +2198,10 @@
{ key => 'cd_artist_title' }
);
- $cd->cd_to_producer->update_or_create({
- producer => $producer,
+ $cd->cd_to_producer->update_or_create({
+ producer => $producer,
name => 'harry',
- }, {
+ }, {
key => 'primary,
});
@@ -2271,7 +2386,7 @@
"search_related: result source '" . $self->result_source->source_name .
"' has no such relationship $rel")
unless $rel_obj;
-
+
my ($from,$seen) = $self->_resolve_from($rel);
my $join_count = $seen->{$rel};
@@ -2364,32 +2479,43 @@
return ($self->{attrs} || {})->{alias} || 'me';
}
+# This code is called by search_related, and makes sure there
+# is clear separation between the joins before, during, and
+# after the relationship. This information is needed later
+# in order to properly resolve prefetch aliases (any alias
+# with a relation_chain_depth less than the depth of the
+# current prefetch is not considered)
sub _resolve_from {
my ($self, $extra_join) = @_;
my $source = $self->result_source;
my $attrs = $self->{attrs};
-
+
my $from = $attrs->{from}
|| [ { $attrs->{alias} => $source->from } ];
-
+
my $seen = { %{$attrs->{seen_join}||{}} };
- my $join = ($attrs->{join}
- ? [ $attrs->{join}, $extra_join ]
- : $extra_join);
+ # we need to take the prefetch the attrs into account before we
+ # ->_resolve_join as otherwise they get lost - captainL
+ my $merged = $self->_merge_attr( $attrs->{join}, $attrs->{prefetch} );
- # we need to take the prefetch the attrs into account before we
- # ->resolve_join as otherwise they get lost - captainL
- my $merged = $self->_merge_attr( $join, $attrs->{prefetch} );
+ push @$from, $source->_resolve_join($merged, $attrs->{alias}, $seen) if ($merged);
- $from = [
- @$from,
- ($join ? $source->resolve_join($merged, $attrs->{alias}, $seen) : ()),
- ];
+ ++$seen->{-relation_chain_depth};
+ push @$from, $source->_resolve_join($extra_join, $attrs->{alias}, $seen);
+
+ ++$seen->{-relation_chain_depth};
+
return ($from,$seen);
}
+# too many times we have to do $attrs = { %{$self->_resolved_attrs} }
+sub _resolved_attrs_copy {
+ my $self = shift;
+ return { %{$self->_resolved_attrs (@_)} };
+}
+
sub _resolved_attrs {
my $self = shift;
return $self->{_attrs} if $self->{_attrs};
@@ -2408,14 +2534,14 @@
? $_
: {
(
- /^\Q${alias}.\E(.+)$/
+ /^\Q${alias}.\E(.+)$/
? "$1"
: "$_"
)
- =>
+ =>
(
- /\./
- ? "$_"
+ /\./
+ ? "$_"
: "${alias}.$_"
)
}
@@ -2483,15 +2609,13 @@
$attrs->{from} = # have to copy here to avoid corrupting the original
[
@{ $attrs->{from} },
- $source->resolve_join(
+ $source->_resolve_join(
$join, $alias, { %{ $attrs->{seen_join} || {} } }
)
];
}
- $attrs->{group_by} ||= $attrs->{select}
- if delete $attrs->{distinct};
if ( $attrs->{order_by} ) {
$attrs->{order_by} = (
ref( $attrs->{order_by} ) eq 'ARRAY'
@@ -2507,30 +2631,53 @@
if ( my $prefetch = delete $attrs->{prefetch} ) {
$prefetch = $self->_merge_attr( {}, $prefetch );
my @pre_order;
- my $seen = { %{ $attrs->{seen_join} || {} } };
foreach my $p ( ref $prefetch eq 'ARRAY' ? @$prefetch : ($prefetch) ) {
# bring joins back to level of current class
+ my $join_map = $self->_joinpath_aliases ($attrs->{from}, $attrs->{seen_join});
my @prefetch =
- $source->resolve_prefetch( $p, $alias, $seen, \@pre_order, $collapse );
+ $source->_resolve_prefetch( $p, $alias, $join_map, \@pre_order, $collapse );
push( @{ $attrs->{select} }, map { $_->[0] } @prefetch );
push( @{ $attrs->{as} }, map { $_->[1] } @prefetch );
}
push( @{ $attrs->{order_by} }, @pre_order );
}
+
+ if (delete $attrs->{distinct}) {
+ $attrs->{group_by} ||= [ grep { !ref($_) || (ref($_) ne 'HASH') } @{$attrs->{select}} ];
+ }
+
$attrs->{collapse} = $collapse;
- if ( $attrs->{page} ) {
- $attrs->{offset} ||= 0;
- $attrs->{offset} += ( $attrs->{rows} * ( $attrs->{page} - 1 ) );
+ if ( $attrs->{page} and not defined $attrs->{offset} ) {
+ $attrs->{offset} = ( $attrs->{rows} * ( $attrs->{page} - 1 ) );
}
return $self->{_attrs} = $attrs;
}
+sub _joinpath_aliases {
+ my ($self, $fromspec, $seen) = @_;
+
+ my $paths = {};
+ return $paths unless ref $fromspec eq 'ARRAY';
+
+ for my $j (@$fromspec) {
+
+ next if ref $j ne 'ARRAY';
+ next if $j->[0]{-relation_chain_depth} < ( $seen->{-relation_chain_depth} || 0);
+
+ my $p = $paths;
+ $p = $p->{$_} ||= {} for @{$j->[0]{-join_path}};
+ push @{$p->{-join_aliases} }, $j->[0]{-join_alias};
+ }
+
+ return $paths;
+}
+
sub _rollout_attr {
my ($self, $attr) = @_;
-
+
if (ref $attr eq 'HASH') {
return $self->_rollout_hash($attr);
} elsif (ref $attr eq 'ARRAY') {
@@ -2581,7 +2728,7 @@
}
} else {
return ($a eq $b_key) ? 1 : 0;
- }
+ }
} else {
if (ref $a eq 'HASH') {
my ($a_key) = keys %{$a};
@@ -2597,7 +2744,7 @@
return $import unless defined($orig);
return $orig unless defined($import);
-
+
$orig = $self->_rollout_attr($orig);
$import = $self->_rollout_attr($import);
@@ -2873,19 +3020,19 @@
}
);
-You need to use the relationship (not the table) name in conditions,
-because they are aliased as such. The current table is aliased as "me", so
+You need to use the relationship (not the table) name in conditions,
+because they are aliased as such. The current table is aliased as "me", so
you need to use me.column_name in order to avoid ambiguity. For example:
- # Get CDs from 1984 with a 'Foo' track
+ # Get CDs from 1984 with a 'Foo' track
my $rs = $schema->resultset('CD')->search(
- {
+ {
'me.year' => 1984,
'tracks.name' => 'Foo'
},
{ join => 'tracks' }
);
-
+
If the same join is supplied twice, it will be aliased to <rel>_2 (and
similarly for a third time). For e.g.
@@ -2938,12 +3085,12 @@
case.
Simple prefetches will be joined automatically, so there is no need
-for a C<join> attribute in the above search.
+for a C<join> attribute in the above search.
C<prefetch> can be used with the following relationship types: C<belongs_to>,
C<has_one> (or if you're using C<add_relationship>, any relationship declared
with an accessor type of 'single' or 'filter'). A more complex example that
-prefetches an artists cds, the tracks on those cds, and the tags associted
+prefetches an artists cds, the tracks on those cds, and the tags associted
with that artist is given below (assuming many-to-many from artists to tags):
my $rs = $schema->resultset('Artist')->search(
@@ -2955,8 +3102,8 @@
]
}
);
-
+
B<NOTE:> If you specify a C<prefetch> attribute, the C<join> and C<select>
attributes will be ignored.
@@ -3207,12 +3354,12 @@
$table = $rs->result_source->name;
$latest = $rs->search (
undef,
- { from => \ "
- (SELECT e1.* FROM $table e1
- JOIN $table e2
- ON e1.location = e2.location
- AND e1.sequence < e2.sequence
- WHERE e2.sequence is NULL
+ { from => \ "
+ (SELECT e1.* FROM $table e1
+ JOIN $table e2
+ ON e1.location = e2.location
+ AND e1.sequence < e2.sequence
+ WHERE e2.sequence is NULL
) me",
},
);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSet.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetColumn.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetColumn.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetColumn.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -36,21 +36,32 @@
sub new {
my ($class, $rs, $column) = @_;
$class = ref $class if ref $class;
+
+ $rs->throw_exception("column must be supplied") unless $column;
+
my $new_parent_rs = $rs->search_rs; # we don't want to mess up the original, so clone it
- my $attrs = $new_parent_rs->_resolved_attrs;
- $new_parent_rs->{attrs}->{prefetch} = undef; # prefetch cause additional columns to be fetched
+ # prefetch causes additional columns to be fetched, but we can not just make a new
+ # rs via the _resolved_attrs trick - we need to retain the separation between
+ # +select/+as and select/as
+ for my $attr (qw/prefetch collapse/) {
+ for (qw/attrs _attrs/) {
+ delete $new_parent_rs->{$_}{$attr} if ref $new_parent_rs->{$_};
+ }
+ }
+
# If $column can be found in the 'as' list of the parent resultset, use the
# corresponding element of its 'select' list (to keep any custom column
# definition set up with 'select' or '+select' attrs), otherwise use $column
# (to create a new column definition on-the-fly).
+ my $attrs = $new_parent_rs->_resolved_attrs;
+
my $as_list = $attrs->{as} || [];
my $select_list = $attrs->{select} || [];
my $as_index = List::Util::first { ($as_list->[$_] || "") eq $column } 0..$#$as_list;
my $select = defined $as_index ? $select_list->[$as_index] : $column;
my $new = bless { _select => $select, _as => $column, _parent_resultset => $new_parent_rs }, $class;
- $new->throw_exception("column must be supplied") unless $column;
return $new;
}
@@ -72,7 +83,7 @@
=cut
-sub as_query { return shift->_resultset->as_query }
+sub as_query { return shift->_resultset->as_query(@_) }
=head2 next
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetColumn.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetManager.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSetProxy.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource/Table.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource/View.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -113,7 +113,7 @@
Set this to a true value for a column whose value is somehow
automatically set. This is used to determine which columns to empty
-when cloning objects using C<copy>. It is also used by
+when cloning objects using L<DBIx::Class::Row/copy>. It is also used by
L<DBIx::Class::Schema/deploy>.
=item is_foreign_key
@@ -841,7 +841,7 @@
=back
Throws an exception if the condition is improperly supplied, or cannot
-be resolved using L</resolve_join>.
+be resolved.
=cut
@@ -881,7 +881,7 @@
}
return unless $f_source; # Can't test rel without f_source
- eval { $self->resolve_join($rel, 'me') };
+ eval { $self->_resolve_join($rel, 'me') };
if ($@) { # If the resolve failed, back out and re-throw the error
delete $rels{$rel}; #
@@ -1015,29 +1015,22 @@
my @other_cond = keys(%$othercond);
my @other_refkeys = map {/^\w+\.(\w+)$/} @other_cond;
my @other_keys = map {$othercond->{$_} =~ /^\w+\.(\w+)$/} @other_cond;
- next if (!$self->compare_relationship_keys(\@refkeys, \@other_keys) ||
- !$self->compare_relationship_keys(\@other_refkeys, \@keys));
+ next if (!$self->_compare_relationship_keys(\@refkeys, \@other_keys) ||
+ !$self->_compare_relationship_keys(\@other_refkeys, \@keys));
$ret->{$otherrel} = $otherrel_info;
}
}
return $ret;
}
-=head2 compare_relationship_keys
+sub compare_relationship_keys {
+ carp 'compare_relationship_keys is a private method, stop calling it';
+ my $self = shift;
+ $self->_compare_relationship_keys (@_);
+}
-=over 4
-
-=item Arguments: \@keys1, \@keys2
-
-=item Return value: 1/0 (true/false)
-
-=back
-
-Returns true if both sets of keynames are the same, false otherwise.
-
-=cut
-
-sub compare_relationship_keys {
+# Returns true if both sets of keynames are the same, false otherwise.
+sub _compare_relationship_keys {
my ($self, $keys1, $keys2) = @_;
# Make sure every keys1 is in keys2
@@ -1070,48 +1063,54 @@
return $found;
}
-=head2 resolve_join
+sub resolve_join {
+ carp 'resolve_join is a private method, stop calling it';
+ my $self = shift;
+ $self->_resolve_join (@_);
+}
-=over 4
+# Returns the {from} structure used to express JOIN conditions
+sub _resolve_join {
+ my ($self, $join, $alias, $seen, $force_left, $jpath) = @_;
-=item Arguments: $relation
+ # we need a supplied one, because we do in-place modifications, no returns
+ $self->throw_exception ('You must supply a seen hashref as the 3rd argument to _resolve_join')
+ unless $seen;
-=item Return value: Join condition arrayref
+ $force_left ||= { force => 0 };
-=back
+ # This isn't quite right, we should actually dive into $seen and reconstruct
+ # the entire path (the reference entry point would be the join conditional
+ # with depth == current_depth - 1. At this point however nothing depends on
+ # having the entire path, transcending related_resultset, so just leave it
+ # as is, hairy enough already.
+ $jpath ||= [];
-Returns the join structure required for the related result source.
-
-=cut
-
-sub resolve_join {
- my ($self, $join, $alias, $seen, $force_left) = @_;
- $seen ||= {};
- $force_left ||= { force => 0 };
if (ref $join eq 'ARRAY') {
return
map {
local $force_left->{force} = $force_left->{force};
- $self->resolve_join($_, $alias, $seen, $force_left);
+ $self->_resolve_join($_, $alias, $seen, $force_left, [@$jpath]);
} @$join;
} elsif (ref $join eq 'HASH') {
return
map {
- my $as = ($seen->{$_} ? $_.'_'.($seen->{$_}+1) : $_);
+ my $as = ($seen->{$_} ? join ('_', $_, $seen->{$_} + 1) : $_); # the actual seen value will be incremented below
local $force_left->{force} = $force_left->{force};
(
- $self->resolve_join($_, $alias, $seen, $force_left),
- $self->related_source($_)->resolve_join(
- $join->{$_}, $as, $seen, $force_left
+ $self->_resolve_join($_, $alias, $seen, $force_left, [@$jpath]),
+ $self->related_source($_)->_resolve_join(
+ $join->{$_}, $as, $seen, $force_left, [@$jpath, $_]
)
);
} keys %$join;
} elsif (ref $join) {
$self->throw_exception("No idea how to resolve join reftype ".ref $join);
} else {
+
my $count = ++$seen->{$join};
- #use Data::Dumper; warn Dumper($seen);
my $as = ($count > 1 ? "${join}_${count}" : $join);
+
my $rel_info = $self->relationship_info($join);
$self->throw_exception("No such relationship ${join}") unless $rel_info;
my $type;
@@ -1122,28 +1121,25 @@
$force_left->{force} = 1 if lc($type) eq 'left';
}
return [ { $as => $self->related_source($join)->from,
- -join_type => $type },
- $self->resolve_condition($rel_info->{cond}, $as, $alias) ];
+ -join_type => $type,
+ -join_path => [@$jpath, $join],
+ -join_alias => $as,
+ -relation_chain_depth => $seen->{-relation_chain_depth} || 0,
+ },
+ $self->_resolve_condition($rel_info->{cond}, $as, $alias) ];
}
}
-=head2 pk_depends_on
+sub pk_depends_on {
+ carp 'pk_depends_on is a private method, stop calling it';
+ my $self = shift;
+ $self->_pk_depends_on (@_);
+}
-=over 4
-
-=item Arguments: $relname, $rel_data
-
-=item Return value: 1/0 (true/false)
-
-=back
-
-Determines whether a relation is dependent on an object from this source
-having already been inserted. Takes the name of the relationship and a
-hashref of columns of the related object.
-
-=cut
-
-sub pk_depends_on {
+# Determines whether a relation is dependent on an object from this source
+# having already been inserted. Takes the name of the relationship and a
+# hashref of columns of the related object.
+sub _pk_depends_on {
my ($self, $relname, $rel_data) = @_;
my $cond = $self->relationship_info($relname)->{cond};
@@ -1172,23 +1168,18 @@
return 1;
}
-=head2 resolve_condition
+sub resolve_condition {
+ carp 'resolve_condition is a private method, stop calling it';
+ my $self = shift;
+ $self->_resolve_condition (@_);
+}
-=over 4
-
-=item Arguments: $cond, $as, $alias|$object
-
-=back
-
-Resolves the passed condition to a concrete query fragment. If given an alias,
-returns a join condition; if given an object, inverts that object to produce
-a related conditional from that object.
-
-=cut
-
+# Resolves the passed condition to a concrete query fragment. If given an alias,
+# returns a join condition; if given an object, inverts that object to produce
+# a related conditional from that object.
our $UNRESOLVABLE_CONDITION = \'1 = 0';
-sub resolve_condition {
+sub _resolve_condition {
my ($self, $cond, $as, $for) = @_;
#warn %$cond;
if (ref $cond eq 'HASH') {
@@ -1229,66 +1220,18 @@
}
return \%ret;
} elsif (ref $cond eq 'ARRAY') {
- return [ map { $self->resolve_condition($_, $as, $for) } @$cond ];
+ return [ map { $self->_resolve_condition($_, $as, $for) } @$cond ];
} else {
die("Can't handle this yet :(");
}
}
-=head2 resolve_prefetch
+# Legacy code, needs to go entirely away (fully replaced by _resolve_prefetch)
+sub resolve_prefetch {
+ carp 'resolve_prefetch is a private method, stop calling it';
-=over 4
-
-=item Arguments: hashref/arrayref/scalar
-
-=back
-
-Accepts one or more relationships for the current source and returns an
-array of column names for each of those relationships. Column names are
-prefixed relative to the current source, in accordance with where they appear
-in the supplied relationships. Examples:
-
- my $source = $schema->resultset('Tag')->source;
- @columns = $source->resolve_prefetch( { cd => 'artist' } );
-
- # @columns =
- #(
- # 'cd.cdid',
- # 'cd.artist',
- # 'cd.title',
- # 'cd.year',
- # 'cd.artist.artistid',
- # 'cd.artist.name'
- #)
-
- @columns = $source->resolve_prefetch( qw[/ cd /] );
-
- # @columns =
- #(
- # 'cd.cdid',
- # 'cd.artist',
- # 'cd.title',
- # 'cd.year'
- #)
-
- $source = $schema->resultset('CD')->source;
- @columns = $source->resolve_prefetch( qw[/ artist producer /] );
-
- # @columns =
- #(
- # 'artist.artistid',
- # 'artist.name',
- # 'producer.producerid',
- # 'producer.name'
- #)
-
-=cut
-
-sub resolve_prefetch {
my ($self, $pre, $alias, $seen, $order, $collapse) = @_;
$seen ||= {};
- #$alias ||= $self->name;
- #warn $alias, Dumper $pre;
if( ref $pre eq 'ARRAY' ) {
return
map { $self->resolve_prefetch( $_, $alias, $seen, $order, $collapse ) }
@@ -1301,7 +1244,6 @@
$self->related_source($_)->resolve_prefetch(
$pre->{$_}, "${alias}.$_", $seen, $order, $collapse)
} keys %$pre;
- #die Dumper \@ret;
return @ret;
}
elsif( ref $pre ) {
@@ -1354,11 +1296,95 @@
return map { [ "${as}.$_", "${as_prefix}${pre}.$_", ] }
$rel_source->columns;
- #warn $alias, Dumper (\@ret);
- #return @ret;
}
}
+# Accepts one or more relationships for the current source and returns an
+# array of column names for each of those relationships. Column names are
+# prefixed relative to the current source, in accordance with where they appear
+# in the supplied relationships. Needs an alias_map generated by
+# $rs->_joinpath_aliases
+
+sub _resolve_prefetch {
+ my ($self, $pre, $alias, $alias_map, $order, $collapse, $pref_path) = @_;
+ $pref_path ||= [];
+
+ if( ref $pre eq 'ARRAY' ) {
+ return
+ map { $self->_resolve_prefetch( $_, $alias, $alias_map, $order, $collapse, [ @$pref_path ] ) }
+ @$pre;
+ }
+ elsif( ref $pre eq 'HASH' ) {
+ my @ret =
+ map {
+ $self->_resolve_prefetch($_, $alias, $alias_map, $order, $collapse, [ @$pref_path ] ),
+ $self->related_source($_)->_resolve_prefetch(
+ $pre->{$_}, "${alias}.$_", $alias_map, $order, $collapse, [ @$pref_path, $_] )
+ } keys %$pre;
+ return @ret;
+ }
+ elsif( ref $pre ) {
+ $self->throw_exception(
+ "don't know how to resolve prefetch reftype ".ref($pre));
+ }
+ else {
+
+ my $p = $alias_map;
+ $p = $p->{$_} for (@$pref_path, $pre);
+
+ $self->throw_exception (
+ "Unable to resolve prefetch $pre - join alias map does not contain an entry for path "
+ . join (' -> ', @$pref_path, $pre)
+ ) if (ref $p->{-join_aliases} ne 'ARRAY' or not @{$p->{-join_aliases}} );
+
+ my $as = shift @{$p->{-join_aliases}};
+
+ my $rel_info = $self->relationship_info( $pre );
+ $self->throw_exception( $self->name . " has no such relationship '$pre'" )
+ unless $rel_info;
+ my $as_prefix = ($alias =~ /^.*?\.(.+)$/ ? $1.'.' : '');
+ my $rel_source = $self->related_source($pre);
+
+ if (exists $rel_info->{attrs}{accessor}
+ && $rel_info->{attrs}{accessor} eq 'multi') {
+ $self->throw_exception(
+ "Can't prefetch has_many ${pre} (join cond too complex)")
+ unless ref($rel_info->{cond}) eq 'HASH';
+ my $dots = @{[$as_prefix =~ m/\./g]} + 1; # +1 to match the ".${as_prefix}"
+ if (my ($fail) = grep { @{[$_ =~ m/\./g]} == $dots }
+ keys %{$collapse}) {
+ my ($last) = ($fail =~ /([^\.]+)$/);
+ carp (
+ "Prefetching multiple has_many rels ${last} and ${pre} "
+ .(length($as_prefix)
+ ? "at the same level (${as_prefix}) "
+ : "at top level "
+ )
+ . 'will currently disrupt both the functionality of $rs->count(), '
+ . 'and the amount of objects retrievable via $rs->next(). '
+ . 'Use at your own risk.'
+ );
+ }
+ #my @col = map { (/^self\.(.+)$/ ? ("${as_prefix}.$1") : ()); }
+ # values %{$rel_info->{cond}};
+ $collapse->{".${as_prefix}${pre}"} = [ $rel_source->primary_columns ];
+ # action at a distance. prepending the '.' allows simpler code
+ # in ResultSet->_collapse_result
+ my @key = map { (/^foreign\.(.+)$/ ? ($1) : ()); }
+ keys %{$rel_info->{cond}};
+ my @ord = (ref($rel_info->{attrs}{order_by}) eq 'ARRAY'
+ ? @{$rel_info->{attrs}{order_by}}
+ : (defined $rel_info->{attrs}{order_by}
+ ? ($rel_info->{attrs}{order_by})
+ : ()));
+ push(@$order, map { "${as}.$_" } (@key, @ord));
+ }
+
+ return map { [ "${as}.$_", "${as_prefix}${pre}.$_", ] }
+ $rel_source->columns;
+ }
+}
+
=head2 related_source
=over 4
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSource.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceHandle.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceHandle.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceHandle.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -87,7 +87,7 @@
Thaws frozen handle. Resets the internal schema reference to the package
variable C<$thaw_schema>. The recomened way of setting this is to use
-C<$schema->thaw($ice)> which handles this for you.
+C<< $schema->thaw($ice) >> which handles this for you.
=cut
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceHandle.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceProxy/Table.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/ResultSourceProxy.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Row.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Row.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -112,7 +112,7 @@
->resultset
->new_result($data);
}
- if ($self->result_source->pk_depends_on($relname, $data)) {
+ if ($self->result_source->_pk_depends_on($relname, $data)) {
MULTICREATE_DEBUG and warn "MC $self constructing $relname via find_or_new";
return $self->result_source
->related_source($relname)
@@ -132,7 +132,7 @@
foreach my $key (keys %$reverse) {
# if their primary key depends on us, then we have to
# just create a result and we'll fill it out afterwards
- return 1 if $rel_source->pk_depends_on($key, $us);
+ return 1 if $rel_source->_pk_depends_on($key, $us);
}
return 0;
}
@@ -304,7 +304,7 @@
next REL unless (Scalar::Util::blessed($rel_obj)
&& $rel_obj->isa('DBIx::Class::Row'));
- next REL unless $source->pk_depends_on(
+ next REL unless $source->_pk_depends_on(
$relname, { $rel_obj->get_columns }
);
@@ -347,7 +347,6 @@
$self->throw_exception( "Can't get last insert id" )
unless (@ids == @auto_pri);
$self->store_column($auto_pri[$_] => $ids[$_]) for 0 .. $#ids;
-#use Data::Dumper; warn Dumper($self);
}
@@ -881,10 +880,10 @@
object. If a hashref of replacement data is supplied, these will take
precedence over data in the original.
-If the row has related objects in a
-L<DBIx::Class::Relationship/has_many> then those objects may be copied
-too depending on the L<cascade_copy|DBIx::Class::Relationship>
-relationship attribute.
+Relationships will be followed by the copy procedure B<only> if the
+relationship specifes a true value for its
+L<cascade_copy|DBIx::Class::Relationship::Base> attribute. C<cascade_copy>
+is set by default on C<has_many> relationships and unset on all others.
=cut
@@ -914,7 +913,7 @@
next unless $rel_info->{attrs}{cascade_copy};
- my $resolved = $self->result_source->resolve_condition(
+ my $resolved = $self->result_source->_resolve_condition(
$rel_info->{cond}, $rel, $new
);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Row.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks/OracleJoins.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks/OracleJoins.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks/OracleJoins.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,171 @@
+package # Hide from PAUSE
+ DBIx::Class::SQLAHacks::OracleJoins;
+
+use base qw( DBIx::Class::SQLAHacks );
+use Carp::Clan qw/^DBIx::Class/;
+
+sub select {
+ my ($self, $table, $fields, $where, $order, @rest) = @_;
+
+ if (ref($table) eq 'ARRAY') {
+ $where = $self->_oracle_joins($where, @{ $table });
+ }
+
+ return $self->SUPER::select($table, $fields, $where, $order, @rest);
+}
+
+sub _recurse_from {
+ my ($self, $from, @join) = @_;
+
+ my @sqlf = $self->_make_as($from);
+
+ foreach my $j (@join) {
+ my ($to, $on) = @{ $j };
+
+ if (ref $to eq 'ARRAY') {
+ push (@sqlf, $self->_recurse_from(@{ $to }));
+ }
+ else {
+ push (@sqlf, $self->_make_as($to));
+ }
+ }
+
+ return join q{, }, @sqlf;
+}
+
+sub _oracle_joins {
+ my ($self, $where, $from, @join) = @_;
+ my $join_where = {};
+ $self->_recurse_oracle_joins($join_where, $from, @join);
+ if (keys %$join_where) {
+ if (!defined($where)) {
+ $where = $join_where;
+ } else {
+ if (ref($where) eq 'ARRAY') {
+ $where = { -or => $where };
+ }
+ $where = { -and => [ $join_where, $where ] };
+ }
+ }
+ return $where;
+}
+
+sub _recurse_oracle_joins {
+ my ($self, $where, $from, @join) = @_;
+
+ foreach my $j (@join) {
+ my ($to, $on) = @{ $j };
+
+ if (ref $to eq 'ARRAY') {
+ $self->_recurse_oracle_joins($where, @{ $to });
+ }
+
+ my $to_jt = ref $to eq 'ARRAY' ? $to->[0] : $to;
+ my $left_join = q{};
+ my $right_join = q{};
+
+ if (ref $to_jt eq 'HASH' and exists $to_jt->{-join_type}) {
+ #TODO: Support full outer joins -- this would happen much earlier in
+ #the sequence since oracle 8's full outer join syntax is best
+ #described as INSANE.
+ croak "Can't handle full outer joins in Oracle 8 yet!\n"
+ if $to_jt->{-join_type} =~ /full/i;
+
+ $left_join = q{(+)} if $to_jt->{-join_type} =~ /left/i
+ && $to_jt->{-join_type} !~ /inner/i;
+
+ $right_join = q{(+)} if $to_jt->{-join_type} =~ /right/i
+ && $to_jt->{-join_type} !~ /inner/i;
+ }
+
+ foreach my $lhs (keys %{ $on }) {
+ $where->{$lhs . $left_join} = \"= $on->{ $lhs }$right_join";
+ }
+ }
+}
+
+1;
+
+=pod
+
+=head1 NAME
+
+DBIx::Class::SQLAHacks::OracleJoins - Pre-ANSI Joins-via-Where-Clause Syntax
+
+=head1 PURPOSE
+
+This module was originally written to support Oracle < 9i where ANSI joins
+weren't supported at all, but became the module for Oracle >= 8 because
+Oracle's optimising of ANSI joins is horrible. (See:
+http://scsys.co.uk:8001/7495)
+
+=head1 SYNOPSIS
+
+Not intended for use directly; used as the sql_maker_class for schemas and components.
+
+=head1 DESCRIPTION
+
+Implements pre-ANSI joins specified in the where clause. Instead of:
+
+ SELECT x FROM y JOIN z ON y.id = z.id
+
+It will write:
+
+ SELECT x FROM y, z WHERE y.id = z.id
+
+It should properly support left joins, and right joins. Full outer joins are
+not possible due to the fact that Oracle requires the entire query be written
+to union the results of a left and right join, and by the time this module is
+called to create the where query and table definition part of the sql query,
+it's already too late.
+
+=head1 METHODS
+
+=over
+
+=item select ($\@$;$$@)
+
+Replaces DBIx::Class::SQLAHacks's select() method, which calls _oracle_joins()
+to modify the column and table list before calling SUPER::select().
+
+=item _recurse_from ($$\@)
+
+Recursive subroutine that builds the table list.
+
+=item _oracle_joins ($$$@)
+
+Creates the left/right relationship in the where query.
+
+=back
+
+=head1 BUGS
+
+Does not support full outer joins.
+Probably lots more.
+
+=head1 SEE ALSO
+
+=over
+
+=item L<DBIx::Class::Storage::DBI::Oracle::WhereJoins> - Storage class using this
+
+=item L<DBIx::Class::SQLAHacks> - Parent module
+
+=item L<DBIx::Class> - Duh
+
+=back
+
+=head1 AUTHOR
+
+Justin Wheeler C<< <jwheeler at datademons.com> >>
+
+=head1 CONTRIBUTORS
+
+David Jack Olrik C<< <djo at cpan.org> >>
+
+=head1 LICENSE
+
+This module is licensed under the same terms as Perl itself.
+
+=cut
+
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks/OracleJoins.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,471 @@
+package # Hide from PAUSE
+ DBIx::Class::SQLAHacks;
+
+use base qw/SQL::Abstract::Limit/;
+use strict;
+use warnings;
+use Carp::Clan qw/^DBIx::Class/;
+
+sub new {
+ my $self = shift->SUPER::new(@_);
+
+ # This prevents the caching of $dbh in S::A::L, I believe
+ # If limit_dialect is a ref (like a $dbh), go ahead and replace
+ # it with what it resolves to:
+ $self->{limit_dialect} = $self->_find_syntax($self->{limit_dialect})
+ if ref $self->{limit_dialect};
+
+ $self;
+}
+
+
+# Some databases (sqlite) do not handle multiple parenthesis
+# around in/between arguments. A tentative x IN ( ( 1, 2 ,3) )
+# is interpreted as x IN 1 or something similar.
+#
+# Since we currently do not have access to the SQLA AST, resort
+# to barbaric mutilation of any SQL supplied in literal form
+
+sub _strip_outer_paren {
+ my ($self, $arg) = @_;
+
+ return $self->_SWITCH_refkind ($arg, {
+ ARRAYREFREF => sub {
+ $$arg->[0] = __strip_outer_paren ($$arg->[0]);
+ return $arg;
+ },
+ SCALARREF => sub {
+ return \__strip_outer_paren( $$arg );
+ },
+ FALLBACK => sub {
+ return $arg
+ },
+ });
+}
+
+sub __strip_outer_paren {
+ my $sql = shift;
+
+ if ($sql and not ref $sql) {
+ while ($sql =~ /^ \s* \( (.*) \) \s* $/x ) {
+ $sql = $1;
+ }
+ }
+
+ return $sql;
+}
+
+sub _where_field_IN {
+ my ($self, $lhs, $op, $rhs) = @_;
+ $rhs = $self->_strip_outer_paren ($rhs);
+ return $self->SUPER::_where_field_IN ($lhs, $op, $rhs);
+}
+
+sub _where_field_BETWEEN {
+ my ($self, $lhs, $op, $rhs) = @_;
+ $rhs = $self->_strip_outer_paren ($rhs);
+ return $self->SUPER::_where_field_BETWEEN ($lhs, $op, $rhs);
+}
+
+
+
+# DB2 is the only remaining DB using this. Even though we are not sure if
+# RowNumberOver is still needed here (should be part of SQLA) leave the
+# code in place
+sub _RowNumberOver {
+ my ($self, $sql, $order, $rows, $offset ) = @_;
+
+ $offset += 1;
+ my $last = $rows + $offset - 1;
+ my ( $order_by ) = $self->_order_by( $order );
+
+ $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
+
+SQL
+
+ return $sql;
+}
+
+
+# While we're at it, this should make LIMIT queries more efficient,
+# without digging into things too deeply
+sub _find_syntax {
+ my ($self, $syntax) = @_;
+ return $self->{_cached_syntax} ||= $self->SUPER::_find_syntax($syntax);
+}
+
+sub select {
+ my ($self, $table, $fields, $where, $order, @rest) = @_;
+ local $self->{having_bind} = [];
+ local $self->{from_bind} = [];
+
+ if (ref $table eq 'SCALAR') {
+ $table = $$table;
+ }
+ elsif (not ref $table) {
+ $table = $self->_quote($table);
+ }
+ local $self->{rownum_hack_count} = 1
+ if (defined $rest[0] && $self->{limit_dialect} eq 'RowNum');
+ @rest = (-1) unless defined $rest[0];
+ croak "LIMIT 0 Does Not Compute" if $rest[0] == 0;
+ # and anyway, SQL::Abstract::Limit will cause a barf if we don't first
+ my ($sql, @where_bind) = $self->SUPER::select(
+ $table, $self->_recurse_fields($fields), $where, $order, @rest
+ );
+ $sql .=
+ $self->{for} ?
+ (
+ $self->{for} eq 'update' ? ' FOR UPDATE' :
+ $self->{for} eq 'shared' ? ' FOR SHARE' :
+ ''
+ ) :
+ ''
+ ;
+ return wantarray ? ($sql, @{$self->{from_bind}}, @where_bind, @{$self->{having_bind}}) : $sql;
+}
+
+sub insert {
+ my $self = shift;
+ my $table = shift;
+ $table = $self->_quote($table) unless ref($table);
+ $self->SUPER::insert($table, @_);
+}
+
+sub update {
+ my $self = shift;
+ my $table = shift;
+ $table = $self->_quote($table) unless ref($table);
+ $self->SUPER::update($table, @_);
+}
+
+sub delete {
+ my $self = shift;
+ my $table = shift;
+ $table = $self->_quote($table) unless ref($table);
+ $self->SUPER::delete($table, @_);
+}
+
+sub _emulate_limit {
+ my $self = shift;
+ if ($_[3] == -1) {
+ return $_[1].$self->_order_by($_[2]);
+ } else {
+ return $self->SUPER::_emulate_limit(@_);
+ }
+}
+
+sub _recurse_fields {
+ my ($self, $fields, $params) = @_;
+ my $ref = ref $fields;
+ return $self->_quote($fields) unless $ref;
+ return $$fields if $ref eq 'SCALAR';
+
+ if ($ref eq 'ARRAY') {
+ return join(', ', map {
+ $self->_recurse_fields($_)
+ .(exists $self->{rownum_hack_count} && !($params && $params->{no_rownum_hack})
+ ? ' AS col'.$self->{rownum_hack_count}++
+ : '')
+ } @$fields);
+ } elsif ($ref eq 'HASH') {
+ foreach my $func (keys %$fields) {
+ if ($func eq 'distinct') {
+ my $_fields = $fields->{$func};
+ if (ref $_fields eq 'ARRAY' && @{$_fields} > 1) {
+ croak (
+ 'The select => { distinct => ... } syntax is not supported for multiple columns.'
+ .' Instead please use { group_by => [ qw/' . (join ' ', @$_fields) . '/ ] }'
+ .' or { select => [ qw/' . (join ' ', @$_fields) . '/ ], distinct => 1 }'
+ );
+ }
+ else {
+ $_fields = @{$_fields}[0] if ref $_fields eq 'ARRAY';
+ carp (
+ 'The select => { distinct => ... } syntax will be deprecated in DBIC version 0.09,'
+ ." please use { group_by => '${_fields}' } or { select => '${_fields}', distinct => 1 }"
+ );
+ }
+ }
+ return $self->_sqlcase($func)
+ .'( '.$self->_recurse_fields($fields->{$func}).' )';
+ }
+ }
+ # Is the second check absolutely necessary?
+ elsif ( $ref eq 'REF' and ref($$fields) eq 'ARRAY' ) {
+ return $self->_fold_sqlbind( $fields );
+ }
+ else {
+ croak($ref . qq{ unexpected in _recurse_fields()})
+ }
+}
+
+sub _order_by {
+ my $self = shift;
+ my $ret = '';
+ my @extra;
+ if (ref $_[0] eq 'HASH') {
+ if (defined $_[0]->{group_by}) {
+ $ret = $self->_sqlcase(' group by ')
+ .$self->_recurse_fields($_[0]->{group_by}, { no_rownum_hack => 1 });
+ }
+ if (defined $_[0]->{having}) {
+ my $frag;
+ ($frag, @extra) = $self->_recurse_where($_[0]->{having});
+ push(@{$self->{having_bind}}, @extra);
+ $ret .= $self->_sqlcase(' having ').$frag;
+ }
+ if (defined $_[0]->{order_by}) {
+ $ret .= $self->_order_by($_[0]->{order_by});
+ }
+ if (grep { $_ =~ /^-(desc|asc)/i } keys %{$_[0]}) {
+ return $self->SUPER::_order_by($_[0]);
+ }
+ } elsif (ref $_[0] eq 'SCALAR') {
+ $ret = $self->_sqlcase(' order by ').${ $_[0] };
+ } elsif (ref $_[0] eq 'ARRAY' && @{$_[0]}) {
+ my @order = @{+shift};
+ $ret = $self->_sqlcase(' order by ')
+ .join(', ', map {
+ my $r = $self->_order_by($_, @_);
+ $r =~ s/^ ?ORDER BY //i;
+ $r;
+ } @order);
+ } else {
+ $ret = $self->SUPER::_order_by(@_);
+ }
+ return $ret;
+}
+
+sub _order_directions {
+ my ($self, $order) = @_;
+ return $self->SUPER::_order_directions( $self->_resolve_order($order) );
+}
+
+sub _resolve_order {
+ my ($self, $order) = @_;
+ $order = $order->{order_by} if (ref $order eq 'HASH' and $order->{order_by});
+
+ if (ref $order eq 'HASH') {
+ $order = [$self->_resolve_order_hash($order)];
+ }
+ elsif (ref $order eq 'ARRAY') {
+ $order = [map {
+ if (ref ($_) eq 'SCALAR') {
+ $$_
+ }
+ elsif (ref ($_) eq 'HASH') {
+ $self->_resolve_order_hash($_)
+ }
+ else {
+ $_
+ }
+ } @$order];
+ }
+
+ return $order;
+}
+
+sub _resolve_order_hash {
+ my ($self, $order) = @_;
+ my @new_order;
+ foreach my $key (keys %{ $order }) {
+ if ($key =~ /^-(desc|asc)/i ) {
+ my $direction = $1;
+ my $type = ref $order->{ $key };
+ if ($type eq 'ARRAY') {
+ push @new_order, map( "$_ $direction", @{ $order->{ $key } } );
+ } elsif (!$type) {
+ push @new_order, "$order->{$key} $direction";
+ } else {
+ croak "hash order_by can only contain Scalar or Array, not $type";
+ }
+ } else {
+ croak "$key is not a valid direction, use -asc or -desc";
+ }
+ }
+ return @new_order;
+}
+
+sub _table {
+ my ($self, $from) = @_;
+ if (ref $from eq 'ARRAY') {
+ return $self->_recurse_from(@$from);
+ } elsif (ref $from eq 'HASH') {
+ return $self->_make_as($from);
+ } else {
+ return $from; # would love to quote here but _table ends up getting called
+ # twice during an ->select without a limit clause due to
+ # the way S::A::Limit->select works. should maybe consider
+ # bypassing this and doing S::A::select($self, ...) in
+ # our select method above. meantime, quoting shims have
+ # been added to select/insert/update/delete here
+ }
+}
+
+sub _recurse_from {
+ my ($self, $from, @join) = @_;
+ my @sqlf;
+ push(@sqlf, $self->_make_as($from));
+ foreach my $j (@join) {
+ my ($to, $on) = @$j;
+
+ # check whether a join type exists
+ my $join_clause = '';
+ my $to_jt = ref($to) eq 'ARRAY' ? $to->[0] : $to;
+ if (ref($to_jt) eq 'HASH' and exists($to_jt->{-join_type})) {
+ $join_clause = ' '.uc($to_jt->{-join_type}).' JOIN ';
+ } else {
+ $join_clause = ' JOIN ';
+ }
+ push(@sqlf, $join_clause);
+
+ if (ref $to eq 'ARRAY') {
+ push(@sqlf, '(', $self->_recurse_from(@$to), ')');
+ } else {
+ push(@sqlf, $self->_make_as($to));
+ }
+ push(@sqlf, ' ON ', $self->_join_condition($on));
+ }
+ return join('', @sqlf);
+}
+
+sub _fold_sqlbind {
+ my ($self, $sqlbind) = @_;
+
+ my @sqlbind = @$$sqlbind; # copy
+ my $sql = shift @sqlbind;
+ push @{$self->{from_bind}}, @sqlbind;
+
+ return $sql;
+}
+
+sub _make_as {
+ my ($self, $from) = @_;
+ return join(' ', map { (ref $_ eq 'SCALAR' ? $$_
+ : ref $_ eq 'REF' ? $self->_fold_sqlbind($_)
+ : $self->_quote($_))
+ } reverse each %{$self->_skip_options($from)});
+}
+
+sub _skip_options {
+ my ($self, $hash) = @_;
+ my $clean_hash = {};
+ $clean_hash->{$_} = $hash->{$_}
+ for grep {!/^-/} keys %$hash;
+ return $clean_hash;
+}
+
+sub _join_condition {
+ my ($self, $cond) = @_;
+ if (ref $cond eq 'HASH') {
+ my %j;
+ for (keys %$cond) {
+ my $v = $cond->{$_};
+ if (ref $v) {
+ croak (ref($v) . qq{ reference arguments are not supported in JOINS - try using \"..." instead'})
+ if ref($v) ne 'SCALAR';
+ $j{$_} = $v;
+ }
+ else {
+ my $x = '= '.$self->_quote($v); $j{$_} = \$x;
+ }
+ };
+ return scalar($self->_recurse_where(\%j));
+ } elsif (ref $cond eq 'ARRAY') {
+ return join(' OR ', map { $self->_join_condition($_) } @$cond);
+ } else {
+ die "Can't handle this yet!";
+ }
+}
+
+sub _quote {
+ my ($self, $label) = @_;
+ return '' unless defined $label;
+ return "*" if $label eq '*';
+ return $label unless $self->{quote_char};
+ if(ref $self->{quote_char} eq "ARRAY"){
+ return $self->{quote_char}->[0] . $label . $self->{quote_char}->[1]
+ if !defined $self->{name_sep};
+ my $sep = $self->{name_sep};
+ return join($self->{name_sep},
+ map { $self->{quote_char}->[0] . $_ . $self->{quote_char}->[1] }
+ split(/\Q$sep\E/,$label));
+ }
+ return $self->SUPER::_quote($label);
+}
+
+sub limit_dialect {
+ my $self = shift;
+ $self->{limit_dialect} = shift if @_;
+ return $self->{limit_dialect};
+}
+
+sub quote_char {
+ my $self = shift;
+ $self->{quote_char} = shift if @_;
+ return $self->{quote_char};
+}
+
+sub name_sep {
+ my $self = shift;
+ $self->{name_sep} = shift if @_;
+ return $self->{name_sep};
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+DBIx::Class::SQLAHacks - This module is a subclass of SQL::Abstract::Limit
+and includes a number of DBIC-specific workarounds, not yet suitable for
+inclusion into SQLA proper.
+
+=head1 METHODS
+
+=head2 new
+
+Tries to determine limit dialect.
+
+=head2 select
+
+Quotes table names, handles "limit" dialects (e.g. where rownum between x and
+y), supports SELECT ... FOR UPDATE and SELECT ... FOR SHARE.
+
+=head2 insert update delete
+
+Just quotes table names.
+
+=head2 limit_dialect
+
+Specifies the dialect of used for implementing an SQL "limit" clause for
+restricting the number of query results returned. Valid values are: RowNum.
+
+See L<DBIx::Class::Storage::DBI/connect_info> for details.
+
+=head2 name_sep
+
+Character separating quoted table names.
+
+See L<DBIx::Class::Storage::DBI/connect_info> for details.
+
+=head2 quote_char
+
+Set to an array-ref to specify separate left and right quotes for table names.
+
+See L<DBIx::Class::Storage::DBI/connect_info> for details.
+
+=cut
+
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/SQLAHacks.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema/Versioned.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema/Versioned.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -70,12 +70,12 @@
=head1 SYNOPSIS
- package Library::Schema;
+ package MyApp::Schema;
use base qw/DBIx::Class::Schema/;
our $VERSION = 0.001;
- # load Library::Schema::CD, Library::Schema::Book, Library::Schema::DVD
+ # load MyApp::Schema::CD, MyApp::Schema::Book, MyApp::Schema::DVD
__PACKAGE__->load_classes(qw/CD Book DVD/);
__PACKAGE__->load_components(qw/Schema::Versioned/);
@@ -181,8 +181,9 @@
use strict;
use warnings;
use base 'DBIx::Class';
+
+use Carp::Clan qw/^DBIx::Class/;
use POSIX 'strftime';
-use Data::Dumper;
__PACKAGE__->mk_classdata('_filedata');
__PACKAGE__->mk_classdata('upgrade_directory');
@@ -226,7 +227,7 @@
# must be called on a fresh database
if ($self->get_db_version()) {
- warn 'Install not possible as versions table already exists in database';
+ carp 'Install not possible as versions table already exists in database';
}
# default to current version if none passed
@@ -292,13 +293,13 @@
# db unversioned
unless ($db_version) {
- warn 'Upgrade not possible as database is unversioned. Please call install first.';
+ carp 'Upgrade not possible as database is unversioned. Please call install first.';
return;
}
# db and schema at same version. do nothing
if ($db_version eq $self->schema_version) {
- print "Upgrade not necessary\n";
+ carp "Upgrade not necessary\n";
return;
}
@@ -318,11 +319,11 @@
$self->create_upgrade_path({ upgrade_file => $upgrade_file });
unless (-f $upgrade_file) {
- warn "Upgrade not possible, no upgrade file found ($upgrade_file), please create one\n";
+ carp "Upgrade not possible, no upgrade file found ($upgrade_file), please create one\n";
return;
}
- warn "\nDB version ($db_version) is lower than the schema version (".$self->schema_version."). Attempting upgrade.\n";
+ carp "\nDB version ($db_version) is lower than the schema version (".$self->schema_version."). Attempting upgrade.\n";
# backup if necessary then apply upgrade
$self->_filedata($self->_read_sql_file($upgrade_file));
@@ -392,7 +393,7 @@
sub apply_statement {
my ($self, $statement) = @_;
- $self->storage->dbh->do($_) or warn "SQL was:\n $_";
+ $self->storage->dbh->do($_) or carp "SQL was:\n $_";
}
=head2 get_db_version
@@ -491,17 +492,17 @@
if($pversion eq $self->schema_version)
{
-# warn "This version is already installed\n";
+# carp "This version is already installed\n";
return 1;
}
if(!$pversion)
{
- warn "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n";
+ carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n";
return 1;
}
- warn "Versions out of sync. This is " . $self->schema_version .
+ carp "Versions out of sync. This is " . $self->schema_version .
", your database contains version $pversion, please call upgrade on your Schema.\n";
}
@@ -564,7 +565,7 @@
print $file $diff;
close($file);
- print "WARNING: There may be differences between your DB and your DBIC schema. Please review and if necessary run the SQL in $filename to sync your DB.\n";
+ carp "WARNING: There may be differences between your DB and your DBIC schema. Please review and if necessary run the SQL in $filename to sync your DB.\n";
}
@@ -586,7 +587,7 @@
my $file = shift || return;
my $fh;
- open $fh, "<$file" or warn("Can't open upgrade file, $file ($!)");
+ open $fh, "<$file" or carp("Can't open upgrade file, $file ($!)");
my @data = split(/\n/, join('', <$fh>));
@data = grep(!/^--/, @data);
@data = split(/;/, join('', @data));
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema/Versioned.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -235,7 +235,7 @@
if($rs_set && $rs_set ne 'DBIx::Class::ResultSet') {
if($rs_class && $rs_class ne $rs_set) {
- warn "We found ResultSet class '$rs_class' for '$result', but it seems "
+ carp "We found ResultSet class '$rs_class' for '$result', but it seems "
. "that you had already set '$result' to use '$rs_set' instead";
}
}
@@ -251,7 +251,7 @@
}
foreach (sort keys %resultsets) {
- warn "load_namespaces found ResultSet class $_ with no "
+ carp "load_namespaces found ResultSet class $_ with no "
. 'corresponding Result class';
}
@@ -344,7 +344,7 @@
my $snsub = $comp_class->can('source_name');
if(! $snsub ) {
- warn "Failed to load $comp_class. Can't find source_name method. Is $comp_class really a full DBIC result class? Fix it, move it elsewhere, or make your load_classes call more specific.";
+ carp "Failed to load $comp_class. Can't find source_name method. Is $comp_class really a full DBIC result class? Fix it, move it elsewhere, or make your load_classes call more specific.";
next;
}
$comp = $snsub->($comp_class) || $comp;
@@ -1350,7 +1350,7 @@
sub compose_connection {
my ($self, $target, @info) = @_;
- warn "compose_connection deprecated as of 0.08000"
+ carp "compose_connection deprecated as of 0.08000"
unless ($INC{"DBIx/Class/CDBICompat.pm"} || $warn++);
my $base = 'DBIx::Class::ResultSetProxy';
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Schema.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Serialize/Storable.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/StartupCheck.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Cursor.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Cursor.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Cursor.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -36,8 +36,8 @@
sub new {
my ($class, $storage, $args, $attrs) = @_;
- #use Data::Dumper; warn Dumper(@_);
$class = ref $class if ref $class;
+
my $new = {
storage => $storage,
args => $args,
@@ -72,7 +72,7 @@
my @args = $storage->_select_args(@{$self->{args}});
my ($sql, $bind) = $storage->_prep_for_execute(@args[0 .. 2], [@args[4 .. $#args]]);
- return \[ "($sql)", @$bind ];
+ return \[ "($sql)", @{ $bind || [] }];
}
=head2 next
@@ -152,7 +152,7 @@
my ($self) = @_;
if ($self->{attrs}{software_limit}
&& ($self->{attrs}{offset} || $self->{attrs}{rows})) {
- return $self->SUPER::all;
+ return $self->next::method;
}
$self->{storage}->dbh_do($self->can('_dbh_all'), $self);
}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Cursor.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/DB2.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/DB2.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/DB2.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -20,6 +20,16 @@
sub datetime_parser_type { "DateTime::Format::DB2"; }
+sub _sql_maker_opts {
+ my ( $self, $opts ) = @_;
+
+ if ( $opts ) {
+ $self->{_sql_maker_opts} = { %$opts };
+ }
+
+ return { limit_dialect => 'RowNumberOver', %{$self->{_sql_maker_opts}||{}} };
+}
+
1;
=head1 NAME
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/DB2.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MSSQL.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MSSQL.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -16,9 +16,21 @@
my $type = "DateTime::Format::Strptime";
eval "use ${type}";
$self->throw_exception("Couldn't load ${type}: $@") if $@;
- return $type->new( pattern => '%m/%d/%Y %H:%M:%S' );
+ return $type->new( pattern => '%Y-%m-%d %H:%M:%S' ); # %F %T
}
+sub sqlt_type { 'SQLServer' }
+
+sub _sql_maker_opts {
+ my ( $self, $opts ) = @_;
+
+ if ( $opts ) {
+ $self->{_sql_maker_opts} = { %$opts };
+ }
+
+ return { limit_dialect => 'Top', %{$self->{_sql_maker_opts}||{}} };
+}
+
1;
=head1 NAME
@@ -39,6 +51,17 @@
merge this class with a DBD-specific class to obtain fully
correct behavior for your scenario.
+=head1 METHODS
+
+=head2 last_insert_id
+
+=head2 sqlt_type
+
+=head2 build_datetime_parser
+
+The resulting parser handles the MSSQL C<DATETIME> type, but is almost
+certainly not sufficient for the other MSSQL 2008 date/time types.
+
=head1 AUTHORS
Brian Cassidy <bricas at cpan.org>
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MSSQL.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiColumnIn.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiColumnIn.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiColumnIn.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,61 @@
+package DBIx::Class::Storage::DBI::MultiColumnIn;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Storage::DBI';
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::MultiColumnIn - Storage component for RDBMS supporting multicolumn in clauses
+
+=head1 DESCRIPTION
+
+While ANSI SQL does not define a multicolumn in operator, many databases can
+in fact understand WHERE (cola, colb) IN ( SELECT subcol_a, subcol_b ... )
+The storage class for any such RDBMS should inherit from this class, in order
+to dramatically speed up update/delete operations on joined multipk resultsets.
+
+At this point the only overriden method is C<_multipk_update_delete()>
+
+=cut
+
+sub _multipk_update_delete {
+ my $self = shift;
+ my ($rs, $op, $values) = @_;
+
+ my $rsrc = $rs->result_source;
+ my @pcols = $rsrc->primary_columns;
+ my $attrs = $rs->_resolved_attrs;
+
+ # naive check - this is an internal method after all, we should know what we are doing
+ $self->throw_exception ('Number of columns selected by supplied resultset does not match number of primary keys')
+ if ( ref $attrs->{select} ne 'ARRAY' or @{$attrs->{select}} != @pcols );
+
+ # This is hideously ugly, but SQLA does not understand multicol IN expressions
+ my $sqla = $self->_sql_maker;
+ my ($sql, @bind) = @${$rs->as_query};
+ $sql = sprintf ('(%s) IN %s', # the as_query stuff is already enclosed in ()s
+ join (', ', map { $sqla->_quote ($_) } @pcols),
+ $sql,
+ );
+
+ return $self->$op (
+ $rsrc,
+ $op eq 'update' ? $values : (),
+ \[$sql, @bind],
+ );
+
+}
+
+=head1 AUTHORS
+
+See L<DBIx::Class/CONTRIBUTORS>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiColumnIn.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,51 +0,0 @@
-package DBIx::Class::Storage::DBI::MultiDistinctEmulation;
-
-use strict;
-use warnings;
-
-use base qw/DBIx::Class::Storage::DBI/;
-
-sub _select {
- my ($self, $ident, $select, $condition, $attrs) = @_;
-
- # hack to make count distincts with multiple columns work in SQLite and Oracle
- if (ref $select eq 'ARRAY') {
- @{$select} = map {$self->replace_distincts($_)} @{$select};
- } else {
- $select = $self->replace_distincts($select);
- }
-
- return $self->next::method($ident, $select, $condition, $attrs);
-}
-
-sub replace_distincts {
- my ($self, $select) = @_;
-
- $select->{count}->{distinct} = join("||", @{$select->{count}->{distinct}})
- if (ref $select eq 'HASH' && $select->{count} && ref $select->{count} eq 'HASH' &&
- $select->{count}->{distinct} && ref $select->{count}->{distinct} eq 'ARRAY');
-
- return $select;
-}
-
-1;
-
-=head1 NAME
-
-DBIx::Class::Storage::DBI::MultiDistinctEmulation - Some databases can't handle count distincts with multiple cols. They should use base on this.
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-This class allows count distincts with multiple columns for retarded databases (Oracle and SQLite)
-
-=head1 AUTHORS
-
-Luke Saunders <luke.saunders at gmail.com>
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself.
-
-=cut
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/NoBindVars.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/NoBindVars.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/NoBindVars.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -61,7 +61,7 @@
}
$new_sql .= join '', @sql_part;
- return ($new_sql);
+ return ($new_sql, []);
}
=head1 AUTHORS
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/NoBindVars.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,127 +1,127 @@
-package DBIx::Class::Storage::DBI::ODBC::ACCESS;
-use strict;
-use warnings;
-
-use DBI;
-use base qw/DBIx::Class::Storage::DBI/;
-
-my $ERR_MSG_START = __PACKAGE__ . ' failed: ';
-
-sub insert {
- my $self = shift;
- my ( $source, $to_insert ) = @_;
-
- my $bind_attributes = $self->source_bind_attributes( $source );
- my ( undef, $sth ) = $self->_execute( 'insert' => [], $source, $bind_attributes, $to_insert );
-
- #store the identity here since @@IDENTITY is connection global and this prevents
- #possibility that another insert to a different table overwrites it for this resultsource
- my $identity = 'SELECT @@IDENTITY';
- my $max_sth = $self->{ _dbh }->prepare( $identity )
- or $self->throw_exception( $ERR_MSG_START . $self->{ _dbh }->errstr() );
- $max_sth->execute() or $self->throw_exception( $ERR_MSG_START . $max_sth->errstr );
-
- my $row = $max_sth->fetchrow_arrayref()
- or $self->throw_exception( $ERR_MSG_START . "$identity did not return any result." );
-
- $self->{ last_pk }->{ $source->name() } = $row;
-
- return $to_insert;
-}
-
-sub last_insert_id {
- my $self = shift;
- my ( $result_source ) = @_;
-
- return @{ $self->{ last_pk }->{ $result_source->name() } };
-}
-
-sub bind_attribute_by_data_type {
- my $self = shift;
-
- my ( $data_type ) = @_;
-
- return { TYPE => $data_type } if $data_type == DBI::SQL_LONGVARCHAR;
-
- return;
-}
-
-sub sqlt_type { 'ACCESS' }
-
-1;
-
-=head1 NAME
-
-DBIx::Class::Storage::DBI::ODBC::ACCESS - Support specific to MS Access over ODBC
-
-=head1 WARNING
-
-I am not a DBI, DBIx::Class or MS Access guru. Use this module with that in
-mind.
-
-This module is currently considered alpha software and can change without notice.
-
-=head1 DESCRIPTION
-
-This class implements support specific to Microsoft Access over ODBC.
-
-It is loaded automatically by by DBIx::Class::Storage::DBI::ODBC when it
-detects a MS Access back-end.
-
-=head1 SUPPORTED VERSIONS
-
-This module have currently only been tested on MS Access 2003 using the Jet 4.0 engine.
-
-As far as my knowledge it should work on MS Access 2000 or later, but that have not been tested.
-Information about support for different version of MS Access is welcome.
-
-=head1 IMPLEMENTATION NOTES
-
-MS Access supports the @@IDENTITY function for retriving the id of the latest inserted row.
-@@IDENTITY is global to the connection, so to support the possibility of getting the last inserted
-id for different tables, the insert() function stores the inserted id on a per table basis.
-last_insert_id() then just returns the stored value.
-
-=head1 KNOWN ACCESS PROBLEMS
-
-=over
-
-=item Invalid precision value
-
-This error message is received when trying to store more than 255 characters in a MEMO field.
-The problem is (to my knowledge) an error in the MS Access ODBC driver. The problem is fixed
-by setting the C<data_type> of the column to C<SQL_LONGVARCHAR> in C<add_columns>.
-C<SQL_LONGVARCHAR> is a constant in the C<DBI> module.
-
-=back
-
-=head1 IMPLEMENTED FUNCTIONS
-
-=head2 bind_attribute_by_data_type
-
-This function currently supports the SQL_LONGVARCHAR column type.
-
-=head2 insert
-
-=head2 last_insert_id
-
-=head2 sqlt_type
-
-=head1 BUGS
-
-Most likely. Bug reports are welcome.
-
-=head1 AUTHORS
-
-Øystein Torget C<< <oystein.torget at dnv.com> >>
-
-=head1 COPYRIGHT
-
-You may distribute this code under the same terms as Perl itself.
-
-Det Norske Veritas AS (DNV)
-
-http://www.dnv.com
-
-=cut
-
+package DBIx::Class::Storage::DBI::ODBC::ACCESS;
+use strict;
+use warnings;
+
+use DBI;
+use base qw/DBIx::Class::Storage::DBI/;
+
+my $ERR_MSG_START = __PACKAGE__ . ' failed: ';
+
+sub insert {
+ my $self = shift;
+ my ( $source, $to_insert ) = @_;
+
+ my $bind_attributes = $self->source_bind_attributes( $source );
+ my ( undef, $sth ) = $self->_execute( 'insert' => [], $source, $bind_attributes, $to_insert );
+
+ #store the identity here since @@IDENTITY is connection global and this prevents
+ #possibility that another insert to a different table overwrites it for this resultsource
+ my $identity = 'SELECT @@IDENTITY';
+ my $max_sth = $self->{ _dbh }->prepare( $identity )
+ or $self->throw_exception( $ERR_MSG_START . $self->{ _dbh }->errstr() );
+ $max_sth->execute() or $self->throw_exception( $ERR_MSG_START . $max_sth->errstr );
+
+ my $row = $max_sth->fetchrow_arrayref()
+ or $self->throw_exception( $ERR_MSG_START . "$identity did not return any result." );
+
+ $self->{ last_pk }->{ $source->name() } = $row;
+
+ return $to_insert;
+}
+
+sub last_insert_id {
+ my $self = shift;
+ my ( $result_source ) = @_;
+
+ return @{ $self->{ last_pk }->{ $result_source->name() } };
+}
+
+sub bind_attribute_by_data_type {
+ my $self = shift;
+
+ my ( $data_type ) = @_;
+
+ return { TYPE => $data_type } if $data_type == DBI::SQL_LONGVARCHAR;
+
+ return;
+}
+
+sub sqlt_type { 'ACCESS' }
+
+1;
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::ODBC::ACCESS - Support specific to MS Access over ODBC
+
+=head1 WARNING
+
+I am not a DBI, DBIx::Class or MS Access guru. Use this module with that in
+mind.
+
+This module is currently considered alpha software and can change without notice.
+
+=head1 DESCRIPTION
+
+This class implements support specific to Microsoft Access over ODBC.
+
+It is loaded automatically by by DBIx::Class::Storage::DBI::ODBC when it
+detects a MS Access back-end.
+
+=head1 SUPPORTED VERSIONS
+
+This module have currently only been tested on MS Access 2003 using the Jet 4.0 engine.
+
+As far as my knowledge it should work on MS Access 2000 or later, but that have not been tested.
+Information about support for different version of MS Access is welcome.
+
+=head1 IMPLEMENTATION NOTES
+
+MS Access supports the @@IDENTITY function for retriving the id of the latest inserted row.
+@@IDENTITY is global to the connection, so to support the possibility of getting the last inserted
+id for different tables, the insert() function stores the inserted id on a per table basis.
+last_insert_id() then just returns the stored value.
+
+=head1 KNOWN ACCESS PROBLEMS
+
+=over
+
+=item Invalid precision value
+
+This error message is received when trying to store more than 255 characters in a MEMO field.
+The problem is (to my knowledge) an error in the MS Access ODBC driver. The problem is fixed
+by setting the C<data_type> of the column to C<SQL_LONGVARCHAR> in C<add_columns>.
+C<SQL_LONGVARCHAR> is a constant in the C<DBI> module.
+
+=back
+
+=head1 IMPLEMENTED FUNCTIONS
+
+=head2 bind_attribute_by_data_type
+
+This function currently supports the SQL_LONGVARCHAR column type.
+
+=head2 insert
+
+=head2 last_insert_id
+
+=head2 sqlt_type
+
+=head1 BUGS
+
+Most likely. Bug reports are welcome.
+
+=head1 AUTHORS
+
+Øystein Torget C<< <oystein.torget at dnv.com> >>
+
+=head1 COPYRIGHT
+
+You may distribute this code under the same terms as Perl itself.
+
+Det Norske Veritas AS (DNV)
+
+http://www.dnv.com
+
+=cut
+
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,13 +2,13 @@
use strict;
use warnings;
-use base qw/DBIx::Class::Storage::DBI/;
+use base qw/DBIx::Class::Storage::DBI::MSSQL/;
sub _prep_for_execute {
my $self = shift;
my ($op, $extra_bind, $ident, $args) = @_;
- my ($sql, $bind) = $self->SUPER::_prep_for_execute(@_);
+ my ($sql, $bind) = $self->next::method (@_);
$sql .= ';SELECT SCOPE_IDENTITY()' if $op eq 'insert';
return ($sql, $bind);
@@ -19,33 +19,16 @@
my ($op) = @_;
my ($rv, $sth, @bind) = $self->dbh_do($self->can('_dbh_execute'), @_);
- $self->{_scope_identity} = $sth->fetchrow_array if $op eq 'insert';
+ if ($op eq 'insert') {
+ $self->{_scope_identity} = $sth->fetchrow_array;
+ $sth->finish;
+ }
return wantarray ? ($rv, $sth, @bind) : $rv;
}
sub last_insert_id { shift->{_scope_identity} }
-sub sqlt_type { 'SQLServer' }
-
-sub _sql_maker_opts {
- my ( $self, $opts ) = @_;
-
- if ( $opts ) {
- $self->{_sql_maker_opts} = { %$opts };
- }
-
- return { limit_dialect => 'Top', %{$self->{_sql_maker_opts}||{}} };
-}
-
-sub build_datetime_parser {
- my $self = shift;
- my $type = "DateTime::Format::Strptime";
- eval "use ${type}";
- $self->throw_exception("Couldn't load ${type}: $@") if $@;
- return $type->new( pattern => '%F %T' );
-}
-
1;
__END__
@@ -72,17 +55,6 @@
So, this implementation appends a SELECT SCOPE_IDENTITY() statement
onto each INSERT to accommodate that requirement.
-=head1 METHODS
-
-=head2 last_insert_id
-
-=head2 sqlt_type
-
-=head2 build_datetime_parser
-
-The resulting parser handles the MSSQL C<DATETIME> type, but is almost
-certainly not sufficient for the other MSSQL 2008 date/time types.
-
=head1 AUTHORS
Marc Mims C<< <marc at questright.com> >>
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -7,7 +7,7 @@
sub _rebless {
my ($self) = @_;
- my $dbtype = eval { $self->_dbh->get_info(17) };
+ my $dbtype = eval { $self->dbh->get_info(17) };
unless ( $@ ) {
# Translate the backend name into a perl identifier
$dbtype =~ s/\W/_/gi;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/ODBC.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,5 +1,4 @@
package DBIx::Class::Storage::DBI::Oracle::Generic;
-# -*- mode: cperl; cperl-indent-level: 2 -*-
use strict;
use warnings;
@@ -24,12 +23,12 @@
=cut
+use base qw/DBIx::Class::Storage::DBI/;
use Carp::Clan qw/^DBIx::Class/;
-use base qw/DBIx::Class::Storage::DBI::MultiDistinctEmulation/;
+# For ORA_BLOB => 113, ORA_CLOB => 112
+use DBD::Oracle qw( :ora_types );
-# __PACKAGE__->load_components(qw/PK::Auto/);
-
sub _dbh_last_insert_id {
my ($self, $dbh, $source, @columns) = @_;
my @ids = ();
@@ -98,7 +97,7 @@
sub connected {
my $self = shift;
- if (not $self->SUPER::connected(@_)) {
+ if (not $self->next::method(@_)) {
return 0;
}
else {
@@ -128,9 +127,9 @@
do {
eval {
if ($wantarray) {
- @res = $self->SUPER::_dbh_execute(@_);
+ @res = $self->next::method(@_);
} else {
- $res[0] = $self->SUPER::_dbh_execute(@_);
+ $res[0] = $self->next::method(@_);
}
};
$exception = $@;
@@ -190,6 +189,48 @@
$self->dbh->do("SAVEPOINT $name");
}
+=head2 source_bind_attributes
+
+Handle LOB types in Oracle. Under a certain size (4k?), you can get away
+with the driver assuming your input is the deprecated LONG type if you
+encode it as a hex string. That ain't gonna fly at larger values, where
+you'll discover you have to do what this does.
+
+This method had to be overridden because we need to set ora_field to the
+actual column, and that isn't passed to the call (provided by Storage) to
+bind_attribute_by_data_type.
+
+According to L<DBD::Oracle>, the ora_field isn't always necessary, but
+adding it doesn't hurt, and will save your bacon if you're modifying a
+table with more than one LOB column.
+
+=cut
+
+sub source_bind_attributes
+{
+ my $self = shift;
+ my($source) = @_;
+
+ my %bind_attributes;
+
+ foreach my $column ($source->columns) {
+ my $data_type = $source->column_info($column)->{data_type} || '';
+ next unless $data_type;
+
+ my %column_bind_attrs = $self->bind_attribute_by_data_type($data_type);
+
+ if ($data_type =~ /^[BC]LOB$/i) {
+ $column_bind_attrs{'ora_type'}
+ = uc($data_type) eq 'CLOB' ? ORA_CLOB : ORA_BLOB;
+ $column_bind_attrs{'ora_field'} = $column;
+ }
+
+ $bind_attributes{$column} = \%column_bind_attrs;
+ }
+
+ return \%bind_attributes;
+}
+
# Oracle automatically releases a savepoint when you start another one with the
# same name.
sub _svp_release { 1 }
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -5,95 +5,8 @@
use strict;
use warnings;
-__PACKAGE__->sql_maker_class('DBIC::SQL::Abstract::Oracle');
+__PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::OracleJoins');
-BEGIN {
- package # Hide from PAUSE
- DBIC::SQL::Abstract::Oracle;
-
- use base qw( DBIC::SQL::Abstract );
-
- sub select {
- my ($self, $table, $fields, $where, $order, @rest) = @_;
-
- if (ref($table) eq 'ARRAY') {
- $where = $self->_oracle_joins($where, @{ $table });
- }
-
- return $self->SUPER::select($table, $fields, $where, $order, @rest);
- }
-
- sub _recurse_from {
- my ($self, $from, @join) = @_;
-
- my @sqlf = $self->_make_as($from);
-
- foreach my $j (@join) {
- my ($to, $on) = @{ $j };
-
- if (ref $to eq 'ARRAY') {
- push (@sqlf, $self->_recurse_from(@{ $to }));
- }
- else {
- push (@sqlf, $self->_make_as($to));
- }
- }
-
- return join q{, }, @sqlf;
- }
-
- sub _oracle_joins {
- my ($self, $where, $from, @join) = @_;
- my $join_where = {};
- $self->_recurse_oracle_joins($join_where, $from, @join);
- if (keys %$join_where) {
- if (!defined($where)) {
- $where = $join_where;
- } else {
- if (ref($where) eq 'ARRAY') {
- $where = { -or => $where };
- }
- $where = { -and => [ $join_where, $where ] };
- }
- }
- return $where;
- }
-
- sub _recurse_oracle_joins {
- my ($self, $where, $from, @join) = @_;
-
- foreach my $j (@join) {
- my ($to, $on) = @{ $j };
-
- if (ref $to eq 'ARRAY') {
- $self->_recurse_oracle_joins($where, @{ $to });
- }
-
- my $to_jt = ref $to eq 'ARRAY' ? $to->[0] : $to;
- my $left_join = q{};
- my $right_join = q{};
-
- if (ref $to_jt eq 'HASH' and exists $to_jt->{-join_type}) {
- #TODO: Support full outer joins -- this would happen much earlier in
- #the sequence since oracle 8's full outer join syntax is best
- #described as INSANE.
- die "Can't handle full outer joins in Oracle 8 yet!\n"
- if $to_jt->{-join_type} =~ /full/i;
-
- $left_join = q{(+)} if $to_jt->{-join_type} =~ /left/i
- && $to_jt->{-join_type} !~ /inner/i;
-
- $right_join = q{(+)} if $to_jt->{-join_type} =~ /right/i
- && $to_jt->{-join_type} !~ /inner/i;
- }
-
- foreach my $lhs (keys %{ $on }) {
- $where->{$lhs . $left_join} = \"= $on->{ $lhs }$right_join";
- }
- }
- }
-}
-
1;
__END__
@@ -135,34 +48,8 @@
=head1 METHODS
-This module replaces a subroutine contained in DBIC::SQL::Abstract:
+See L<DBIx::Class::SQLAHacks::OracleJoins> for implementation details.
-=over
-
-=item sql_maker
-
-=back
-
-It also creates a new module in its BEGIN { } block called
-DBIC::SQL::Abstract::Oracle which has the following methods:
-
-=over
-
-=item select ($\@$;$$@)
-
-Replaces DBIC::SQL::Abstract's select() method, which calls _oracle_joins()
-to modify the column and table list before calling SUPER::select().
-
-=item _recurse_from ($$\@)
-
-Recursive subroutine that builds the table list.
-
-=item _oracle_joins ($$$@)
-
-Creates the left/right relationship in the where query.
-
-=back
-
=head1 BUGS
Does not support full outer joins.
@@ -172,8 +59,10 @@
=over
-=item L<DBIC::SQL::Abstract>
+=item L<DBIx::Class::SQLAHacks>
+=item L<DBIx::Class::SQLAHacks::OracleJoins>
+
=item L<DBIx::Class::Storage::DBI::Oracle::Generic>
=item L<DBIx::Class>
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -8,7 +8,7 @@
sub _rebless {
my ($self) = @_;
- my $version = eval { $self->_dbh->get_info(18); };
+ my $version = eval { $self->dbh->get_info(18); };
if ( !$@ ) {
my ($major, $minor, $patchlevel) = split(/\./, $version);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Oracle.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Pg.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -5,7 +5,7 @@
use DBD::Pg qw(:pg_types);
-use base qw/DBIx::Class::Storage::DBI/;
+use base qw/DBIx::Class::Storage::DBI::MultiColumnIn/;
# __PACKAGE__->load_components(qw/PK::Auto/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Pg.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,6 +2,7 @@
use Moose;
with 'DBIx::Class::Storage::DBI::Replicated::Balancer';
+use namespace::clean -except => 'meta';
=head1 NAME
@@ -50,4 +51,4 @@
__PACKAGE__->meta->make_immutable;
-1;
\ No newline at end of file
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,6 +2,8 @@
use Moose;
with 'DBIx::Class::Storage::DBI::Replicated::Balancer';
+use DBIx::Class::Storage::DBI::Replicated::Types 'Weight';
+use namespace::clean -except => 'meta';
=head1 NAME
@@ -26,6 +28,23 @@
This class defines the following attributes.
+=head2 master_read_weight
+
+A number greater than 0 that specifies what weight to give the master when
+choosing which backend to execute a read query on. A value of 0, which is the
+default, does no reads from master, while a value of 1 gives it the same
+priority as any single replicant.
+
+For example: if you have 2 replicants, and a L</master_read_weight> of C<0.5>,
+the chance of reading from master will be C<20%>.
+
+You can set it to a value higher than 1, making master have higher weight than
+any single replicant, if for example you have a very powerful master.
+
+=cut
+
+has master_read_weight => (is => 'rw', isa => Weight, default => sub { 0 });
+
=head1 METHODS
This class defines the following methods.
@@ -40,13 +59,25 @@
sub next_storage {
my $self = shift @_;
- my @active_replicants = $self->pool->active_replicants;
- my $count_active_replicants = $#active_replicants +1;
- my $random_replicant = int(rand($count_active_replicants));
-
- return $active_replicants[$random_replicant];
+
+ my @replicants = $self->pool->active_replicants;
+
+ if (not @replicants) {
+ # will fall back to master anyway
+ return;
+ }
+
+ my $master = $self->master;
+
+ my $rnd = $self->_random_number(@replicants + $self->master_read_weight);
+
+ return $rnd >= @replicants ? $master : $replicants[int $rnd];
}
+sub _random_number {
+ rand($_[1])
+}
+
=head1 AUTHOR
John Napiorkowski <john.napiorkowski at takkle.com>
@@ -59,4 +90,4 @@
__PACKAGE__->meta->make_immutable;
-1;
\ No newline at end of file
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,10 @@
use Moose::Role;
requires 'next_storage';
+use MooseX::Types::Moose qw/Int/;
+use namespace::clean -except => 'meta';
+
=head1 NAME
DBIx::Class::Storage::DBI::Replicated::Balancer - A Software Load Balancer
@@ -31,7 +34,7 @@
has 'auto_validate_every' => (
is=>'rw',
- isa=>'Int',
+ isa=>Int,
predicate=>'has_auto_validate_every',
);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,8 +3,13 @@
use Moose;
use MooseX::AttributeHelpers;
use DBIx::Class::Storage::DBI::Replicated::Replicant;
-use List::Util qw(sum);
+use List::Util 'sum';
+use Scalar::Util 'reftype';
+use Carp::Clan qw/^DBIx::Class/;
+use MooseX::Types::Moose qw/Num Int ClassName HashRef/;
+use namespace::clean -except => 'meta';
+
=head1 NAME
DBIx::Class::Storage::DBI::Replicated::Pool - Manage a pool of replicants
@@ -37,7 +42,7 @@
has 'maximum_lag' => (
is=>'rw',
- isa=>'Num',
+ isa=>Num,
required=>1,
lazy=>1,
default=>0,
@@ -53,7 +58,7 @@
has 'last_validated' => (
is=>'rw',
- isa=>'Int',
+ isa=>Int,
reader=>'last_validated',
writer=>'_last_validated',
lazy=>1,
@@ -70,7 +75,7 @@
has 'replicant_type' => (
is=>'ro',
- isa=>'ClassName',
+ isa=>ClassName,
required=>1,
default=>'DBIx::Class::Storage::DBI',
handles=>{
@@ -120,7 +125,7 @@
has 'replicants' => (
is=>'rw',
metaclass => 'Collection::Hash',
- isa=>'HashRef[DBIx::Class::Storage::DBI]',
+ isa=>HashRef['DBIx::Class::Storage::DBI'],
default=>sub {{}},
provides => {
'set' => 'set_replicant',
@@ -137,9 +142,9 @@
=head2 connect_replicants ($schema, Array[$connect_info])
-Given an array of $dsn suitable for connected to a database, create an
-L<DBIx::Class::Storage::DBI::Replicated::Replicant> object and store it in the
-L</replicants> attribute.
+Given an array of $dsn or connect_info structures suitable for connected to a
+database, create an L<DBIx::Class::Storage::DBI::Replicated::Replicant> object
+and store it in the L</replicants> attribute.
=cut
@@ -149,8 +154,18 @@
my @newly_created = ();
foreach my $connect_info (@_) {
+ $connect_info = [ $connect_info ]
+ if reftype $connect_info ne 'ARRAY';
+
+ croak "coderef replicant connect_info not supported"
+ if ref $connect_info->[0] && reftype $connect_info->[0] eq 'CODE';
+
my $replicant = $self->connect_replicant($schema, $connect_info);
- my ($key) = ($connect_info->[0]=~m/^dbi\:.+\:(.+)$/);
+
+ my $key = $connect_info->[0];
+ $key = $key->{dsn} if ref $key && reftype $key eq 'HASH';
+ ($key) = ($key =~ m/^dbi\:.+\:(.+)$/);
+
$self->set_replicant( $key => $replicant);
push @newly_created, $replicant;
}
@@ -169,7 +184,20 @@
my ($self, $schema, $connect_info) = @_;
my $replicant = $self->create_replicant($schema);
$replicant->connect_info($connect_info);
- $self->_safely_ensure_connected($replicant);
+
+## It is undesirable for catalyst to connect at ->conect_replicants time, as
+## connections should only happen on the first request that uses the database.
+## So we try to set the driver without connecting, however this doesn't always
+## work, as a driver may need to connect to determine the DB version, and this
+## may fail.
+##
+## Why this is necessary at all, is that we need to have the final storage
+## class to apply the Replicant role.
+
+ $self->_safely($replicant, '->_determine_driver', sub {
+ $replicant->_determine_driver
+ });
+
DBIx::Class::Storage::DBI::Replicated::Replicant->meta->apply($replicant);
return $replicant;
}
@@ -180,21 +208,39 @@
connect. For the master database this is desirable, but since replicants are
allowed to fail, this behavior is not desirable. This method wraps the call
to ensure_connected in an eval in order to catch any generated errors. That
-way a slave to go completely offline (ie, the box itself can die) without
+way a slave can go completely offline (ie, the box itself can die) without
bringing down your entire pool of databases.
=cut
sub _safely_ensure_connected {
my ($self, $replicant, @args) = @_;
+
+ return $self->_safely($replicant, '->ensure_connected', sub {
+ $replicant->ensure_connected(@args)
+ });
+}
+
+=head2 _safely ($replicant, $name, $code)
+
+Execute C<$code> for operation C<$name> catching any exceptions and printing an
+error message to the C<<$replicant->debugobj>>.
+
+Returns 1 on success and undef on failure.
+
+=cut
+
+sub _safely {
+ my ($self, $replicant, $name, $code) = @_;
+
eval {
- $replicant->ensure_connected(@args);
+ $code->()
};
if ($@) {
$replicant
->debugobj
->print(
- sprintf( "Exception trying to ->ensure_connected for replicant %s, error is %s",
+ sprintf( "Exception trying to $name for replicant %s, error is %s",
$replicant->_dbi_connect_info->[0], $@)
);
return;
@@ -280,13 +326,13 @@
if($self->_safely_ensure_connected($replicant)) {
my $is_replicating = $replicant->is_replicating;
unless(defined $is_replicating) {
- $replicant->debugobj->print("Storage Driver ".ref $self." Does not support the 'is_replicating' method. Assuming you are manually managing.");
+ $replicant->debugobj->print("Storage Driver ".ref($self)." Does not support the 'is_replicating' method. Assuming you are manually managing.\n");
next;
} else {
if($is_replicating) {
my $lag_behind_master = $replicant->lag_behind_master;
unless(defined $lag_behind_master) {
- $replicant->debugobj->print("Storage Driver ".ref $self." Does not support the 'lag_behind_master' method. Assuming you are manually managing.");
+ $replicant->debugobj->print("Storage Driver ".ref($self)." Does not support the 'lag_behind_master' method. Assuming you are manually managing.\n");
next;
} else {
if($lag_behind_master <= $self->maximum_lag) {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,11 @@
use Moose::Role;
requires qw/_query_start/;
+with 'DBIx::Class::Storage::DBI::Replicated::WithDSN';
+use MooseX::Types::Moose 'Bool';
+use namespace::clean -except => 'meta';
+
=head1 NAME
DBIx::Class::Storage::DBI::Replicated::Replicant - A replicated DBI Storage Role
@@ -42,7 +46,7 @@
has 'active' => (
is=>'rw',
- isa=>'Bool',
+ isa=>Bool,
lazy=>1,
required=>1,
default=>1,
@@ -52,18 +56,6 @@
This class defines the following methods.
-=head2 around: _query_start
-
-advice iof the _query_start method to add more debuggin
-
-=cut
-
-around '_query_start' => sub {
- my ($method, $self, $sql, @bind) = @_;
- my $dsn = $self->_dbi_connect_info->[0];
- $self->$method("DSN: $dsn SQL: $sql", @bind);
-};
-
=head2 debugobj
Override the debugobj method to redirect this method call back to the master.
@@ -76,7 +68,8 @@
=head1 ALSO SEE
-L<<a href="http://en.wikipedia.org/wiki/Replicant">http://en.wikipedia.org/wiki/Replicant</a>>
+L<http://en.wikipedia.org/wiki/Replicant>,
+L<DBIx::Class::Storage::DBI::Replicated>
=head1 AUTHOR
@@ -88,4 +81,4 @@
=cut
-1;
\ No newline at end of file
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,47 @@
+package # hide from PAUSE
+ DBIx::Class::Storage::DBI::Replicated::Types;
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::Replicated::Types - Types used internally by
+L<DBIx::Class::Storage::DBI::Replicated>
+
+=cut
+
+use MooseX::Types
+ -declare => [qw/BalancerClassNamePart Weight/];
+use MooseX::Types::Moose qw/ClassName Str Num/;
+
+class_type 'DBIx::Class::Storage::DBI';
+class_type 'DBIx::Class::Schema';
+
+subtype BalancerClassNamePart,
+ as ClassName;
+
+coerce BalancerClassNamePart,
+ from Str,
+ via {
+ my $type = $_;
+ if($type=~m/^::/) {
+ $type = 'DBIx::Class::Storage::DBI::Replicated::Balancer'.$type;
+ }
+ Class::MOP::load_class($type);
+ $type;
+ };
+
+subtype Weight,
+ as Num,
+ where { $_ >= 0 },
+ message { 'weight must be a decimal greater than 0' };
+
+=head1 AUTHOR
+
+ John Napiorkowski <john.napiorkowski at takkle.com>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/WithDSN.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/WithDSN.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/WithDSN.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,51 @@
+package DBIx::Class::Storage::DBI::Replicated::WithDSN;
+
+use Moose::Role;
+requires qw/_query_start/;
+
+use namespace::clean -except => 'meta';
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::Replicated::WithDSN - A DBI Storage Role with DSN
+information in trace output
+
+=head1 SYNOPSIS
+
+This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.
+
+=head1 DESCRIPTION
+
+This role adds C<DSN: > info to storage debugging output.
+
+=head1 METHODS
+
+This class defines the following methods.
+
+=head2 around: _query_start
+
+Add C<DSN: > to debugging output.
+
+=cut
+
+around '_query_start' => sub {
+ my ($method, $self, $sql, @bind) = @_;
+ my $dsn = $self->_dbi_connect_info->[0];
+ $self->$method("DSN: $dsn SQL: $sql", @bind);
+};
+
+=head1 ALSO SEE
+
+L<DBIx::Class::Storage::DBI>
+
+=head1 AUTHOR
+
+John Napiorkowski <john.napiorkowski at takkle.com>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated/WithDSN.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -7,10 +7,11 @@
## use, so we explicitly test for these.
my %replication_required = (
- Moose => '0.54',
+ Moose => '0.77',
MooseX::AttributeHelpers => '0.12',
- Moose::Util::TypeConstraints => '0.54',
- Class::MOP => '0.63',
+ MooseX::Types => '0.10',
+ namespace::clean => '0.11',
+ Hash::Merge => '0.11'
);
my @didnt_load;
@@ -25,10 +26,18 @@
if @didnt_load;
}
+use Moose;
use DBIx::Class::Storage::DBI;
use DBIx::Class::Storage::DBI::Replicated::Pool;
use DBIx::Class::Storage::DBI::Replicated::Balancer;
+use DBIx::Class::Storage::DBI::Replicated::Types 'BalancerClassNamePart';
+use MooseX::Types::Moose qw/ClassName HashRef Object/;
+use Scalar::Util 'reftype';
+use Carp::Clan qw/^DBIx::Class/;
+use Hash::Merge 'merge';
+use namespace::clean -except => 'meta';
+
=head1 NAME
DBIx::Class::Storage::DBI::Replicated - BETA Replicated database support
@@ -99,10 +108,11 @@
Replicated Storage has additional requirements not currently part of L<DBIx::Class>
- Moose => 0.54
+ Moose => 0.77
MooseX::AttributeHelpers => 0.12
- Moose::Util::TypeConstraints => 0.54
- Class::MOP => 0.63
+ MooseX::Types => 0.10
+ namespace::clean => 0.11
+ Hash::Merge => 0.11
You will need to install these modules manually via CPAN or make them part of the
Makefile for your distribution.
@@ -132,9 +142,8 @@
=cut
has 'pool_type' => (
- is=>'ro',
- isa=>'ClassName',
- required=>1,
+ is=>'rw',
+ isa=>ClassName,
default=>'DBIx::Class::Storage::DBI::Replicated::Pool',
handles=>{
'create_pool' => 'new',
@@ -149,10 +158,9 @@
=cut
has 'pool_args' => (
- is=>'ro',
- isa=>'HashRef',
+ is=>'rw',
+ isa=>HashRef,
lazy=>1,
- required=>1,
default=>sub { {} },
);
@@ -164,23 +172,9 @@
=cut
-subtype 'DBIx::Class::Storage::DBI::Replicated::BalancerClassNamePart',
- as 'ClassName';
-
-coerce 'DBIx::Class::Storage::DBI::Replicated::BalancerClassNamePart',
- from 'Str',
- via {
- my $type = $_;
- if($type=~m/^::/) {
- $type = 'DBIx::Class::Storage::DBI::Replicated::Balancer'.$type;
- }
- Class::MOP::load_class($type);
- $type;
- };
-
has 'balancer_type' => (
- is=>'ro',
- isa=>'DBIx::Class::Storage::DBI::Replicated::BalancerClassNamePart',
+ is=>'rw',
+ isa=>BalancerClassNamePart,
coerce=>1,
required=>1,
default=> 'DBIx::Class::Storage::DBI::Replicated::Balancer::First',
@@ -197,8 +191,8 @@
=cut
has 'balancer_args' => (
- is=>'ro',
- isa=>'HashRef',
+ is=>'rw',
+ isa=>HashRef,
lazy=>1,
required=>1,
default=>sub { {} },
@@ -230,7 +224,7 @@
=cut
has 'balancer' => (
- is=>'ro',
+ is=>'rw',
isa=>'DBIx::Class::Storage::DBI::Replicated::Balancer',
lazy_build=>1,
handles=>[qw/auto_validate_every/],
@@ -265,7 +259,7 @@
has 'read_handler' => (
is=>'rw',
- isa=>'Object',
+ isa=>Object,
lazy_build=>1,
handles=>[qw/
select
@@ -282,9 +276,8 @@
has 'write_handler' => (
is=>'ro',
- isa=>'Object',
+ isa=>Object,
lazy_build=>1,
- lazy_build=>1,
handles=>[qw/
on_connect_do
on_disconnect_do
@@ -317,6 +310,70 @@
/],
);
+has _master_connect_info_opts =>
+ (is => 'rw', isa => HashRef, default => sub { {} });
+
+=head2 around: connect_info
+
+Preserve master's C<connect_info> options (for merging with replicants.)
+Also set any Replicated related options from connect_info, such as
+C<pool_type>, C<pool_args>, C<balancer_type> and C<balancer_args>.
+
+=cut
+
+around connect_info => sub {
+ my ($next, $self, $info, @extra) = @_;
+
+ my $wantarray = wantarray;
+
+ my %opts;
+ for my $arg (@$info) {
+ next unless (reftype($arg)||'') eq 'HASH';
+ %opts = %{ merge($arg, \%opts) };
+ }
+ delete $opts{dsn};
+
+ if (@opts{qw/pool_type pool_args/}) {
+ $self->pool_type(delete $opts{pool_type})
+ if $opts{pool_type};
+
+ $self->pool_args(
+ merge((delete $opts{pool_args} || {}), $self->pool_args)
+ );
+
+ $self->pool($self->_build_pool)
+ if $self->pool;
+ }
+
+ if (@opts{qw/balancer_type balancer_args/}) {
+ $self->balancer_type(delete $opts{balancer_type})
+ if $opts{balancer_type};
+
+ $self->balancer_args(
+ merge((delete $opts{balancer_args} || {}), $self->balancer_args)
+ );
+
+ $self->balancer($self->_build_balancer)
+ if $self->balancer;
+ }
+
+ $self->_master_connect_info_opts(\%opts);
+
+ my (@res, $res);
+ if ($wantarray) {
+ @res = $self->$next($info, @extra);
+ } else {
+ $res = $self->$next($info, @extra);
+ }
+
+ # May have to reapply role if master will be reblessed to a more specific
+ # driver.
+ $self->master->_determine_driver;
+ DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($self->master);
+
+ $wantarray ? @res : $res;
+};
+
=head1 METHODS
This class defines the following methods.
@@ -347,7 +404,9 @@
sub _build_master {
my $self = shift @_;
- DBIx::Class::Storage::DBI->new($self->schema);
+ my $master = DBIx::Class::Storage::DBI->new($self->schema);
+ DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($master);
+ $master
}
=head2 _build_pool
@@ -402,13 +461,49 @@
=head2 around: connect_replicants
All calls to connect_replicants needs to have an existing $schema tacked onto
-top of the args, since L<DBIx::Storage::DBI> needs it.
+top of the args, since L<DBIx::Storage::DBI> needs it, and any C<connect_info>
+options merged with the master, with replicant opts having higher priority.
=cut
-around 'connect_replicants' => sub {
- my ($method, $self, @args) = @_;
- $self->$method($self->schema, @args);
+around connect_replicants => sub {
+ my ($next, $self, @args) = @_;
+
+ for my $r (@args) {
+ $r = [ $r ] unless reftype $r eq 'ARRAY';
+
+ croak "coderef replicant connect_info not supported"
+ if ref $r->[0] && reftype $r->[0] eq 'CODE';
+
+# any connect_info options?
+ my $i = 0;
+ $i++ while $i < @$r && (reftype($r->[$i])||'') ne 'HASH';
+
+# make one if none
+ $r->[$i] = {} unless $r->[$i];
+
+# merge if two hashes
+ my @hashes = @$r[$i .. $#{$r}];
+
+ croak "invalid connect_info options"
+ if (grep { reftype($_) eq 'HASH' } @hashes) != @hashes;
+
+ croak "too many hashrefs in connect_info"
+ if @hashes > 2;
+
+ my %opts = %{ merge(reverse @hashes) };
+
+# delete them
+ splice @$r, $i+1, ($#{$r} - $i), ();
+
+# merge with master
+ %opts = %{ merge(\%opts, $self->_master_connect_info_opts) };
+
+# update
+ $r->[$i] = \%opts;
+ }
+
+ $self->$next($self->schema, @args);
};
=head2 all_storages
@@ -423,7 +518,7 @@
my $self = shift @_;
return grep {defined $_ && blessed $_} (
$self->master,
- $self->replicants,
+ values %{ $self->replicants },
);
}
@@ -693,6 +788,21 @@
}
}
+=head2 cursor_class
+
+set cursor class on all storages, or return master's
+
+=cut
+
+sub cursor_class {
+ my ($self, $cursor_class) = @_;
+
+ if ($cursor_class) {
+ $_->cursor_class($cursor_class) for $self->all_storages;
+ }
+ $self->master->cursor_class;
+}
+
=head1 GOTCHAS
Due to the fact that replicants can lag behind a master, you must take care to
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Replicated.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Role/QueryCounter.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/SQLite.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/SQLite.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -6,7 +6,7 @@
use File::Copy;
use File::Spec;
-use base qw/DBIx::Class::Storage::DBI::MultiDistinctEmulation/;
+use base qw/DBIx::Class::Storage::DBI/;
sub _dbh_last_insert_id {
my ($self, $dbh, $source, $col) = @_;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/SQLite.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,16 +3,32 @@
use strict;
use warnings;
-use Class::C3;
-use base qw/DBIx::Class::Storage::DBI::MSSQL DBIx::Class::Storage::DBI::Sybase/;
+use Carp::Clan qw/^DBIx::Class/;
+carp 'Setting of storage_type is redundant as connections through DBD::Sybase'
+ .' are now properly recognized and reblessed into the appropriate subclass'
+ .' (DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server in the'
+ .' case of MSSQL). Please remove the explicit call to'
+ .q/ $schema->storage_type('::DBI::Sybase::MSSQL')/
+ .', as this storage class has been deprecated in favor of the autodetected'
+ .' ::DBI::Sybase::Microsoft_SQL_Server';
+
+
+use base qw/DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server/;
+
1;
=head1 NAME
-DBIx::Class::Storage::DBI::Sybase::MSSQL - Storage::DBI subclass for MSSQL via
-DBD::Sybase
+DBIx::Class::Storage::DBI::Sybase::MSSQL - (DEPRECATED) Legacy storage class for MSSQL via DBD::Sybase
+=head1 NOTE
+
+Connections through DBD::Sybase are now correctly recognized and reblessed
+into the appropriate subclass (L<DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server>
+in the case of MSSQL). Please remove the explicit storage_type setting from your
+schema.
+
=head1 SYNOPSIS
This subclass supports MSSQL connected via L<DBD::Sybase>.
@@ -29,6 +45,8 @@
Brandon L Black <blblack at gmail.com>
+Justin Hunter <justin.d.hunter at gmail.com>
+
=head1 LICENSE
You may distribute this code under the same terms as Perl itself.
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm (from rev 5335, DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm)
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,41 @@
+package DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
+
+use strict;
+use warnings;
+
+use base qw/
+ DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server
+ DBIx::Class::Storage::DBI::Sybase
+/;
+
+1;
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Storage::DBI subclass for MSSQL via
+DBD::Sybase
+
+=head1 SYNOPSIS
+
+This subclass supports MSSQL server connections via L<DBD::Sybase>.
+
+=head1 CAVEATS
+
+This storage driver uses L<DBIx::Class::Storage::DBI::NoBindVars> as a base.
+This means that bind variables will be interpolated (properly quoted of course)
+into the SQL query itself, without using bind placeholders.
+
+More importantly this means that caching of prepared statements is explicitly
+disabled, as the interpolation renders it useless.
+
+=head1 AUTHORS
+
+Brandon L Black <blblack at gmail.com>
+
+Justin Hunter <justin.d.hunter at gmail.com>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -5,6 +5,25 @@
use base qw/DBIx::Class::Storage::DBI::NoBindVars/;
+sub _rebless {
+ my $self = shift;
+
+ my $dbtype = eval { @{$self->dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2] };
+ unless ( $@ ) {
+ $dbtype =~ s/\W/_/gi;
+ my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}";
+ if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
+ bless $self, $subclass;
+ $self->_rebless;
+ }
+ }
+}
+
+sub _dbh_last_insert_id {
+ my ($self, $dbh, $source, $col) = @_;
+ return ($dbh->selectrow_array('select @@identity'))[0];
+}
+
1;
=head1 NAME
@@ -17,10 +36,21 @@
you are using an MSSQL database via L<DBD::Sybase>, see
L<DBIx::Class::Storage::DBI::Sybase::MSSQL>.
+=head1 CAVEATS
+
+This storage driver uses L<DBIx::Class::Storage::DBI::NoBindVars> as a base.
+This means that bind variables will be interpolated (properly quoted of course)
+into the SQL query itself, without using bind placeholders.
+
+More importantly this means that caching of prepared statements is explicitly
+disabled, as the interpolation renders it useless.
+
=head1 AUTHORS
Brandon L Black <blblack at gmail.com>
+Justin Hunter <justin.d.hunter at gmail.com>
+
=head1 LICENSE
You may distribute this code under the same terms as Perl itself.
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/Sybase.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/mysql.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/mysql.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/mysql.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use base qw/DBIx::Class::Storage::DBI/;
+use base qw/DBIx::Class::Storage::DBI::MultiColumnIn/;
# __PACKAGE__->load_components(qw/PK::Auto/);
@@ -51,6 +51,12 @@
return shift->dbh->selectrow_hashref('show slave status')->{Seconds_Behind_Master};
}
+# MySql can not do subquery update/deletes, only way is slow per-row operations.
+# This assumes you have proper privilege separation and use innodb.
+sub subq_update_delete {
+ return shift->_per_row_update_delete (@_);
+}
+
1;
=head1 NAME
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI/mysql.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -7,7 +7,7 @@
use warnings;
use Carp::Clan qw/^DBIx::Class/;
use DBI;
-use SQL::Abstract::Limit;
+use DBIx::Class::SQLAHacks;
use DBIx::Class::Storage::DBI::Cursor;
use DBIx::Class::Storage::Statistics;
use Scalar::Util qw/blessed weaken/;
@@ -29,327 +29,9 @@
__PACKAGE__->cursor_class('DBIx::Class::Storage::DBI::Cursor');
__PACKAGE__->mk_group_accessors('inherited' => qw/sql_maker_class/);
-__PACKAGE__->sql_maker_class('DBIC::SQL::Abstract');
+__PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks');
-BEGIN {
-package # Hide from PAUSE
- DBIC::SQL::Abstract; # Would merge upstream, but nate doesn't reply :(
-
-use base qw/SQL::Abstract::Limit/;
-
-# This prevents the caching of $dbh in S::A::L, I believe
-sub new {
- my $self = shift->SUPER::new(@_);
-
- # If limit_dialect is a ref (like a $dbh), go ahead and replace
- # it with what it resolves to:
- $self->{limit_dialect} = $self->_find_syntax($self->{limit_dialect})
- if ref $self->{limit_dialect};
-
- $self;
-}
-
-# DB2 is the only remaining DB using this. Even though we are not sure if
-# RowNumberOver is still needed here (should be part of SQLA) leave the
-# code in place
-sub _RowNumberOver {
- my ($self, $sql, $order, $rows, $offset ) = @_;
-
- $offset += 1;
- my $last = $rows + $offset;
- my ( $order_by ) = $self->_order_by( $order );
-
- $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
-
-SQL
-
- return $sql;
-}
-
-
-# While we're at it, this should make LIMIT queries more efficient,
-# without digging into things too deeply
-use Scalar::Util 'blessed';
-sub _find_syntax {
- my ($self, $syntax) = @_;
-
- # DB2 is the only remaining DB using this. Even though we are not sure if
- # RowNumberOver is still needed here (should be part of SQLA) leave the
- # code in place
- my $dbhname = blessed($syntax) ? $syntax->{Driver}{Name} : $syntax;
- if(ref($self) && $dbhname && $dbhname eq 'DB2') {
- return 'RowNumberOver';
- }
-
- $self->{_cached_syntax} ||= $self->SUPER::_find_syntax($syntax);
-}
-
-sub select {
- my ($self, $table, $fields, $where, $order, @rest) = @_;
- if (ref $table eq 'SCALAR') {
- $table = $$table;
- }
- elsif (not ref $table) {
- $table = $self->_quote($table);
- }
- local $self->{rownum_hack_count} = 1
- if (defined $rest[0] && $self->{limit_dialect} eq 'RowNum');
- @rest = (-1) unless defined $rest[0];
- die "LIMIT 0 Does Not Compute" if $rest[0] == 0;
- # and anyway, SQL::Abstract::Limit will cause a barf if we don't first
- local $self->{having_bind} = [];
- my ($sql, @ret) = $self->SUPER::select(
- $table, $self->_recurse_fields($fields), $where, $order, @rest
- );
- $sql .=
- $self->{for} ?
- (
- $self->{for} eq 'update' ? ' FOR UPDATE' :
- $self->{for} eq 'shared' ? ' FOR SHARE' :
- ''
- ) :
- ''
- ;
- return wantarray ? ($sql, @ret, @{$self->{having_bind}}) : $sql;
-}
-
-sub insert {
- my $self = shift;
- my $table = shift;
- $table = $self->_quote($table) unless ref($table);
- $self->SUPER::insert($table, @_);
-}
-
-sub update {
- my $self = shift;
- my $table = shift;
- $table = $self->_quote($table) unless ref($table);
- $self->SUPER::update($table, @_);
-}
-
-sub delete {
- my $self = shift;
- my $table = shift;
- $table = $self->_quote($table) unless ref($table);
- $self->SUPER::delete($table, @_);
-}
-
-sub _emulate_limit {
- my $self = shift;
- if ($_[3] == -1) {
- return $_[1].$self->_order_by($_[2]);
- } else {
- return $self->SUPER::_emulate_limit(@_);
- }
-}
-
-sub _recurse_fields {
- my ($self, $fields, $params) = @_;
- my $ref = ref $fields;
- return $self->_quote($fields) unless $ref;
- return $$fields if $ref eq 'SCALAR';
-
- if ($ref eq 'ARRAY') {
- return join(', ', map {
- $self->_recurse_fields($_)
- .(exists $self->{rownum_hack_count} && !($params && $params->{no_rownum_hack})
- ? ' AS col'.$self->{rownum_hack_count}++
- : '')
- } @$fields);
- } elsif ($ref eq 'HASH') {
- foreach my $func (keys %$fields) {
- return $self->_sqlcase($func)
- .'( '.$self->_recurse_fields($fields->{$func}).' )';
- }
- }
- # Is the second check absolutely necessary?
- elsif ( $ref eq 'REF' and ref($$fields) eq 'ARRAY' ) {
- return $self->_bind_to_sql( $fields );
- }
- else {
- Carp::croak($ref . qq{ unexpected in _recurse_fields()})
- }
-}
-
-sub _order_by {
- my $self = shift;
- my $ret = '';
- my @extra;
- if (ref $_[0] eq 'HASH') {
- if (defined $_[0]->{group_by}) {
- $ret = $self->_sqlcase(' group by ')
- .$self->_recurse_fields($_[0]->{group_by}, { no_rownum_hack => 1 });
- }
- if (defined $_[0]->{having}) {
- my $frag;
- ($frag, @extra) = $self->_recurse_where($_[0]->{having});
- push(@{$self->{having_bind}}, @extra);
- $ret .= $self->_sqlcase(' having ').$frag;
- }
- if (defined $_[0]->{order_by}) {
- $ret .= $self->_order_by($_[0]->{order_by});
- }
- if (grep { $_ =~ /^-(desc|asc)/i } keys %{$_[0]}) {
- return $self->SUPER::_order_by($_[0]);
- }
- } elsif (ref $_[0] eq 'SCALAR') {
- $ret = $self->_sqlcase(' order by ').${ $_[0] };
- } elsif (ref $_[0] eq 'ARRAY' && @{$_[0]}) {
- my @order = @{+shift};
- $ret = $self->_sqlcase(' order by ')
- .join(', ', map {
- my $r = $self->_order_by($_, @_);
- $r =~ s/^ ?ORDER BY //i;
- $r;
- } @order);
- } else {
- $ret = $self->SUPER::_order_by(@_);
- }
- return $ret;
-}
-
-sub _order_directions {
- my ($self, $order) = @_;
- $order = $order->{order_by} if ref $order eq 'HASH';
- return $self->SUPER::_order_directions($order);
-}
-
-sub _table {
- my ($self, $from) = @_;
- if (ref $from eq 'ARRAY') {
- return $self->_recurse_from(@$from);
- } elsif (ref $from eq 'HASH') {
- return $self->_make_as($from);
- } else {
- return $from; # would love to quote here but _table ends up getting called
- # twice during an ->select without a limit clause due to
- # the way S::A::Limit->select works. should maybe consider
- # bypassing this and doing S::A::select($self, ...) in
- # our select method above. meantime, quoting shims have
- # been added to select/insert/update/delete here
- }
-}
-
-sub _recurse_from {
- my ($self, $from, @join) = @_;
- my @sqlf;
- push(@sqlf, $self->_make_as($from));
- foreach my $j (@join) {
- my ($to, $on) = @$j;
-
- # check whether a join type exists
- my $join_clause = '';
- my $to_jt = ref($to) eq 'ARRAY' ? $to->[0] : $to;
- if (ref($to_jt) eq 'HASH' and exists($to_jt->{-join_type})) {
- $join_clause = ' '.uc($to_jt->{-join_type}).' JOIN ';
- } else {
- $join_clause = ' JOIN ';
- }
- push(@sqlf, $join_clause);
-
- if (ref $to eq 'ARRAY') {
- push(@sqlf, '(', $self->_recurse_from(@$to), ')');
- } else {
- push(@sqlf, $self->_make_as($to));
- }
- push(@sqlf, ' ON ', $self->_join_condition($on));
- }
- return join('', @sqlf);
-}
-
-sub _bind_to_sql {
- my $self = shift;
- my $arr = shift;
- my $sql = shift @$$arr;
- $sql =~ s/\?/$self->_quote((shift @$$arr)->[1])/eg;
- return $sql
-}
-
-sub _make_as {
- my ($self, $from) = @_;
- return join(' ', map { (ref $_ eq 'SCALAR' ? $$_
- : ref $_ eq 'REF' ? $self->_bind_to_sql($_)
- : $self->_quote($_))
- } reverse each %{$self->_skip_options($from)});
-}
-
-sub _skip_options {
- my ($self, $hash) = @_;
- my $clean_hash = {};
- $clean_hash->{$_} = $hash->{$_}
- for grep {!/^-/} keys %$hash;
- return $clean_hash;
-}
-
-sub _join_condition {
- my ($self, $cond) = @_;
- if (ref $cond eq 'HASH') {
- my %j;
- for (keys %$cond) {
- my $v = $cond->{$_};
- if (ref $v) {
- # XXX no throw_exception() in this package and croak() fails with strange results
- Carp::croak(ref($v) . qq{ reference arguments are not supported in JOINS - try using \"..." instead'})
- if ref($v) ne 'SCALAR';
- $j{$_} = $v;
- }
- else {
- my $x = '= '.$self->_quote($v); $j{$_} = \$x;
- }
- };
- return scalar($self->_recurse_where(\%j));
- } elsif (ref $cond eq 'ARRAY') {
- return join(' OR ', map { $self->_join_condition($_) } @$cond);
- } else {
- die "Can't handle this yet!";
- }
-}
-
-sub _quote {
- my ($self, $label) = @_;
- return '' unless defined $label;
- return "*" if $label eq '*';
- return $label unless $self->{quote_char};
- if(ref $self->{quote_char} eq "ARRAY"){
- return $self->{quote_char}->[0] . $label . $self->{quote_char}->[1]
- if !defined $self->{name_sep};
- my $sep = $self->{name_sep};
- return join($self->{name_sep},
- map { $self->{quote_char}->[0] . $_ . $self->{quote_char}->[1] }
- split(/\Q$sep\E/,$label));
- }
- return $self->SUPER::_quote($label);
-}
-
-sub limit_dialect {
- my $self = shift;
- $self->{limit_dialect} = shift if @_;
- return $self->{limit_dialect};
-}
-
-sub quote_char {
- my $self = shift;
- $self->{quote_char} = shift if @_;
- return $self->{quote_char};
-}
-
-sub name_sep {
- my $self = shift;
- $self->{name_sep} = shift if @_;
- return $self->{name_sep};
-}
-
-} # End of BEGIN block
-
=head1 NAME
DBIx::Class::Storage::DBI - DBI storage handler
@@ -471,6 +153,10 @@
=over
+=item a scalar
+
+This contains one SQL statement to execute.
+
=item an array reference
This contains SQL statements to execute in order. Each element contains
@@ -928,35 +614,56 @@
my @info = @{$self->_dbi_connect_info || []};
$self->_dbh($self->_connect(@info));
+ $self->_conn_pid($$);
+ $self->_conn_tid(threads->tid) if $INC{'threads.pm'};
+
+ $self->_determine_driver;
+
# Always set the transaction depth on connect, since
# there is no transaction in progress by definition
$self->{transaction_depth} = $self->_dbh_autocommit ? 0 : 1;
- if(ref $self eq 'DBIx::Class::Storage::DBI') {
- my $driver = $self->_dbh->{Driver}->{Name};
+ my $connection_do = $self->on_connect_do;
+ $self->_do_connection_actions($connection_do) if $connection_do;
+}
+
+sub _determine_driver {
+ my ($self) = @_;
+
+ if (ref $self eq 'DBIx::Class::Storage::DBI') {
+ my $driver;
+
+ if ($self->_dbh) { # we are connected
+ $driver = $self->_dbh->{Driver}{Name};
+ } else {
+ # try to use dsn to not require being connected, the driver may still
+ # force a connection in _rebless to determine version
+ ($driver) = $self->_dbi_connect_info->[0] =~ /dbi:([^:]+):/i;
+ }
+
if ($self->load_optional_class("DBIx::Class::Storage::DBI::${driver}")) {
bless $self, "DBIx::Class::Storage::DBI::${driver}";
$self->_rebless();
}
}
-
- $self->_conn_pid($$);
- $self->_conn_tid(threads->tid) if $INC{'threads.pm'};
-
- my $connection_do = $self->on_connect_do;
- $self->_do_connection_actions($connection_do) if ref($connection_do);
}
sub _do_connection_actions {
my $self = shift;
my $connection_do = shift;
- if (ref $connection_do eq 'ARRAY') {
+ if (!ref $connection_do) {
+ $self->_do_query($connection_do);
+ }
+ elsif (ref $connection_do eq 'ARRAY') {
$self->_do_query($_) foreach @$connection_do;
}
elsif (ref $connection_do eq 'CODE') {
$connection_do->($self);
}
+ else {
+ $self->throw_exception (sprintf ("Don't know how to process conection actions of type '%s'", ref $connection_do) );
+ }
return $self;
}
@@ -1321,14 +1028,8 @@
# @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
## This must be an arrayref, else nothing works!
-
my $tuple_status = [];
-
- ##use Data::Dumper;
- ##print STDERR Dumper( $data, $sql, [@bind] );
- my $time = time();
-
## Get the bind_attributes, if any exist
my $bind_attributes = $self->source_bind_attributes($source);
@@ -1375,6 +1076,92 @@
return $self->_execute('delete' => [], $source, $bind_attrs, @_);
}
+# We were sent here because the $rs contains a complex search
+# which will require a subquery to select the correct rows
+# (i.e. joined or limited resultsets)
+#
+# Genarating a single PK column subquery is trivial and supported
+# by all RDBMS. However if we have a multicolumn PK, things get ugly.
+# Look at _multipk_update_delete()
+sub subq_update_delete {
+ my $self = shift;
+ my ($rs, $op, $values) = @_;
+
+ my $rsrc = $rs->result_source;
+
+ # we already check this, but double check naively just in case. Should be removed soon
+ my $sel = $rs->_resolved_attrs->{select};
+ $sel = [ $sel ] unless ref $sel eq 'ARRAY';
+ my @pcols = $rsrc->primary_columns;
+ if (@$sel != @pcols) {
+ $self->throw_exception (
+ 'Subquery update/delete can not be called on resultsets selecting a'
+ .' number of columns different than the number of primary keys'
+ );
+ }
+
+ if (@pcols == 1) {
+ return $self->$op (
+ $rsrc,
+ $op eq 'update' ? $values : (),
+ { $pcols[0] => { -in => $rs->as_query } },
+ );
+ }
+
+ else {
+ return $self->_multipk_update_delete (@_);
+ }
+}
+
+# ANSI SQL does not provide a reliable way to perform a multicol-PK
+# resultset update/delete involving subqueries. So by default resort
+# to simple (and inefficient) delete_all style per-row opearations,
+# while allowing specific storages to override this with a faster
+# implementation.
+#
+sub _multipk_update_delete {
+ return shift->_per_row_update_delete (@_);
+}
+
+# This is the default loop used to delete/update rows for multi PK
+# resultsets, and used by mysql exclusively (because it can't do anything
+# else).
+#
+# We do not use $row->$op style queries, because resultset update/delete
+# is not expected to cascade (this is what delete_all/update_all is for).
+#
+# There should be no race conditions as the entire operation is rolled
+# in a transaction.
+#
+sub _per_row_update_delete {
+ my $self = shift;
+ my ($rs, $op, $values) = @_;
+
+ my $rsrc = $rs->result_source;
+ my @pcols = $rsrc->primary_columns;
+
+ my $guard = $self->txn_scope_guard;
+
+ my $subrs_cur = $rs->cursor;
+ while (my @pks = $subrs_cur->next) {
+
+ my $cond;
+ for my $i (0.. $#pcols) {
+ $cond->{$pcols[$i]} = $pks[$i];
+ }
+
+ $self->$op (
+ $rsrc,
+ $op eq 'update' ? $values : (),
+ $cond,
+ );
+ }
+
+ $guard->commit;
+
+ return 1;
+}
+
sub _select {
my $self = shift;
my $sql_maker = $self->sql_maker;
@@ -1400,7 +1187,7 @@
my $bind_attrs = {}; ## Future support
my @args = ('select', $attrs->{bind}, $ident, $bind_attrs, $select, $condition, $order);
if ($attrs->{software_limit} ||
- $self->sql_maker->_default_limit_syntax eq "GenericSubQ") {
+ $sql_maker->_default_limit_syntax eq "GenericSubQ") {
$attrs->{software_limit} = 1;
} else {
$self->throw_exception("rows attribute must be positive if present")
@@ -1626,7 +1413,7 @@
my ($self, $schema, $databases, $version, $dir, $preversion, $sqltargs) = @_;
if(!$dir || !-d $dir) {
- warn "No directory given, using ./\n";
+ carp "No directory given, using ./\n";
$dir = "./";
}
$databases ||= ['MySQL', 'SQLite', 'PostgreSQL'];
@@ -1649,7 +1436,8 @@
my $sqlt = SQL::Translator->new( $sqltargs );
$sqlt->parser('SQL::Translator::Parser::DBIx::Class');
- my $sqlt_schema = $sqlt->translate({ data => $schema }) or die $sqlt->error;
+ my $sqlt_schema = $sqlt->translate({ data => $schema })
+ or $self->throw_exception ($sqlt->error);
foreach my $db (@$databases) {
$sqlt->reset();
@@ -1660,13 +1448,13 @@
my $filename = $schema->ddl_filename($db, $version, $dir);
if (-e $filename && ($version eq $schema_version )) {
# if we are dumping the current version, overwrite the DDL
- warn "Overwriting existing DDL file - $filename";
+ carp "Overwriting existing DDL file - $filename";
unlink($filename);
}
my $output = $sqlt->translate;
if(!$output) {
- warn("Failed to translate to $db, skipping. (" . $sqlt->error . ")");
+ carp("Failed to translate to $db, skipping. (" . $sqlt->error . ")");
next;
}
if(!open($file, ">$filename")) {
@@ -1682,13 +1470,13 @@
my $prefilename = $schema->ddl_filename($db, $preversion, $dir);
if(!-e $prefilename) {
- warn("No previous schema file found ($prefilename)");
+ carp("No previous schema file found ($prefilename)");
next;
}
my $difffile = $schema->ddl_filename($db, $version, $dir, $preversion);
if(-e $difffile) {
- warn("Overwriting existing diff file - $difffile");
+ carp("Overwriting existing diff file - $difffile");
unlink($difffile);
}
@@ -1697,26 +1485,37 @@
my $t = SQL::Translator->new($sqltargs);
$t->debug( 0 );
$t->trace( 0 );
- $t->parser( $db ) or die $t->error;
- my $out = $t->translate( $prefilename ) or die $t->error;
+
+ $t->parser( $db )
+ or $self->throw_exception ($t->error);
+
+ my $out = $t->translate( $prefilename )
+ or $self->throw_exception ($t->error);
+
$source_schema = $t->schema;
- unless ( $source_schema->name ) {
- $source_schema->name( $prefilename );
- }
+
+ $source_schema->name( $prefilename )
+ unless ( $source_schema->name );
}
# The "new" style of producers have sane normalization and can support
# diffing a SQL file against a DBIC->SQLT schema. Old style ones don't
# And we have to diff parsed SQL against parsed SQL.
my $dest_schema = $sqlt_schema;
-
+
unless ( "SQL::Translator::Producer::$db"->can('preprocess_schema') ) {
my $t = SQL::Translator->new($sqltargs);
$t->debug( 0 );
$t->trace( 0 );
- $t->parser( $db ) or die $t->error;
- my $out = $t->translate( $filename ) or die $t->error;
+
+ $t->parser( $db )
+ or $self->throw_exception ($t->error);
+
+ my $out = $t->translate( $filename )
+ or $self->throw_exception ($t->error);
+
$dest_schema = $t->schema;
+
$dest_schema->name( $filename )
unless $dest_schema->name;
}
@@ -1808,7 +1607,7 @@
$self->dbh->do($line); # shouldn't be using ->dbh ?
};
if ($@) {
- warn qq{$@ (running "${line}")};
+ carp qq{$@ (running "${line}")};
}
$self->_query_end($line);
};
@@ -1930,38 +1729,7 @@
be with raw DBI.
-=head1 SQL METHODS
-The module defines a set of methods within the DBIC::SQL::Abstract
-namespace. These build on L<SQL::Abstract::Limit> to provide the
-SQL query functions.
-
-The following methods are extended:-
-
-=over 4
-
-=item delete
-
-=item insert
-
-=item select
-
-=item update
-
-=item limit_dialect
-
-See L</connect_info> for details.
-
-=item quote_char
-
-See L</connect_info> for details.
-
-=item name_sep
-
-See L</connect_info> for details.
-
-=back
-
=head1 AUTHORS
Matt S. Trout <mst at shadowcatsystems.co.uk>
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/DBI.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/Statistics.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/Statistics.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/Statistics.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -5,7 +5,7 @@
use base qw/Class::Accessor::Grouped/;
use IO::File;
-__PACKAGE__->mk_group_accessors(simple => qw/callback debugfh/);
+__PACKAGE__->mk_group_accessors(simple => qw/callback debugfh silence/);
=head1 NAME
@@ -56,6 +56,8 @@
sub print {
my ($self, $msg) = @_;
+ return if $self->silence;
+
if(!defined($self->debugfh())) {
my $fh;
my $debug_env = $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}
@@ -75,6 +77,10 @@
$self->debugfh->print($msg);
}
+=head2 silence
+
+Turn off all output if set to true.
+
=head2 txn_begin
Called when a transaction begins.
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/Statistics.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/TxnScopeGuard.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/TxnScopeGuard.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/TxnScopeGuard.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,6 +2,7 @@
use strict;
use warnings;
+use Carp ();
sub new {
my ($class, $storage) = @_;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage/TxnScopeGuard.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -328,7 +328,7 @@
=head2 sql_maker
Returns a C<sql_maker> object - normally an object of class
-C<DBIC::SQL::Abstract>.
+C<DBIx::Class::SQLAHacks>.
=cut
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/Storage.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class/UTF8Columns.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -8,13 +8,13 @@
use DBIx::Class::StartupCheck;
-sub mk_classdata {
+sub mk_classdata {
shift->mk_classaccessor(@_);
}
sub mk_classaccessor {
my $self = shift;
- $self->mk_group_accessors('inherited', $_[0]);
+ $self->mk_group_accessors('inherited', $_[0]);
$self->set_inherited(@_) if @_ > 1;
}
@@ -239,6 +239,8 @@
dyfrgi: Michael Leuchtenburg <michael at slashhome.org>
+frew: Arthur Axel "fREW" Schmidt <frioux at gmail.com>
+
gphat: Cory G Watson <gphat at cpan.org>
groditi: Guillermo Roditi <groditi at cpan.org>
@@ -275,6 +277,8 @@
ningu: David Kamholz <dkamholz at cpan.org>
+Nniuq: Ron "Quinn" Straight" <quinnfazigu at gmail.org>
+
norbi: Norbert Buchmuller <norbi at nix.hu>
Numa: Dan Sully <daniel at cpan.org>
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/DBIx/Class.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Parser/DBIx/Class.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Parser/DBIx/Class.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -13,7 +13,6 @@
$DEBUG = 0 unless defined $DEBUG;
use Exporter;
-use Data::Dumper;
use SQL::Translator::Utils qw(debug normalize_name);
use base qw(Exporter);
@@ -114,7 +113,7 @@
my @primary = $source->primary_columns;
my %unique_constraints = $source->unique_constraints;
foreach my $uniq (sort keys %unique_constraints) {
- if (!$source->compare_relationship_keys($unique_constraints{$uniq}, \@primary)) {
+ if (!$source->_compare_relationship_keys($unique_constraints{$uniq}, \@primary)) {
$table->add_constraint(
type => 'unique',
name => $uniq,
@@ -168,7 +167,7 @@
# this is supposed to indicate a has_one/might_have...
# where's the introspection!!?? :)
else {
- $fk_constraint = not $source->compare_relationship_keys(\@keys, \@primary);
+ $fk_constraint = not $source->_compare_relationship_keys(\@keys, \@primary);
}
my $cascade;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Parser/DBIx/Class.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Producer/DBIx/Class/File.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Producer/DBIx/Class/File.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Producer/DBIx/Class/File.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -25,6 +25,7 @@
use SQL::Translator::Schema::Constants;
use SQL::Translator::Utils qw(header_comment);
+use Data::Dumper ();
## Skip all column type translation, as we want to use whatever the parser got.
Property changes on: DBIx-Class/0.08/branches/multi_stuff/lib/SQL/Translator/Producer/DBIx/Class/File.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/benchmark_hashrefinflator.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/gen-pod-index.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/gen-schema.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/gen-tests.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/inheritance_pod.pl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/steal-svn-log.sh
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/maint/svn-log.perl
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/script/dbicadmin
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/02pod.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/03podcoverage.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/03podcoverage.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/03podcoverage.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -34,6 +34,15 @@
qw( MULTICREATE_DEBUG )
],
},
+ 'DBIx::Class::ResultSource' => {
+ ignore => [qw/
+ compare_relationship_keys
+ pk_depends_on
+ resolve_condition
+ resolve_join
+ resolve_prefetch
+ /],
+ },
'DBIx::Class::Storage' => {
ignore => [
qw(cursor)
@@ -99,9 +108,10 @@
'DBIx::Class::Storage::DBI' => { skip => 1 },
'DBIx::Class::Storage::DBI::DB2' => { skip => 1 },
'DBIx::Class::Storage::DBI::MSSQL' => { skip => 1 },
- 'DBIx::Class::Storage::DBI::MultiDistinctEmulation' => { skip => 1 },
+ 'DBIx::Class::Storage::DBI::Sybase::MSSQL' => { skip => 1 },
'DBIx::Class::Storage::DBI::ODBC400' => { skip => 1 },
'DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL' => { skip => 1 },
+ 'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' => { skip => 1 },
'DBIx::Class::Storage::DBI::Oracle' => { skip => 1 },
'DBIx::Class::Storage::DBI::Pg' => { skip => 1 },
'DBIx::Class::Storage::DBI::SQLite' => { skip => 1 },
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/03podcoverage.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/04dont_break_c3.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/04dont_break_c3.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/04dont_break_c3.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,11 +1,11 @@
-#!/usr/bin/perl -w
-#Simon Ilyushchenko, 12/05/05
-#Testing the case when we try to inject into @ISA a class that's already a parent of the target class.
use strict;
use Test::More tests => 2;
use MRO::Compat;
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
+
{
package AAA;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/04dont_break_c3.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/05components.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/100extra_source.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/100populate.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/101populate_rs.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/102load_classes.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/103many_to_many_warning.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/103many_to_many_warning.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/103many_to_many_warning.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -5,42 +5,38 @@
use lib qw(t/lib);
use Data::Dumper;
-plan ( ($] >= 5.009000 and $] < 5.010001)
- ? (skip_all => 'warnings::register broken under 5.10: http://rt.perl.org/rt3/Public/Bug/Display.html?id=62522')
- : (tests => 4)
-);
+plan tests => 4;
+my $exp_warn = qr/The many-to-many relationship 'bars' is trying to create/;
{
my @w;
- local $SIG{__WARN__} = sub { push @w, @_ };
+ local $SIG{__WARN__} = sub { $_[0] =~ $exp_warn ? push @w, $_[0] : warn $_[0] };
my $code = gen_code ( suffix => 1 );
eval "$code";
ok (! $@, 'Eval code without warnings suppression')
|| diag $@;
- ok ( (grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "Warning triggered without relevant 'no warnings'");
+ ok (@w, "Warning triggered without DBIC_OVERWRITE_HELPER_METHODS_OK");
}
{
my @w;
- local $SIG{__WARN__} = sub { push @w, @_ };
+ local $SIG{__WARN__} = sub { $_[0] =~ $exp_warn ? push @w, $_[0] : warn $_[0] };
- my $code = gen_code ( suffix => 2, no_warn => 1 );
+ my $code = gen_code ( suffix => 2 );
+
+ local $ENV{DBIC_OVERWRITE_HELPER_METHODS_OK} = 1;
eval "$code";
ok (! $@, 'Eval code with warnings suppression')
|| diag $@;
- ok ( (not grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "No warning triggered with relevant 'no warnings'");
+ ok (! @w, "No warning triggered with DBIC_OVERWRITE_HELPER_METHODS_OK");
}
sub gen_code {
my $args = { @_ };
my $suffix = $args->{suffix};
- my $no_warn = ( $args->{no_warn}
- ? "no warnings 'DBIx::Class::Relationship::ManyToMany';"
- : '',
- );
return <<EOF;
use strict;
@@ -95,7 +91,6 @@
},
);
- ${no_warn}
__PACKAGE__->set_primary_key('barid');
__PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'foo');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/103many_to_many_warning.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/104view.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/18inserterror.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/19quotes.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/19quotes.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/19quotes.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -24,7 +24,7 @@
$schema->storage->sql_maker->quote_char('`');
$schema->storage->sql_maker->name_sep('.');
-my ($sql, @bind) = ('');
+my ($sql, @bind);
$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
$schema->storage->debug(1);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/19quotes.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/19quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/19quotes_newstyle.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/19quotes_newstyle.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -30,7 +30,7 @@
{ quote_char => '`', name_sep => '.' },
);
-my ($sql, @bind) = ('');
+my ($sql, @bind);
$schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)),
$schema->storage->debug(1);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/19quotes_newstyle.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/20setuperrors.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/26dumper.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/30dbicplain.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/31stats.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/32connect_code_ref.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/33storage_reconnect.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/34exception_action.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/35disable_sth_caching.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/36datetime.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_1.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_1.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_1.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -4,7 +4,8 @@
use warnings;
use Test::More;
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
plan tests => 8;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_1.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_2.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_2.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_2.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -4,7 +4,8 @@
use warnings;
use Test::More;
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
plan tests => 6;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_2.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_3.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_3.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_3.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -4,7 +4,8 @@
use warnings;
use Test::More;
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
plan tests => 7;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_3.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_4.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_4.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_4.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -4,7 +4,8 @@
use warnings;
use Test::More;
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
plan tests => 6;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_4.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_rt41083.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_rt41083.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_rt41083.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -4,6 +4,7 @@
use warnings;
use lib 't/lib';
+use DBICTest; # do not remove even though it is not used
use Test::More tests => 8;
sub _chk_warning {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/39load_namespaces_rt41083.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/40resultsetmanager.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/41orrible.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/41orrible.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/41orrible.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,14 +2,15 @@
use warnings;
use Test::More;
-use DBIx::Class::Storage::DBI::Oracle::WhereJoins;
+use DBIx::Class::SQLAHacks::OracleJoins;
use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
use DBIC::SqlMakerTest;
plan tests => 4;
-my $sa = new DBIC::SQL::Abstract::Oracle;
+my $sa = new DBIx::Class::SQLAHacks::OracleJoins;
$sa->limit_dialect('RowNum');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/41orrible.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/42toplimit.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/42toplimit.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/42toplimit.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,26 +1,119 @@
-use strict;
-use warnings;
-
-use Test::More;
-use DBIx::Class::Storage::DBI;
-
-plan tests => 1;
-
-my $sa = new DBIC::SQL::Abstract;
-
-$sa->limit_dialect( 'Top' );
-
-is(
- $sa->select( 'rubbish', [ 'foo.id', 'bar.id' ], undef, { order_by => 'artistid' }, 1, 3 ),
- 'SELECT * FROM
-(
- SELECT TOP 1 * FROM
- (
- SELECT TOP 4 foo.id, bar.id FROM rubbish ORDER BY artistid ASC
- ) AS foo
- ORDER BY artistid DESC
-) AS bar
-ORDER BY artistid ASC
-',
- "make sure limit_dialect( 'Top' ) is working okay"
-);
+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
+delete $schema->storage->_sql_maker->{_cached_syntax};
+$schema->storage->_sql_maker->limit_dialect ('Top');
+
+my $rs = $schema->resultset ('FourKeys')->search ({}, { rows => 1, offset => 3 });
+
+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 * FROM (
+ SELECT TOP 1 * FROM (
+ SELECT TOP 4 me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count FROM fourkeys me ORDER BY $args->{order_inner}
+ ) foo ORDER BY $args->{order_outer}
+ ) bar
+ $req_order
+ )",
+ [],
+ );
+}
+
+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',
+ },
+ {
+ order_by => undef,
+ order_req => undef,
+ order_inner => 'foo ASC, bar ASC, hello ASC, goodbye ASC',
+ order_outer => 'foo DESC, bar DESC, hello DESC, goodbye DESC',
+ },
+ {
+ order_by => '',
+ order_req => undef,
+ order_inner => 'foo ASC, bar ASC, hello ASC, goodbye ASC',
+ order_outer => 'foo DESC, bar DESC, hello DESC, goodbye DESC',
+ },
+ {
+ order_by => {},
+ order_req => undef,
+ order_inner => 'foo ASC, bar ASC, hello ASC, goodbye ASC',
+ order_outer => 'foo DESC, bar DESC, hello DESC, goodbye DESC',
+ },
+ {
+ order_by => [],
+ order_req => undef,
+ order_inner => 'foo ASC, bar ASC, hello ASC, goodbye ASC',
+ order_outer => 'foo DESC, bar DESC, hello DESC, goodbye DESC',
+ },
+);
+
+plan (tests => scalar @tests);
+test_order ($_) for @tests;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/42toplimit.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/46where_attribute.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/46where_attribute.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/46where_attribute.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,74 +1,74 @@
-use strict;
-use warnings;
-
-use Test::More;
-use Data::Dumper;
-use lib qw(t/lib);
-use DBICTest;
-my $schema = DBICTest->init_schema();
-
-plan tests => 16;
-
-# select from a class with resultset_attributes
-my $resultset = $schema->resultset('BooksInLibrary');
-is($resultset, 3, "select from a class with resultset_attributes okay");
-
-# now test out selects through a resultset
-my $owner = $schema->resultset('Owners')->find({name => "Newton"});
-my $programming_perl = $owner->books->find_or_create({ title => "Programming Perl" });
-is($programming_perl->id, 1, 'select from a resultset with find_or_create for existing entry ok');
-
-# and inserts?
-my $see_spot;
-$see_spot = eval { $owner->books->find_or_create({ title => "See Spot Run" }) };
-if ($@) { print $@ }
-ok(!$@, 'find_or_create on resultset with attribute for non-existent entry did not throw');
-ok(defined $see_spot, 'successfully did insert on resultset with attribute for non-existent entry');
-
-my $see_spot_rs = $owner->books->search({ title => "See Spot Run" });
-eval { $see_spot_rs->delete(); };
-if ($@) { print $@ }
-ok(!$@, 'delete on resultset with attribute did not throw');
-is($see_spot_rs->count(), 0, 'delete on resultset with attributes succeeded');
-
-# many_to_many tests
-my $collection = $schema->resultset('Collection')->search({collectionid => 1});
-my $pointy_objects = $collection->search_related('collection_object')->search_related('object', { type => "pointy"});
-my $pointy_count = $pointy_objects->count();
-is($pointy_count, 2, 'many_to_many explicit query through linking table with query starting from resultset count correct');
-
-$collection = $schema->resultset('Collection')->find(1);
-$pointy_objects = $collection->search_related('collection_object')->search_related('object', { type => "pointy"});
-$pointy_count = $pointy_objects->count();
-is($pointy_count, 2, 'many_to_many explicit query through linking table with query starting from row count correct');
-
-# use where on many_to_many query
-$collection = $schema->resultset('Collection')->find(1);
-$pointy_objects = $collection->search_related('collection_object')->search_related('object', {}, { where => { 'object.type' => 'pointy' } });
-is($pointy_objects->count(), 2, 'many_to_many explicit query through linking table with where starting from row count correct');
-
-$collection = $schema->resultset('Collection')->find(1);
-$pointy_objects = $collection->pointy_objects();
-$pointy_count = $pointy_objects->count();
-is($pointy_count, 2, 'many_to_many resultset with where in resultset attrs count correct');
-
-# add_to_$rel on many_to_many with where containing a required field
-eval {$collection->add_to_pointy_objects({ value => "Nail" }) };
-if ($@) { print $@ }
-ok( !$@, 'many_to_many add_to_$rel($hash) with where in relationship attrs did not throw');
-is($pointy_objects->count, $pointy_count+1, 'many_to_many add_to_$rel($hash) with where in relationship attrs count correct');
-$pointy_count = $pointy_objects->count();
-
-my $pen = $schema->resultset('TypedObject')->create({ value => "Pen", type => "pointy"});
-eval {$collection->add_to_pointy_objects($pen)};
-if ($@) { print $@ }
-ok( !$@, 'many_to_many add_to_$rel($object) with where in relationship attrs did not throw');
-is($pointy_objects->count, $pointy_count+1, 'many_to_many add_to_$rel($object) with where in relationship attrs count correct');
-$pointy_count = $pointy_objects->count();
-
-my $round_objects = $collection->round_objects();
-my $round_count = $round_objects->count();
-eval {$collection->add_to_objects({ value => "Wheel", type => "round" })};
-if ($@) { print $@ }
-ok( !$@, 'many_to_many add_to_$rel($hash) did not throw');
-is($round_objects->count, $round_count+1, 'many_to_many add_to_$rel($hash) count correct');
+use strict;
+use warnings;
+
+use Test::More;
+use Data::Dumper;
+use lib qw(t/lib);
+use DBICTest;
+my $schema = DBICTest->init_schema();
+
+plan tests => 16;
+
+# select from a class with resultset_attributes
+my $resultset = $schema->resultset('BooksInLibrary');
+is($resultset, 3, "select from a class with resultset_attributes okay");
+
+# now test out selects through a resultset
+my $owner = $schema->resultset('Owners')->find({name => "Newton"});
+my $programming_perl = $owner->books->find_or_create({ title => "Programming Perl" });
+is($programming_perl->id, 1, 'select from a resultset with find_or_create for existing entry ok');
+
+# and inserts?
+my $see_spot;
+$see_spot = eval { $owner->books->find_or_create({ title => "See Spot Run" }) };
+if ($@) { print $@ }
+ok(!$@, 'find_or_create on resultset with attribute for non-existent entry did not throw');
+ok(defined $see_spot, 'successfully did insert on resultset with attribute for non-existent entry');
+
+my $see_spot_rs = $owner->books->search({ title => "See Spot Run" });
+eval { $see_spot_rs->delete(); };
+if ($@) { print $@ }
+ok(!$@, 'delete on resultset with attribute did not throw');
+is($see_spot_rs->count(), 0, 'delete on resultset with attributes succeeded');
+
+# many_to_many tests
+my $collection = $schema->resultset('Collection')->search({collectionid => 1});
+my $pointy_objects = $collection->search_related('collection_object')->search_related('object', { type => "pointy"});
+my $pointy_count = $pointy_objects->count();
+is($pointy_count, 2, 'many_to_many explicit query through linking table with query starting from resultset count correct');
+
+$collection = $schema->resultset('Collection')->find(1);
+$pointy_objects = $collection->search_related('collection_object')->search_related('object', { type => "pointy"});
+$pointy_count = $pointy_objects->count();
+is($pointy_count, 2, 'many_to_many explicit query through linking table with query starting from row count correct');
+
+# use where on many_to_many query
+$collection = $schema->resultset('Collection')->find(1);
+$pointy_objects = $collection->search_related('collection_object')->search_related('object', {}, { where => { 'object.type' => 'pointy' } });
+is($pointy_objects->count(), 2, 'many_to_many explicit query through linking table with where starting from row count correct');
+
+$collection = $schema->resultset('Collection')->find(1);
+$pointy_objects = $collection->pointy_objects();
+$pointy_count = $pointy_objects->count();
+is($pointy_count, 2, 'many_to_many resultset with where in resultset attrs count correct');
+
+# add_to_$rel on many_to_many with where containing a required field
+eval {$collection->add_to_pointy_objects({ value => "Nail" }) };
+if ($@) { print $@ }
+ok( !$@, 'many_to_many add_to_$rel($hash) with where in relationship attrs did not throw');
+is($pointy_objects->count, $pointy_count+1, 'many_to_many add_to_$rel($hash) with where in relationship attrs count correct');
+$pointy_count = $pointy_objects->count();
+
+my $pen = $schema->resultset('TypedObject')->create({ value => "Pen", type => "pointy"});
+eval {$collection->add_to_pointy_objects($pen)};
+if ($@) { print $@ }
+ok( !$@, 'many_to_many add_to_$rel($object) with where in relationship attrs did not throw');
+is($pointy_objects->count, $pointy_count+1, 'many_to_many add_to_$rel($object) with where in relationship attrs count correct');
+$pointy_count = $pointy_objects->count();
+
+my $round_objects = $collection->round_objects();
+my $round_count = $round_objects->count();
+eval {$collection->add_to_objects({ value => "Wheel", type => "round" })};
+if ($@) { print $@ }
+ok( !$@, 'many_to_many add_to_$rel($hash) did not throw');
+is($round_objects->count, $round_count+1, 'many_to_many add_to_$rel($hash) count correct');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/46where_attribute.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/47bind_attribute.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/47bind_attribute.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/47bind_attribute.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,19 +3,19 @@
use Test::More;
use lib qw(t/lib);
-use DBICTest;
+use DBIC::SqlMakerTest;
+use_ok('DBICTest');
+
my $schema = DBICTest->init_schema;
BEGIN {
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 7 );
+ : ( tests => 9 );
}
-### $schema->storage->debug(1);
-
my $where_bind = {
where => \'name like ?',
bind => [ 'Cat%' ],
@@ -55,10 +55,10 @@
$new_source->source_name('Complex');
$new_source->name(\<<'');
-( select a.*, cd.cdid as cdid, cd.title as title, cd.year as year
- from artist a
- join cd on cd.artist=a.artistid
- where cd.year=?)
+( SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year
+ FROM artist a
+ JOIN cd ON cd.artist = a.artistid
+ WHERE cd.year = ?)
$schema->register_extra_source('Complex' => $new_source);
@@ -72,11 +72,21 @@
->search({ 'artistid' => 1 });
is ( $rs->count, 1, '...cookbook (bind first) + chained search' );
+{
+ $rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })->search({}, { where => \"title LIKE ?", bind => [ 'Spoon%' ] });
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT me.artistid, me.name, me.rank, me.charfield FROM (SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year FROM artist a JOIN cd ON cd.artist = a.artistid WHERE cd.year = ?) WHERE title LIKE ?)",
+ [
+ [ '!!dummy' => '1999' ],
+ [ '!!dummy' => 'Spoon%' ]
+ ],
+ 'got correct SQL'
+);
+
+}
+
TODO: {
- # not sure what causes an uninit warning here, please remove when the TODO starts to pass,
- # so the real reason for the warning can be found and fixed
- local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /uninitialized/ };
-
local $TODO = 'bind args order needs fixing (semifor)';
$rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })
->search({ 'artistid' => 1 }, {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/47bind_attribute.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/50fork.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/51threads.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/51threadtxn.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/52cycle.t
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: DBIx-Class/0.08/branches/multi_stuff/t/53delete_chained.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/53delete_chained.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/53delete_chained.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,45 +0,0 @@
-use Test::More;
-use strict;
-use warnings;
-use lib qw(t/lib);
-use DBICTest;
-
-plan tests => 9;
-
-# This set of tests attempts to do a delete on a chained resultset, which
-# would lead to SQL DELETE with a JOIN, which is not supported by the
-# SQL generator right now.
-# So it currently checks that these operations fail with a warning.
-# When the SQL generator is fixed this test will need fixing up appropriately.
-
-my $schema = DBICTest->init_schema();
-my $total_tracks = $schema->resultset('Track')->count;
-cmp_ok($total_tracks, '>', 0, 'need track records');
-
-# test that delete_related w/o conditions deletes all related records only
-{
- my $w;
- local $SIG{__WARN__} = sub { $w = shift };
-
- my $artist = $schema->resultset("Artist")->find(3);
- my $artist_tracks = $artist->cds->search_related('tracks')->count;
- cmp_ok($artist_tracks, '<', $total_tracks, 'need more tracks than just related tracks');
-
- ok(!eval{$artist->cds->search_related('tracks')->delete});
- cmp_ok($schema->resultset('Track')->count, '==', $total_tracks, 'No tracks should be deleted');
- like ($w, qr/Currently \$rs->delete\(\) does not generate proper SQL/, 'Delete join warning');
-}
-
-# test that delete_related w/conditions deletes just the matched related records only
-{
- my $w;
- local $SIG{__WARN__} = sub { $w = shift };
-
- my $artist2 = $schema->resultset("Artist")->find(2);
- my $artist2_tracks = $artist2->search_related('cds')->search_related('tracks')->count;
- cmp_ok($artist2_tracks, '<', $total_tracks, 'need more tracks than related tracks');
-
- ok(!eval{$artist2->search_related('cds')->search_related('tracks')->delete});
- cmp_ok($schema->resultset('Track')->count, '==', $total_tracks, 'No tracks should be deleted');
- like ($w, qr/Currently \$rs->delete\(\) does not generate proper SQL/, 'Delete join warning');
-}
Deleted: DBIx-Class/0.08/branches/multi_stuff/t/53delete_related.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/53delete_related.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/53delete_related.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,30 +0,0 @@
-use Test::More;
-use strict;
-use warnings;
-use lib qw(t/lib);
-use DBICTest;
-
-plan tests => 7;
-
-my $schema = DBICTest->init_schema();
-my $total_cds = $schema->resultset('CD')->count;
-cmp_ok($total_cds, '>', 0, 'need cd records');
-
-# test that delete_related w/o conditions deletes all related records only
-my $artist = $schema->resultset("Artist")->find(3);
-my $artist_cds = $artist->cds->count;
-cmp_ok($artist_cds, '<', $total_cds, 'need more cds than just related cds');
-
-ok($artist->delete_related('cds'));
-cmp_ok($schema->resultset('CD')->count, '==', ($total_cds - $artist_cds), 'wrong number of cds were deleted');
-
-$total_cds -= $artist_cds;
-
-# test that delete_related w/conditions deletes just the matched related records only
-my $artist2 = $schema->resultset("Artist")->find(2);
-my $artist2_cds = $artist2->search_related('cds')->count;
-cmp_ok($artist2_cds, '<', $total_cds, 'need more cds than related cds');
-
-ok($artist2->delete_related('cds', {title => {like => '%'}}));
-cmp_ok($schema->resultset('CD')->count, '==', ($total_cds - $artist2_cds), 'wrong number of cds were deleted');
-
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/54taint.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/55storage_stress.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/60core.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/60core.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/60core.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -5,30 +5,18 @@
use Test::Exception;
use lib qw(t/lib);
use DBICTest;
+use DBIC::SqlMakerTest;
my $schema = DBICTest->init_schema();
-plan tests => 95;
+plan tests => 106;
eval { require DateTime::Format::MySQL };
my $NO_DTFM = $@ ? 1 : 0;
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
- split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
- ( ($sqlite_major_ver < 3) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
- $is_broken_sqlite = 1;
-}
-
-
my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
-cmp_ok(@art, '==', 3, "Three artists returned");
+is(@art, 3, "Three artists returned");
my $art = $art[0];
@@ -39,7 +27,7 @@
is($art->name, 'We Are In Rehab', "Accessor update ok");
my %dirty = $art->get_dirty_columns();
-cmp_ok(scalar(keys(%dirty)), '==', 1, '1 dirty column');
+is(scalar(keys(%dirty)), 1, '1 dirty column');
ok(grep($_ eq 'name', keys(%dirty)), 'name is dirty');
is($art->get_column("name"), 'We Are In Rehab', 'And via get_column');
@@ -47,7 +35,7 @@
ok($art->update, 'Update run');
my %not_dirty = $art->get_dirty_columns();
-cmp_ok(scalar(keys(%not_dirty)), '==', 0, 'Nothing is dirty');
+is(scalar(keys(%not_dirty)), 0, 'Nothing is dirty');
eval {
my $ret = $art->make_column_dirty('name2');
@@ -55,7 +43,7 @@
ok(defined($@), 'Failed to make non-existent column dirty');
$art->make_column_dirty('name');
my %fake_dirty = $art->get_dirty_columns();
-cmp_ok(scalar(keys(%fake_dirty)), '==', 1, '1 fake dirty column');
+is(scalar(keys(%fake_dirty)), 1, '1 fake dirty column');
ok(grep($_ eq 'name', keys(%fake_dirty)), 'name is fake dirty');
my $record_jp = $schema->resultset("Artist")->search(undef, { join => 'cds' })->search(undef, { prefetch => 'cds' })->next;
@@ -68,15 +56,15 @@
@art = $schema->resultset("Artist")->search({ name => 'We Are In Rehab' });
-cmp_ok(@art, '==', 1, "Changed artist returned by search");
+is(@art, 1, "Changed artist returned by search");
-cmp_ok($art[0]->artistid, '==', 3,'Correct artist too');
+is($art[0]->artistid, 3,'Correct artist too');
lives_ok (sub { $art->delete }, 'Cascading delete on Ordered has_many works' ); # real test in ordered.t
@art = $schema->resultset("Artist")->search({ });
-cmp_ok(@art, '==', 2, 'And then there were two');
+is(@art, 2, 'And then there were two');
ok(!$art->in_storage, "It knows it's dead");
@@ -90,15 +78,15 @@
@art = $schema->resultset("Artist")->search({ });
-cmp_ok(@art, '==', 3, 'And now there are three again');
+is(@art, 3, 'And now there are three again');
my $new = $schema->resultset("Artist")->create({ artistid => 4 });
-cmp_ok($new->artistid, '==', 4, 'Create produced record ok');
+is($new->artistid, 4, 'Create produced record ok');
@art = $schema->resultset("Artist")->search({ });
-cmp_ok(@art, '==', 4, "Oh my god! There's four of them!");
+is(@art, 4, "Oh my god! There's four of them!");
$new->set_column('name' => 'Man With A Fork');
@@ -152,7 +140,7 @@
my $cd = $schema->resultset("CD")->find(1);
my %cols = $cd->get_columns;
-cmp_ok(keys %cols, '==', 6, 'get_columns number of columns ok');
+is(keys %cols, 6, 'get_columns number of columns ok');
is($cols{title}, 'Spoonful of bees', 'get_columns values ok');
@@ -234,32 +222,53 @@
my( $or_rs ) = $schema->resultset("CD")->search_rs($search, { join => 'tags',
order_by => 'cdid' });
+is($or_rs->all, 5, 'Joined search with OR returned correct number of rows');
+is($or_rs->count, 5, 'Search count with OR ok');
-cmp_ok($or_rs->count, '==', 5, 'Search with OR ok');
+my $collapsed_or_rs = $or_rs->search ({}, { distinct => 1 }); # induce collapse
+is ($collapsed_or_rs->all, 4, 'Collapsed joined search with OR returned correct number of rows');
+is ($collapsed_or_rs->count, 4, 'Collapsed search count with OR ok');
-my $distinct_rs = $schema->resultset("CD")->search($search, { join => 'tags', distinct => 1 });
-cmp_ok($distinct_rs->all, '==', 4, 'DISTINCT search with OR ok');
+my $pref_or_rs = $collapsed_or_rs->search ({}, { prefetch => [qw/tags/] });
+is_same_sql_bind (
+ $pref_or_rs->as_query,
+ '(SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track, tags.tagid, tags.cd, tags.tag FROM cd me LEFT JOIN tags tags ON tags.cd = me.cdid WHERE ( ( tags.tag = ? OR tags.tag = ? ) ) GROUP BY me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track, tags.tagid, tags.cd, tags.tag ORDER BY cdid, tags.cd, tags.tag)',
+ [
+ [ 'tags.tag' => 'Cheesy' ],
+ [ 'tags.tag' => 'Blue' ],
+ ],
+ 'Prefetch + distinct resulted in correct group_by',
+);
+is ($pref_or_rs->all, 4, 'Prefetched grouped search with OR returned correct number of rows');
+is ($pref_or_rs->count, 4, 'Prefetched grouped count with OR ok');
-SKIP: {
- skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 2
- if $is_broken_sqlite;
- my $tcount = $schema->resultset("Track")->search(
+{
+ my $tcount = $schema->resultset('Track')->search(
{},
- {
- select => {count => {distinct => ['position', 'title']}},
- as => ['count']
+ {
+ select => [ qw/position title/ ],
+ distinct => 1,
}
);
- cmp_ok($tcount->next->get_column('count'), '==', 13, 'multiple column COUNT DISTINCT ok');
+ is($tcount->count, 13, 'multiple column COUNT DISTINCT ok');
- $tcount = $schema->resultset("Track")->search(
+ $tcount = $schema->resultset('Track')->search(
{},
- {
- columns => {count => {count => {distinct => ['position', 'title']}}},
+ {
+ columns => [ qw/position title/ ],
+ distinct => 1,
}
);
- cmp_ok($tcount->next->get_column('count'), '==', 13, 'multiple column COUNT DISTINCT using column syntax ok');
+ is($tcount->count, 13, 'multiple column COUNT DISTINCT ok');
+
+ $tcount = $schema->resultset('Track')->search(
+ {},
+ {
+ group_by => [ qw/position title/ ]
+ }
+ );
+ is($tcount->count, 13, 'multiple column COUNT DISTINCT using column syntax ok');
}
my $tag_rs = $schema->resultset('Tag')->search(
@@ -267,17 +276,17 @@
my $rel_rs = $tag_rs->search_related('cd');
-cmp_ok($rel_rs->count, '==', 5, 'Related search ok');
+is($rel_rs->count, 5, 'Related search ok');
-cmp_ok($or_rs->next->cdid, '==', $rel_rs->next->cdid, 'Related object ok');
+is($or_rs->next->cdid, $rel_rs->next->cdid, 'Related object ok');
$or_rs->reset;
$rel_rs->reset;
my $tag = $schema->resultset('Tag')->search(
[ { 'me.tag' => 'Blue' } ], { cols=>[qw/tagid/] } )->next;
-cmp_ok($tag->has_column_loaded('tagid'), '==', 1, 'Has tagid loaded');
-cmp_ok($tag->has_column_loaded('tag'), '==', 0, 'Has not tag loaded');
+ok($tag->has_column_loaded('tagid'), 'Has tagid loaded');
+ok(!$tag->has_column_loaded('tag'), 'Has not tag loaded');
ok($schema->storage(), 'Storage available');
@@ -309,7 +318,7 @@
ok($schema->source('SourceNameArtists'), 'SourceNameArtists result source exists');
my @artsn = $schema->resultset('SourceNameArtists')->search({}, { order_by => 'name DESC' });
- cmp_ok(@artsn, '==', 4, "Four artists returned");
+ is(@artsn, 4, "Four artists returned");
# make sure subclasses that don't set source_name are ok
ok($schema->source('ArtistSubclass'), 'ArtistSubclass exists');
@@ -323,8 +332,8 @@
{
my $art_del = $schema->resultset("Artist")->find({ artistid => 1 });
lives_ok (sub { $art_del->delete }, 'Cascading delete on Ordered has_many works' ); # real test in ordered.t
- cmp_ok( $schema->resultset("CD")->search({artist => 1}), '==', 0, 'Cascading through has_many top level.');
- cmp_ok( $schema->resultset("CD_to_Producer")->search({cd => 1}), '==', 0, 'Cascading through has_many children.');
+ is( $schema->resultset("CD")->search({artist => 1}), 0, 'Cascading through has_many top level.');
+ is( $schema->resultset("CD_to_Producer")->search({cd => 1}), 0, 'Cascading through has_many children.');
}
# test column_info
@@ -404,3 +413,12 @@
$en_row->insert;
is($en_row->encoded, 'amliw', 'insert does not encode again');
}
+
+# make sure we got rid of the compat shims
+SKIP: {
+ skip "Remove in 0.09", 5 if $DBIx::Class::VERSION < 0.09;
+
+ for (qw/compare_relationship_keys pk_depends_on resolve_condition resolve_join resolve_prefetch/) {
+ ok (! DBIx::Class::ResultSource->can ($_), "$_ no longer provided by DBIx::Class::ResultSource");
+ }
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/60core.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/61findnot.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/63register_class.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/63register_source.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/64db.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/65multipk.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/66relationship.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/66relationship.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/66relationship.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -8,7 +8,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 74;
+plan tests => 78;
# has_a test
my $cd = $schema->resultset("CD")->find(4);
@@ -62,10 +62,10 @@
}
my( $rs_from_list ) = $artist->search_related_rs('cds');
-is( ref($rs_from_list), 'DBIx::Class::ResultSet', 'search_related_rs in list context returns rs' );
+isa_ok( $rs_from_list, 'DBIx::Class::ResultSet', 'search_related_rs in list context returns rs' );
( $rs_from_list ) = $artist->cds_rs();
-is( ref($rs_from_list), 'DBIx::Class::ResultSet', 'relation_rs in list context returns rs' );
+isa_ok( $rs_from_list, 'DBIx::Class::ResultSet', 'relation_rs in list context returns rs' );
# count_related
is( $artist->count_related('cds'), 4, 'count_related ok' );
@@ -189,6 +189,14 @@
is( $prod_rs->first->name, 'Matt S Trout',
'many_to_many add_to_$rel($obj) ok' );
$cd->remove_from_producers($prod);
+$cd->add_to_producers($prod, {attribute => 1});
+is( $prod_rs->count(), 1, 'many_to_many add_to_$rel($obj, $link_vals) count ok' );
+is( $cd->cd_to_producer->first->attribute, 1, 'many_to_many $link_vals ok');
+$cd->remove_from_producers($prod);
+$cd->set_producers([$prod], {attribute => 2});
+is( $prod_rs->count(), 1, 'many_to_many set_$rel($obj, $link_vals) count ok' );
+is( $cd->cd_to_producer->first->attribute, 2, 'many_to_many $link_vals ok');
+$cd->remove_from_producers($prod);
is( $schema->resultset('Producer')->find(1)->name, 'Matt S Trout',
"producer object exists after remove of link" );
is( $prod_rs->count, 0, 'many_to_many remove_from_$rel($obj) ok' );
@@ -234,6 +242,7 @@
is( $twokey->fourkeys_to_twokeys->count, 0,
'twokey has no links to fourkey' );
+
my $undef_artist_cd = $schema->resultset("CD")->new_result({ 'title' => 'badgers', 'year' => 2007 });
is($undef_artist_cd->has_column_loaded('artist'), '', 'FK not loaded');
is($undef_artist_cd->search_related('artist')->count, 0, '0=1 search when FK does not exist and object not yet in db');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/66relationship.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/67pager.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/67pager.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/67pager.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -21,6 +21,8 @@
is( $it->count, 3, "count on paged rs ok" );
+is( $it->pager->total_entries, 5, "total_entries ok" );
+
is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
$it->next;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/67pager.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/68inflate.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/68inflate_resultclass_hashrefinflator.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/68inflate_serialize.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/69update.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/70auto.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/71mysql.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/71mysql.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/71mysql.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,6 +2,7 @@
use warnings;
use Test::More;
+use Test::Exception;
use lib qw(t/lib);
use DBICTest;
use DBI::Const::GetInfoType;
@@ -13,7 +14,7 @@
plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn && $user);
-plan tests => 10;
+plan tests => 11;
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -23,6 +24,18 @@
$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));");
+$dbh->do("DROP TABLE IF EXISTS cd;");
+
+$dbh->do("CREATE TABLE cd (cdid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, artist INTEGER, title TEXT, year INTEGER, genreid INTEGER, single_track INTEGER);");
+
+$dbh->do("DROP TABLE IF EXISTS producer;");
+
+$dbh->do("CREATE TABLE producer (producerid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name TEXT);");
+
+$dbh->do("DROP TABLE IF EXISTS cd_to_producer;");
+
+$dbh->do("CREATE TABLE cd_to_producer (cd INTEGER,producer INTEGER);");
+
#'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
# This is in Core now, but it's here just to test that it doesn't break
@@ -41,7 +54,7 @@
offset => 2,
order_by => 'artistid' }
);
-is( $it->count, 3, "LIMIT count ok" );
+is( $it->count, 3, "LIMIT count ok" ); # ask for 3 rows out of 7 artists
is( $it->next->name, "Artist 2", "iterator->next ok" );
$it->next;
$it->next;
@@ -119,8 +132,13 @@
=> 'Nothing Found!';
}
+my $cd = $schema->resultset ('CD')->create ({});
+my $producer = $schema->resultset ('Producer')->create ({});
+
+lives_ok { $cd->set_producers ([ $producer ]) } 'set_relationship doesnt die';
+
# clean up our mess
END {
#$dbh->do("DROP TABLE artist") if $dbh;
-}
\ No newline at end of file
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/71mysql.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/72pg.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/72pg.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/72pg.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -72,6 +72,8 @@
$schema->source("SequenceTest")->name("testschema.sequence_test");
{
local $SIG{__WARN__} = sub {};
+ _cleanup ($dbh);
+
$dbh->do("CREATE SCHEMA testschema;");
$dbh->do("CREATE TABLE testschema.artist (artistid serial PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10), arrayfield INTEGER[]);");
$dbh->do("CREATE TABLE testschema.sequence_test (pkid1 integer, pkid2 integer, nonpkid integer, name VARCHAR(100), CONSTRAINT pk PRIMARY KEY(pkid1, pkid2));");
@@ -264,16 +266,21 @@
my $st = $schema->resultset('SequenceTest')->create({ name => 'foo', pkid1 => 55 });
is($st->pkid1, 55, "Oracle Auto-PK without trigger: First primary key set manually");
+sub _cleanup {
+ my $dbh = shift or return;
-END {
- if($dbh) {
- $dbh->do("DROP TABLE testschema.artist;");
- $dbh->do("DROP TABLE testschema.casecheck;");
- $dbh->do("DROP TABLE testschema.sequence_test;");
- $dbh->do("DROP TABLE testschema.array_test;");
- $dbh->do("DROP SEQUENCE pkid1_seq");
- $dbh->do("DROP SEQUENCE pkid2_seq");
- $dbh->do("DROP SEQUENCE nonpkid_seq");
- $dbh->do("DROP SCHEMA testschema;");
- }
+ for my $stat (
+ 'DROP TABLE testschema.artist',
+ 'DROP TABLE testschema.casecheck',
+ 'DROP TABLE testschema.sequence_test',
+ 'DROP TABLE testschema.array_test',
+ 'DROP SEQUENCE pkid1_seq',
+ 'DROP SEQUENCE pkid2_seq',
+ 'DROP SEQUENCE nonpkid_seq',
+ 'DROP SCHEMA testschema',
+ ) {
+ eval { $dbh->do ($stat) };
+ }
}
+
+END { _cleanup($dbh) }
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/72pg.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/73oracle.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/73oracle.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/73oracle.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -28,6 +28,7 @@
use strict;
use warnings;
+use Test::Exception;
use Test::More;
use lib qw(t/lib);
use DBICTest;
@@ -39,7 +40,7 @@
' as well as following sequences: \'pkid1_seq\', \'pkid2_seq\' and \'nonpkid_seq\''
unless ($dsn && $user && $pass);
-plan tests => 24;
+plan tests => 34;
DBICTest::Schema->load_classes('ArtistFQN');
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -63,7 +64,7 @@
$dbh->do("CREATE TABLE artist (artistid NUMBER(12), name VARCHAR(255), rank NUMBER(38), charfield VARCHAR2(10))");
$dbh->do("CREATE TABLE sequence_test (pkid1 NUMBER(12), pkid2 NUMBER(12), nonpkid NUMBER(12), name VARCHAR(255))");
$dbh->do("CREATE TABLE cd (cdid NUMBER(12), artist NUMBER(12), title VARCHAR(255), year VARCHAR(4))");
-$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE)");
+$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)");
$dbh->do("ALTER TABLE artist ADD (CONSTRAINT artist_pk PRIMARY KEY (artistid))");
$dbh->do("ALTER TABLE sequence_test ADD (CONSTRAINT sequence_test_constraint PRIMARY KEY (pkid1, pkid2))");
@@ -80,6 +81,23 @@
END;
});
+{
+ # Swiped from t/bindtype_columns.t to avoid creating my own Resultset.
+
+ local $SIG{__WARN__} = sub {};
+ eval { $dbh->do('DROP TABLE bindtype_test') };
+
+ $dbh->do(qq[
+ CREATE TABLE bindtype_test
+ (
+ id integer NOT NULL PRIMARY KEY,
+ bytea integer NULL,
+ blob blob NULL,
+ clob clob NULL
+ )
+ ],{ RaiseError => 1, PrintError => 1 });
+}
+
# This is in Core now, but it's here just to test that it doesn't break
$schema->class('Artist')->load_components('PK::Auto');
# These are compat shims for PK::Auto...
@@ -106,16 +124,33 @@
# check count distinct with multiple columns
my $other_track = $schema->resultset('Track')->create({ trackid => 2, cd => 1, position => 1, title => 'Track2' });
+
my $tcount = $schema->resultset('Track')->search(
- {},
- {
- select => [{count => {distinct => ['position', 'title']}}],
- as => ['count']
- }
- );
+ {},
+ {
+ select => [ qw/position title/ ],
+ distinct => 1,
+ }
+);
+is($tcount->count, 2, 'multiple column COUNT DISTINCT ok');
-is($tcount->next->get_column('count'), 2, "multiple column select distinct ok");
+$tcount = $schema->resultset('Track')->search(
+ {},
+ {
+ columns => [ qw/position title/ ],
+ distinct => 1,
+ }
+);
+is($tcount->count, 2, 'multiple column COUNT DISTINCT ok');
+$tcount = $schema->resultset('Track')->search(
+ {},
+ {
+ group_by => [ qw/position title/ ]
+ }
+);
+is($tcount->count, 2, 'multiple column COUNT DISTINCT using column syntax ok');
+
# test LIMIT support
for (1..6) {
$schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
@@ -147,6 +182,28 @@
my $st = $schema->resultset('SequenceTest')->create({ name => 'foo', pkid1 => 55 });
is($st->pkid1, 55, "Oracle Auto-PK without trigger: First primary key set manually");
+{
+ my %binstr = ( 'small' => join('', map { chr($_) } ( 1 .. 127 )) );
+ $binstr{'large'} = $binstr{'small'} x 1024;
+
+ my $maxloblen = length $binstr{'large'};
+ note "Localizing LongReadLen to $maxloblen to avoid truncation of test data";
+ local $dbh->{'LongReadLen'} = $maxloblen;
+
+ my $rs = $schema->resultset('BindType');
+ my $id = 0;
+
+ foreach my $type (qw( blob clob )) {
+ foreach my $size (qw( small large )) {
+ $id++;
+
+ lives_ok { $rs->create( { 'id' => $id, $type => $binstr{$size} } ) }
+ "inserted $size $type without dying";
+ ok($rs->find($id)->$type eq $binstr{$size}, "verified inserted $size $type" );
+ }
+ }
+}
+
# clean up our mess
END {
if($schema && ($dbh = $schema->storage->dbh)) {
@@ -158,6 +215,7 @@
$dbh->do("DROP TABLE sequence_test");
$dbh->do("DROP TABLE cd");
$dbh->do("DROP TABLE track");
+ $dbh->do("DROP TABLE bindtype_test");
}
}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/73oracle.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/73oracle_inflate.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/73oracle_inflate.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/73oracle_inflate.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -17,12 +17,14 @@
plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing';
}
else {
- plan tests => 4;
+ plan tests => 7;
}
}
# DateTime::Format::Oracle needs this set
$ENV{NLS_DATE_FORMAT} = 'DD-MON-YY';
+$ENV{NLS_TIMESTAMP_FORMAT} = 'YYYY-MM-DD HH24:MI:SSXFF';
+$ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1';
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -30,16 +32,20 @@
my $col_metadata = $schema->class('Track')->column_info('last_updated_on');
$schema->class('Track')->add_column( 'last_updated_on' => {
data_type => 'date' });
+$schema->class('Track')->add_column( 'last_updated_at' => {
+ data_type => 'timestamp' });
my $dbh = $schema->storage->dbh;
+#$dbh->do("alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SSXFF'");
+
eval {
$dbh->do("DROP TABLE track");
};
-$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE)");
+$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE, last_updated_at TIMESTAMP)");
# insert a row to play with
-my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07' });
+my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07', last_updated_at => '2009-05-03 21:17:18.5' });
is($new->trackid, 1, "insert sucessful");
my $track = $schema->resultset('Track')->find( 1 );
@@ -48,11 +54,18 @@
is( $track->last_updated_on->month, 5, "DateTime methods work on inflated column");
+#note '$track->last_updated_at => ', $track->last_updated_at;
+is( ref($track->last_updated_at), 'DateTime', "last_updated_at inflated ok");
+
+is( $track->last_updated_at->nanosecond, 500_000_000, "DateTime methods work with nanosecond precision");
+
my $dt = DateTime->now();
$track->last_updated_on($dt);
+$track->last_updated_at($dt);
$track->update;
is( $track->last_updated_on->month, $dt->month, "deflate ok");
+is( int $track->last_updated_at->nanosecond, int $dt->nanosecond, "deflate ok with nanosecond precision");
# clean up our mess
END {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/73oracle_inflate.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/745db2.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/745db2.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/745db2.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -12,7 +12,7 @@
plan skip_all => 'Set $ENV{DBICTEST_DB2_DSN}, _USER and _PASS to run this test'
unless ($dsn && $user);
-plan tests => 6;
+plan tests => 9;
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -25,25 +25,37 @@
# This is in core, just testing that it still loads ok
$schema->class('Artist')->load_components('PK::Auto');
+my $ars = $schema->resultset('Artist');
+
# test primary key handling
-my $new = $schema->resultset('Artist')->create({ name => 'foo' });
+my $new = $ars->create({ name => 'foo' });
ok($new->artistid, "Auto-PK worked");
-# test LIMIT support
+my $init_count = $ars->count;
for (1..6) {
- $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
+ $ars->create({ name => 'Artist ' . $_ });
}
-my $it = $schema->resultset('Artist')->search( {},
- { rows => 3,
- order_by => 'artistid'
- }
+is ($ars->count, $init_count + 6, 'Simple count works');
+
+# test LIMIT support
+my $it = $ars->search( {},
+ {
+ rows => 3,
+ order_by => 'artistid'
+ }
);
is( $it->count, 3, "LIMIT count ok" );
+
+my @all = $it->all;
+is (@all, 3, 'Number of ->all objects matches count');
+
+$it->reset;
is( $it->next->name, "foo", "iterator->next ok" );
-$it->next;
+is( $it->next->name, "Artist 1", "iterator->next ok" );
is( $it->next->name, "Artist 2", "iterator->next ok" );
-is( $it->next, undef, "next past end of resultset ok" );
+is( $it->next, undef, "next past end of resultset ok" ); # this can not succeed if @all > 3
+
my $test_type_info = {
'artistid' => {
'data_type' => 'INTEGER',
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/745db2.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/746db2_400.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/746mssql.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/746mssql.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -10,11 +10,21 @@
plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test'
unless ($dsn && $user);
-plan tests => 12;
+plan tests => 13;
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1});
-$schema->storage->ensure_connected;
+{
+ no warnings 'redefine';
+ my $connect_count = 0;
+ my $orig_connect = \&DBI::connect;
+ local *DBI::connect = sub { $connect_count++; goto &$orig_connect };
+
+ $schema->storage->ensure_connected;
+
+ is( $connect_count, 1, 'only one connection made');
+}
+
isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' );
$schema->storage->dbh_do (sub {
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/746mssql.t
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/746sybase.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/746sybase.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/746sybase.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,82 @@
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/};
+
+plan skip_all => 'Set $ENV{DBICTEST_SYBASE_DSN}, _USER and _PASS to run this test'
+ unless ($dsn && $user);
+
+plan tests => 12;
+
+my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1});
+
+$schema->storage->ensure_connected;
+isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::Sybase' );
+
+$schema->storage->dbh_do (sub {
+ my ($storage, $dbh) = @_;
+ eval { $dbh->do("DROP TABLE artist") };
+ $dbh->do(<<'SQL');
+
+CREATE TABLE artist (
+ artistid INT IDENTITY NOT NULL,
+ name VARCHAR(100),
+ rank INT DEFAULT 13 NOT NULL,
+ charfield CHAR(10) NULL,
+ primary key(artistid)
+)
+
+SQL
+
+});
+
+my %seen_id;
+
+# fresh $schema so we start unconnected
+$schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1});
+
+# test primary key handling
+my $new = $schema->resultset('Artist')->create({ name => 'foo' });
+ok($new->artistid > 0, "Auto-PK worked");
+
+$seen_id{$new->artistid}++;
+
+# test LIMIT support
+for (1..6) {
+ $new = $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
+ is ( $seen_id{$new->artistid}, undef, "id for Artist $_ is unique" );
+ $seen_id{$new->artistid}++;
+}
+
+my $it;
+
+$it = $schema->resultset('Artist')->search( {}, {
+ rows => 3,
+ order_by => 'artistid',
+});
+
+TODO: {
+ local $TODO = 'Sybase is very very fucked in the limit department';
+
+ is( $it->count, 3, "LIMIT count ok" );
+}
+
+# The iterator still works correctly with rows => 3, even though the sql is
+# fucked, very interesting.
+
+is( $it->next->name, "foo", "iterator->next ok" );
+$it->next;
+is( $it->next->name, "Artist 2", "iterator->next ok" );
+is( $it->next, undef, "next past end of resultset ok" );
+
+
+# clean up our mess
+END {
+ my $dbh = eval { $schema->storage->_dbh };
+ $dbh->do('DROP TABLE artist') if $dbh;
+}
+
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/746sybase.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/74mssql.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/74mssql.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/74mssql.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -7,23 +7,18 @@
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};
-#warn "$dsn $user $pass";
-
plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn);
-plan tests => 5;
+plan tests => 6;
-my $storage_type = '::DBI::MSSQL';
-$storage_type = '::DBI::Sybase::MSSQL' if $dsn =~ /^dbi:Sybase:/;
-# Add more for others in the future when they exist (ODBC? ADO? JDBC?)
-
my $schema = DBICTest::Schema->clone;
-$schema->storage_type($storage_type);
$schema->connection($dsn, $user, $pass);
my $dbh = $schema->storage->dbh;
+isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server');
+
$dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL
DROP TABLE artist");
$dbh->do("IF OBJECT_ID('cd', 'U') IS NOT NULL
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/74mssql.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/75limit.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/76joins.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/76joins.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/76joins.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -17,23 +17,11 @@
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 18 );
+ : ( tests => 33 );
}
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
- split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
- ( ($sqlite_major_ver < 3) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
- $is_broken_sqlite = 1;
-}
-
# test the abstract join => SQL generator
-my $sa = new DBIC::SQL::Abstract;
+my $sa = new DBIx::Class::SQLAHacks;
my @j = (
{ child => 'person' },
@@ -44,9 +32,9 @@
. 'child.father_id ) JOIN person mother ON ( mother.person_id '
. '= child.mother_id )'
;
-is_same_sql_bind(
- $sa->_recurse_from(@j), [],
- $match, [],
+is_same_sql(
+ $sa->_recurse_from(@j),
+ $match,
'join 1 ok'
);
@@ -64,9 +52,9 @@
. ' father.person_id = child.father_id )) ON ( mother.person_id = '
. 'child.mother_id )'
;
-is_same_sql_bind(
- $sa->_recurse_from(@j2), [],
- $match, [],
+is_same_sql(
+ $sa->_recurse_from(@j2),
+ $match,
'join 2 ok'
);
@@ -81,9 +69,9 @@
. '= child.mother_id )'
;
-is_same_sql_bind(
- $sa->_recurse_from(@j3), [],
- $match, [],
+is_same_sql(
+ $sa->_recurse_from(@j3),
+ $match,
'join 3 (inner join) ok'
);
@@ -101,9 +89,9 @@
. ' father.person_id = child.father_id )) ON ( mother.person_id = '
. 'child.mother_id )'
;
-is_same_sql_bind(
- $sa->_recurse_from(@j4), [],
- $match, [],
+is_same_sql(
+ $sa->_recurse_from(@j4),
+ $match,
'join 4 (nested joins + join types) ok'
);
@@ -116,9 +104,9 @@
. 'child.father_id ) JOIN person mother ON ( mother.person_id '
. '= child.mother_id )'
;
-is_same_sql_bind(
- $sa->_recurse_from(@j5), [],
- $match, [],
+is_same_sql(
+ $sa->_recurse_from(@j5),
+ $match,
'join 5 (SCALAR reference for ON statement) ok'
);
@@ -127,7 +115,7 @@
[ { father => 'person' }, { 'father.person_id' => { '!=', '42' } }, ],
[ { mother => 'person' }, { 'mother.person_id' => 'child.mother_id' } ],
);
-$match = qr/^HASH reference arguments are not supported in JOINS - try using "\.\.\." instead/;
+$match = qr/HASH reference arguments are not supported in JOINS/;
eval { $sa->_recurse_from(@j6) };
like( $@, $match, 'join 6 (HASH reference for ON statement dies) ok' );
@@ -140,7 +128,7 @@
] ] }
);
-cmp_ok( $rs + 0, '==', 1, "Single record in resultset");
+is( $rs + 0, 1, "Single record in resultset");
is($rs->first->title, 'Forkful of bees', 'Correct record returned');
@@ -148,7 +136,7 @@
{ 'year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
{ join => 'artist' });
-cmp_ok( $rs + 0, '==', 1, "Single record in resultset");
+is( $rs + 0, 1, "Single record in resultset");
is($rs->first->title, 'Forkful of bees', 'Correct record returned');
@@ -157,7 +145,7 @@
'liner_notes.notes' => 'Kill Yourself!' },
{ join => [ qw/artist liner_notes/ ] });
-cmp_ok( $rs + 0, '==', 1, "Single record in resultset");
+is( $rs + 0, 1, "Single record in resultset");
is($rs->first->title, 'Come Be Depressed With Us', 'Correct record returned');
@@ -166,7 +154,7 @@
{ 'artist' => 1 },
{ join => [qw/artist/], order_by => 'artist.name' }
);
-cmp_ok( scalar $rs->all, '==', scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' );
+is( scalar $rs->all, scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' );
ok(!$rs->slice($rs->count+1000, $rs->count+1002)->count,
'Slicing beyond end of rs returns a zero count');
@@ -175,32 +163,83 @@
{ 'liner_notes.notes' => 'Kill Yourself!' },
{ join => { 'cds' => 'liner_notes' } });
-cmp_ok( $rs->count, '==', 1, "Single record in resultset");
+is( $rs->count, 1, "Single record in resultset");
is($rs->first->name, 'We Are Goth', 'Correct record returned');
-# test for warnings on delete of joined resultset
-$rs = $schema->resultset("CD")->search(
- { 'artist.name' => 'Caterwauler McCrae' },
- { join => [qw/artist/]}
-);
-my $tst_delete_warning;
-eval {
- local $SIG{__WARN__} = sub { $tst_delete_warning = shift };
- $rs->delete();
-};
-ok( ($@ || $tst_delete_warning), 'fail/warning on attempt to delete a join-ed resultset');
+{
+ $schema->populate('Artist', [
+ [ qw/artistid name/ ],
+ [ 4, 'Another Boy Band' ],
+ ]);
+ $schema->populate('CD', [
+ [ qw/cdid artist title year/ ],
+ [ 6, 2, "Greatest Hits", 2001 ],
+ [ 7, 4, "Greatest Hits", 2005 ],
+ [ 8, 4, "BoyBandBlues", 2008 ],
+ ]);
+ $schema->populate('TwoKeys', [
+ [ qw/artist cd/ ],
+ [ 2, 4 ],
+ [ 2, 6 ],
+ [ 4, 7 ],
+ [ 4, 8 ],
+ ]);
+
+ sub cd_count {
+ return $schema->resultset("CD")->count;
+ }
+ sub tk_count {
+ return $schema->resultset("TwoKeys")->count;
+ }
-# test for warnings on update of joined resultset
-$rs = $schema->resultset("CD")->search(
- { 'artist.name' => 'Random Boy Band' },
- { join => [qw/artist/]}
-);
-my $tst_update_warning;
-eval {
- local $SIG{__WARN__} = sub { $tst_update_warning = shift };
- $rs->update({ 'artist' => 1 });
-};
+ is(cd_count(), 8, '8 rows in table cd');
+ is(tk_count(), 7, '7 rows in table twokeys');
+
+ sub artist1 {
+ return $schema->resultset("CD")->search(
+ { 'artist.name' => 'Caterwauler McCrae' },
+ { join => [qw/artist/]}
+ );
+ }
+ sub artist2 {
+ return $schema->resultset("CD")->search(
+ { 'artist.name' => 'Random Boy Band' },
+ { join => [qw/artist/]}
+ );
+ }
-ok( ($@ || $tst_update_warning), 'fail/warning on attempt to update a join-ed resultset');
+ is( artist1()->count, 3, '3 Caterwauler McCrae CDs' );
+ ok( artist1()->delete, 'Successfully deleted 3 CDs' );
+ is( artist1()->count, 0, '0 Caterwauler McCrae CDs' );
+ is( artist2()->count, 2, '3 Random Boy Band CDs' );
+ ok( artist2()->update( { 'artist' => 1 } ) );
+ is( artist2()->count, 0, '0 Random Boy Band CDs' );
+ is( artist1()->count, 2, '2 Caterwauler McCrae CDs' );
+
+ # test update on multi-column-pk
+ sub tk1 {
+ return $schema->resultset("TwoKeys")->search(
+ {
+ 'artist.name' => { like => '%Boy Band' },
+ 'cd.title' => 'Greatest Hits',
+ },
+ { join => [qw/artist cd/] }
+ );
+ }
+ sub tk2 {
+ return $schema->resultset("TwoKeys")->search(
+ { 'artist.name' => 'Caterwauler McCrae' },
+ { join => [qw/artist/]}
+ );
+ }
+ is( tk2()->count, 2, 'TwoKeys count == 2' );
+ is( tk1()->count, 2, 'TwoKeys count == 2' );
+ ok( tk1()->update( { artist => 1 } ) );
+ is( tk1()->count, 0, 'TwoKeys count == 0' );
+ is( tk2()->count, 4, '2 Caterwauler McCrae CDs' );
+ ok( tk2()->delete, 'Successfully deleted 4 CDs' );
+ is(cd_count(), 5, '5 rows in table cd');
+ is(tk_count(), 3, '3 rows in table twokeys');
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/76joins.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/76select.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/76select.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/76select.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -84,10 +84,8 @@
}
);
-my ($sql, @bind) = @${$rs->as_query};
is_same_sql_bind (
- $sql,
- \@bind,
+ $rs->as_query,
'(SELECT me.cdid, me.title, artist.name FROM cd me JOIN artist artist ON artist.artistid = me.artist)',
[],
'Use of columns attribute results in proper sql'
@@ -114,10 +112,8 @@
}
);
-($sql, @bind) = @${$rs->as_query};
is_same_sql_bind (
- $sql,
- \@bind,
+ $rs->as_query,
'(SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track, me.cdid, me.title, artist.name FROM cd me JOIN artist artist ON artist.artistid = me.artist)',
[],
'Use of columns attribute results in proper sql'
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/76select.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/77join_count.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/78self_referencial.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/79aliasing.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/80unique.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/81transactions.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/82cascade_copy.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/82cascade_copy.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/82cascade_copy.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -11,15 +11,8 @@
my $artist = $schema->resultset('Artist')->find(1);
my $artist_cds = $artist->search_related('cds');
-my $cover_band;
+my $cover_band = $artist->copy;
-{
- no warnings qw(redefine once);
- local *DBICTest::Artist::result_source_instance = \&DBICTest::Schema::Artist::result_source_instance;
-
- $cover_band = $artist->copy;
-}
-
my $cover_cds = $cover_band->search_related('cds');
cmp_ok($cover_band->id, '!=', $artist->id, 'ok got new column id...');
is($cover_cds->count, $artist_cds->count, 'duplicated rows count ok');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/82cascade_copy.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/83cache.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/83cache.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/83cache.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -83,7 +83,7 @@
$rs->reset();
# make sure artist contains a related resultset for cds
-is( ref $artist->{related_resultsets}->{cds}, 'DBIx::Class::ResultSet', 'artist has a related_resultset for cds' );
+isa_ok( $artist->{related_resultsets}{cds}, 'DBIx::Class::ResultSet', 'artist has a related_resultset for cds' );
# check if $artist->cds->get_cache is populated
is( scalar @{$artist->cds->get_cache}, 3, 'cache for artist->cds contains correct number of records');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/83cache.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/84serialize.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/85utf8.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/86might_have.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/86sqlt.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/87ordered.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/88result_set_column.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/89dbicadmin.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/89inflate_datetime.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/90ensure_class_loaded.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/90join_torture.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/90join_torture.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/90join_torture.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -45,9 +45,9 @@
cmp_ok(scalar @cds, '==', 1, "condition based on inherited join okay");
my $rs3 = $rs2->search_related('cds');
+
cmp_ok(scalar($rs3->all), '==', 45, "All cds for artist returned");
-
cmp_ok($rs3->count, '==', 45, "All cds for artist returned via count");
my $rs4 = $schema->resultset("CD")->search({ 'artist.artistid' => '1' }, { join => ['tracks', 'artist'], prefetch => 'artist' });
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/90join_torture.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/91debug.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/91debug.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/91debug.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -51,18 +51,17 @@
# test trace output correctness for bind params
{
- my ($sql, @bind) = ('');
- $schema->storage->debugcb( sub { $sql = $_[1] } );
+ my ($sql, @bind);
+ $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
my @cds = $schema->resultset('CD')->search( { artist => 1, cdid => { -between => [ 1, 3 ] }, } );
is_same_sql_bind(
- $sql, [],
- "SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE ( artist = ? AND (cdid BETWEEN ? AND ?) ): '1', '1', '3'", [],
+ $sql, \@bind,
+ "SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE ( artist = ? AND (cdid BETWEEN ? AND ?) ): '1', '1', '3'",
+ [qw/'1' '1' '3'/],
'got correct SQL with all bind parameters (debugcb)'
);
- $schema->storage->debugcb(undef);
- $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
@cds = $schema->resultset('CD')->search( { artist => 1, cdid => { -between => [ 1, 3 ] }, } );
is_same_sql_bind(
$sql, \@bind,
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/91debug.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/91merge_attr.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/92storage.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/92storage_on_connect_do.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/92storage_on_connect_do.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/92storage_on_connect_do.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More tests => 12;
use lib qw(t/lib);
use base 'DBICTest';
@@ -11,7 +11,23 @@
no_connect => 1,
no_deploy => 1,
);
+
ok $schema->connection(
+ DBICTest->_database,
+ {
+ on_connect_do => 'CREATE TABLE TEST_empty (id INTEGER)',
+ },
+), 'connection()';
+
+is_deeply (
+ $schema->storage->dbh->selectall_arrayref('SELECT * FROM TEST_empty'),
+ [],
+ 'string version on_connect_do() worked'
+);
+
+$schema->storage->disconnect;
+
+ok $schema->connection(
DBICTest->_database,
{
on_connect_do => [
@@ -24,10 +40,11 @@
},
), 'connection()';
-is_deeply
+is_deeply (
$schema->storage->dbh->selectall_arrayref('SELECT * FROM TEST_empty'),
[ [ 2 ], [ 3 ], [ 7 ] ],
- 'on_connect_do() worked';
+ 'on_connect_do() worked'
+);
eval { $schema->storage->dbh->do('SELECT 1 FROM TEST_nonexistent'); };
ok $@, 'Searching for nonexistent table dies';
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/92storage_on_connect_do.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/93nobindvars.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/93nobindvars.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/93nobindvars.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -57,7 +57,7 @@
offset => 2,
order_by => 'artistid' }
);
-is( $it->count, 3, "LIMIT count ok" );
+is( $it->count, 3, "LIMIT count ok" ); # ask for 3 rows out of 7 artists
is( $it->next->name, "Artist 2", "iterator->next ok" );
$it->next;
$it->next;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/93nobindvars.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/93single_accessor_object.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/93storage_replication.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/93storage_replication.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/93storage_replication.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -4,12 +4,15 @@
use Test::More;
use Test::Exception;
use DBICTest;
+use List::Util 'first';
+use Scalar::Util 'reftype';
+use IO::Handle;
BEGIN {
eval "use DBIx::Class::Storage::DBI::Replicated; use Test::Moose";
plan $@
? ( skip_all => "Deps not installed: $@" )
- : ( tests => 79 );
+ : ( tests => 90 );
}
use_ok 'DBIx::Class::Storage::DBI::Replicated::Pool';
@@ -49,10 +52,10 @@
## Initialize the object
sub new {
- my $class = shift @_;
+ my ($class, $schema_method) = (shift, shift);
my $self = $class->SUPER::new(@_);
- $self->schema( $self->init_schema );
+ $self->schema( $self->init_schema($schema_method) );
return $self;
}
@@ -62,30 +65,71 @@
# current SQLT SQLite producer does not handle DROP TABLE IF EXISTS, trap warnings here
local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /no such table.+DROP TABLE/ };
- my $class = shift @_;
+ my ($class, $schema_method) = @_;
- my $schema = DBICTest->init_schema(
- sqlite_use_file => 1,
- storage_type=>{
- '::DBI::Replicated' => {
- balancer_type=>'::Random',
- balancer_args=>{
- auto_validate_every=>100,
- },
- }
- },
- deploy_args=>{
- add_drop_table => 1,
- },
- );
+ my $method = "get_schema_$schema_method";
+ my $schema = $class->$method;
return $schema;
}
-
+
+ sub get_schema_by_storage_type {
+ DBICTest->init_schema(
+ sqlite_use_file => 1,
+ storage_type=>{
+ '::DBI::Replicated' => {
+ balancer_type=>'::Random',
+ balancer_args=>{
+ auto_validate_every=>100,
+ master_read_weight => 1
+ },
+ }
+ },
+ deploy_args=>{
+ add_drop_table => 1,
+ },
+ );
+ }
+
+ sub get_schema_by_connect_info {
+ DBICTest->init_schema(
+ sqlite_use_file => 1,
+ storage_type=> '::DBI::Replicated',
+ balancer_type=>'::Random',
+ balancer_args=> {
+ auto_validate_every=>100,
+ master_read_weight => 1
+ },
+ deploy_args=>{
+ add_drop_table => 1,
+ },
+ );
+ }
+
sub generate_replicant_connect_info {}
sub replicate {}
sub cleanup {}
+ ## --------------------------------------------------------------------- ##
+ ## Add a connect_info option to test option merging.
+ ## --------------------------------------------------------------------- ##
+ {
+ package DBIx::Class::Storage::DBI::Replicated;
+
+ use Moose;
+
+ __PACKAGE__->meta->make_mutable;
+
+ around connect_info => sub {
+ my ($next, $self, $info) = @_;
+ $info->[3]{master_option} = 1;
+ $self->$next($info);
+ };
+
+ __PACKAGE__->meta->make_immutable;
+
+ no Moose;
+ }
## --------------------------------------------------------------------- ##
## Subclass for when you are using SQLite for testing, this provides a fake
@@ -124,9 +168,20 @@
"dbi:SQLite:${_}";
} @{$self->slave_paths};
- return map { [$_,'','',{AutoCommit=>1}] } @dsn;
+ my @connect_infos = map { [$_,'','',{AutoCommit=>1}] } @dsn;
+
+ # try a hashref too
+ my $c = $connect_infos[0];
+ $connect_infos[0] = {
+ dsn => $c->[0],
+ user => $c->[1],
+ password => $c->[2],
+ %{ $c->[3] }
+ };
+
+ @connect_infos
}
-
+
## Do a 'good enough' replication by copying the master dbfile over each of
## the slave dbfiles. If the master is SQLite we do this, otherwise we
## just do a one second pause to let the slaves catch up.
@@ -185,15 +240,23 @@
'DBIx::Class::DBI::Replicated::TestReplication::Custom' :
'DBIx::Class::DBI::Replicated::TestReplication::SQLite';
-ok my $replicated = $replicated_class->new
- => 'Created a replication object';
-
-isa_ok $replicated->schema
- => 'DBIx::Class::Schema';
-
-isa_ok $replicated->schema->storage
- => 'DBIx::Class::Storage::DBI::Replicated';
+my $replicated;
+for my $method (qw/by_connect_info by_storage_type/) {
+ ok $replicated = $replicated_class->new($method)
+ => "Created a replication object $method";
+
+ isa_ok $replicated->schema
+ => 'DBIx::Class::Schema';
+
+ isa_ok $replicated->schema->storage
+ => 'DBIx::Class::Storage::DBI::Replicated';
+
+ isa_ok $replicated->schema->storage->balancer
+ => 'DBIx::Class::Storage::DBI::Replicated::Balancer::Random'
+ => 'configured balancer_type';
+}
+
ok $replicated->schema->storage->meta
=> 'has a meta object';
@@ -211,10 +274,38 @@
ok my @replicated_storages = $replicated->schema->storage->connect_replicants(@replicant_connects)
=> 'Created some storages suitable for replicants';
-
+
+ok my @all_storages = $replicated->schema->storage->all_storages
+ => '->all_storages';
+
+is scalar @all_storages,
+ 3
+ => 'correct number of ->all_storages';
+
+is ((grep $_->isa('DBIx::Class::Storage::DBI'), @all_storages),
+ 3
+ => '->all_storages are correct type');
+
+my @all_storage_opts =
+ grep { (reftype($_)||'') eq 'HASH' }
+ map @{ $_->_connect_info }, @all_storages;
+
+is ((grep $_->{master_option}, @all_storage_opts),
+ 3
+ => 'connect_info was merged from master to replicants');
+
+my @replicant_names = keys %{ $replicated->schema->storage->replicants };
+
+## Silence warning about not supporting the is_replicating method if using the
+## sqlite dbs.
+$replicated->schema->storage->debugobj->silence(1)
+ if first { m{^t/} } @replicant_names;
+
isa_ok $replicated->schema->storage->balancer->current_replicant
- => 'DBIx::Class::Storage::DBI';
-
+ => 'DBIx::Class::Storage::DBI';
+
+$replicated->schema->storage->debugobj->silence(0);
+
ok $replicated->schema->storage->pool->has_replicants
=> 'does have replicants';
@@ -227,8 +318,6 @@
does_ok $replicated_storages[1]
=> 'DBIx::Class::Storage::DBI::Replicated::Replicant';
-my @replicant_names = keys %{$replicated->schema->storage->replicants};
-
does_ok $replicated->schema->storage->replicants->{$replicant_names[0]}
=> 'DBIx::Class::Storage::DBI::Replicated::Replicant';
@@ -249,8 +338,16 @@
$replicated->replicate;
$replicated->schema->storage->replicants->{$replicant_names[0]}->active(1);
$replicated->schema->storage->replicants->{$replicant_names[1]}->active(1);
+
+## Silence warning about not supporting the is_replicating method if using the
+## sqlite dbs.
+$replicated->schema->storage->debugobj->silence(1)
+ if first { m{^t/} } @replicant_names;
+
$replicated->schema->storage->pool->validate_replicants;
+$replicated->schema->storage->debugobj->silence(0);
+
## Make sure we can read the data.
ok my $artist1 = $replicated->schema->resultset('Artist')->find(4)
@@ -262,6 +359,28 @@
is $artist1->name, 'Ozric Tentacles'
=> 'Found expected name for first result';
+## Check that master_read_weight is honored
+{
+ no warnings 'once';
+
+ # turn off redefined warning
+ local $SIG{__WARN__} = sub {};
+
+ local
+ *DBIx::Class::Storage::DBI::Replicated::Balancer::Random::_random_number =
+ sub { 999 };
+
+ $replicated->schema->storage->balancer->increment_storage;
+
+ is $replicated->schema->storage->balancer->current_replicant,
+ $replicated->schema->storage->master
+ => 'master_read_weight is honored';
+
+ ## turn it off for the duration of the test
+ $replicated->schema->storage->balancer->master_read_weight(0);
+ $replicated->schema->storage->balancer->increment_storage;
+}
+
## Add some new rows that only the master will have This is because
## we overload any type of write operation so that is must hit the master
## database.
@@ -350,14 +469,34 @@
$replicated->schema->storage->replicants->{$replicant_names[0]}->active(0);
$replicated->schema->storage->replicants->{$replicant_names[1]}->active(0);
-
-ok $replicated->schema->resultset('Artist')->find(2)
- => 'Fallback to master';
+{
+ ## catch the fallback to master warning
+ open my $debugfh, '>', \my $fallback_warning;
+ my $oldfh = $replicated->schema->storage->debugfh;
+ $replicated->schema->storage->debugfh($debugfh);
+
+ ok $replicated->schema->resultset('Artist')->find(2)
+ => 'Fallback to master';
+
+ like $fallback_warning, qr/falling back to master/
+ => 'emits falling back to master warning';
+
+ $replicated->schema->storage->debugfh($oldfh);
+}
+
$replicated->schema->storage->replicants->{$replicant_names[0]}->active(1);
$replicated->schema->storage->replicants->{$replicant_names[1]}->active(1);
+
+## Silence warning about not supporting the is_replicating method if using the
+## sqlite dbs.
+$replicated->schema->storage->debugobj->silence(1)
+ if first { m{^t/} } @replicant_names;
+
$replicated->schema->storage->pool->validate_replicants;
+$replicated->schema->storage->debugobj->silence(0);
+
ok $replicated->schema->resultset('Artist')->find(2)
=> 'Returned to replicates';
@@ -577,3 +716,5 @@
## Delete the old database files
$replicated->cleanup;
+
+# vim: sw=4 sts=4 :
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/93storage_replication.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/94pk_mutation.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/94versioning.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/94versioning.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/94versioning.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -33,6 +33,8 @@
};
use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
+
use_ok('DBICVersionOrig');
my $schema_orig = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_version => 1 });
@@ -83,7 +85,7 @@
# should overwrite files and warn about it
my @w;
local $SIG{__WARN__} = sub {
- if ($_[0] =~ /^Overwriting/) {
+ if ($_[0] =~ /Overwriting existing/) {
push @w, $_[0];
}
else {
@@ -93,8 +95,8 @@
$schema_upgrade->create_ddl_dir('MySQL', '2.0', $ddl_dir, '1.0');
is (2, @w, 'A warning generated for both the DDL and the diff');
- like ($w[0], qr/^Overwriting existing DDL file - $fn->{v2}/, 'New version DDL overwrite warning');
- like ($w[1], qr/^Overwriting existing diff file - $fn->{trans}/, 'Upgrade diff overwrite warning');
+ like ($w[0], qr/Overwriting existing DDL file - $fn->{v2}/, 'New version DDL overwrite warning');
+ like ($w[1], qr/Overwriting existing diff file - $fn->{trans}/, 'Upgrade diff overwrite warning');
}
{
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/94versioning.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/95sql_maker.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/95sql_maker_quote.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96_is_deteministic_value.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96file_column.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96multi_create/cd_single.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96multi_create/multilev_might_have_PKeqFK.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/96multi_create.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/96multi_create.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/96multi_create.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -362,16 +362,16 @@
});
- ok( $cd_result && ref $cd_result eq 'DBICTest::CD', "Got Good CD Class");
+ isa_ok( $cd_result, 'DBICTest::CD', "Got Good CD Class");
ok( $cd_result->title eq "TestOneCD1", "Got Expected Title");
my $tracks = $cd_result->tracks;
- ok( ref $tracks eq "DBIx::Class::ResultSet", "Got Expected Tracks ResultSet");
+ isa_ok( $tracks, 'DBIx::Class::ResultSet', 'Got Expected Tracks ResultSet');
foreach my $track ($tracks->all)
{
- ok( $track && ref $track eq 'DBICTest::Track', 'Got Expected Track Class');
+ isa_ok( $track, 'DBICTest::Track', 'Got Expected Track Class');
}
}, 'First create_related pass');
@@ -391,17 +391,17 @@
});
- ok( $cd_result && ref $cd_result eq 'DBICTest::CD', "Got Good CD Class");
+ isa_ok( $cd_result, 'DBICTest::CD', "Got Good CD Class");
ok( $cd_result->title eq "TestOneCD2", "Got Expected Title");
ok( $cd_result->notes eq 'I can haz liner notes?', 'Liner notes');
my $tracks = $cd_result->tracks;
- ok( ref $tracks eq "DBIx::Class::ResultSet", "Got Expected Tracks ResultSet");
+ isa_ok( $tracks, 'DBIx::Class::ResultSet', "Got Expected Tracks ResultSet");
foreach my $track ($tracks->all)
{
- ok( $track && ref $track eq 'DBICTest::Track', 'Got Expected Track Class');
+ isa_ok( $track, 'DBICTest::Track', 'Got Expected Track Class');
}
}, 'second create_related with same arguments');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96multi_create.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96multi_create_new.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/96multi_create_torture.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/97result_class.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/98savepoints.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/99dbic_sqlt_parser.t
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: DBIx-Class/0.08/branches/multi_stuff/t/99rh_perl_perf_bug.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/99rh_perl_perf_bug.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/99rh_perl_perf_bug.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,121 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-use Test::More;
-use lib qw(t/lib);
-
-# This is a rather unusual test.
-# It does not test any aspect of DBIx::Class, but instead tests the
-# perl installation this is being run under to see if it is:-
-# 1. Potentially affected by a RH perl build bug
-# 2. If so we do a performance test for the effect of
-# that bug.
-#
-# You can skip these tests by setting the DBIC_NO_WARN_BAD_PERL env
-# variable
-#
-# If these tests fail then please read the section titled
-# Perl Performance Issues on Red Hat Systems in
-# L<DBIx::Class::Manual::Troubleshooting>
-
-plan skip_all =>
- 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set'
- if ( $ENV{DBIC_NO_WARN_BAD_PERL} );
-
-plan skip_all => 'Skipping as AUTOMATED_TESTING is set'
- if ( $ENV{AUTOMATED_TESTING} );
-
-eval "use Benchmark ':all'";
-plan skip_all => 'needs Benchmark for testing' if $@;
-
-plan tests => 3;
-
-ok( 1, 'Dummy - prevents next test timing out' );
-
-# we do a benchmark test filling an array with blessed/overloaded references,
-# against an array filled with array refs.
-# On a sane system the ratio between these operation sets is 1 - 1.5,
-# whereas a bugged system gives a ratio of around 8
-# we therefore consider there to be a problem if the ratio is >= 2
-
-my $results = timethese(
- -1, # run for 1 CPU second each
- {
- no_bless => sub {
- my %h;
- for ( my $i = 0 ; $i < 10000 ; $i++ ) {
- $h{$i} = [];
- }
- },
- bless_overload => sub {
- use overload q(<) => sub { };
- my %h;
- for ( my $i = 0 ; $i < 10000 ; $i++ ) {
- $h{$i} = bless [] => 'main';
- }
- },
- },
-);
-
-my $ratio = $results->{no_bless}->iters / $results->{bless_overload}->iters;
-
-ok( ( $ratio < 2 ), 'Overload/bless performance acceptable' )
- || diag(
- "\n",
- "This perl has a substantial slow down when handling large numbers\n",
- "of blessed/overloaded objects. This can severely adversely affect\n",
- "the performance of DBIx::Class programs. Please read the section\n",
- "in the Troubleshooting POD documentation entitled\n",
- "'Perl Performance Issues on Red Hat Systems'\n",
- "As this is an extremely serious condition, the only way to skip\n",
- "over this test is to --force the installation, or to edit the test\n",
- "file " . __FILE__ . "\n",
- );
-
-# We will only check for the difference in bless handling (whether the
-# bless applies to the reference or the referent) if we have seen a
-# performance issue...
-
-SKIP: {
- skip "Not checking for bless handling as performance is OK", 1
- if ( $ratio < 2 );
-
- {
- package # don't want this in PAUSE
- TestRHBug;
- use overload bool => sub { 0 }
- }
-
- sub _has_bug_34925 {
- my %thing;
- my $r1 = \%thing;
- my $r2 = \%thing;
- bless $r1 => 'TestRHBug';
- return !!$r2;
- }
-
- sub _possibly_has_bad_overload_performance {
- return $] < 5.008009 && !_has_bug_34925();
- }
-
- # If this next one fails then you almost certainly have a RH derived
- # perl with the performance bug
- # if this test fails, look at the section titled
- # "Perl Performance Issues on Red Hat Systems" in
- # L<DBIx::Class::Manual::Troubleshooting>
- # Basically you may suffer severe performance issues when running
- # DBIx::Class (and many other) modules. Look at getting a fixed
- # version of the perl interpreter for your system.
- #
- ok( !_possibly_has_bad_overload_performance(),
- 'Checking whether bless applies to reference not object' )
- || diag(
- "\n",
- "This perl is probably derived from a buggy Red Hat perl build\n",
- "Please read the section in the Troubleshooting POD documentation\n",
- "entitled 'Perl Performance Issues on Red Hat Systems'\n",
- "As this is an extremely serious condition, the only way to skip\n",
- "over this test is to --force the installation, or to edit the test\n",
- "file " . __FILE__ . "\n",
- );
-}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/bindtype_columns.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/01-columns.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/02-Film.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/03-subclassing.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/04-lazy.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/cdbi/04-lazy.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/cdbi/04-lazy.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -82,9 +82,9 @@
ok($@, $@);
-warning_is {
+warning_like {
Lazy->columns( TEMP => qw(that) );
-} "Declaring column that as TEMP but it already exists";
+} qr/Declaring column that as TEMP but it already exists/;
# Test that create() and update() throws out columns that changed
{
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/04-lazy.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/06-hasa.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/08-inheritcols.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/09-has_many.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/11-triggers.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/12-filter.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/13-constraint.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/14-might_have.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/15-accessor.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/16-reserved.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/18-has_a.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/19-set_sql.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/21-iterator.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/22-deflate_order.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/22-self_referential.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/23-cascade.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/24-meta_info.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/26-mutator.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/30-pager.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/68-inflate_has_a.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/98-failure.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/DeepAbstractSearch/01_search.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/abstract/search_where.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/columns_as_hashes.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/columns_dont_override_custom_accessors.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/construct.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/copy.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/early_column_heisenbug.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/has_many_loads_foreign_class.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/hasa_without_loading.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/max_min_value_of.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/mk_group_accessors.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/multi_column_set.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/object_cache.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/retrieve_from_sql_with_limit.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/set_to_undef.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/set_vs_DateTime.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/sweet/08pager.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Actor.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/ActorAlias.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Binary.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Blurb.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/CDBase.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/DBIC/Test/SQLite.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Director.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Film.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Lazy.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Log.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyBase.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyFilm.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyFoo.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyStar.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyStarLink.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/MyStarLinkMCPK.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Order.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/OtherFilm.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/OtherThing.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/PgBase.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/cdbi/testlib/Thing.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/count/distinct.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/count/distinct.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/count/distinct.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,99 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+
+use DBICTest;
+use DBIC::SqlMakerTest;
+
+my $schema = DBICTest->init_schema();
+
+eval "use DBD::SQLite";
+plan skip_all => 'needs DBD::SQLite for testing' if $@;
+plan tests => 22;
+
+# The tag Blue is assigned to cds 1 2 3 and 5
+# The tag Cheesy is assigned to cds 2 4 and 5
+#
+# This combination should make some interesting group_by's
+#
+my $rs;
+my $in_rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] });
+
+$rs = $schema->resultset('Tag')->search({ tag => 'Blue' });
+is($rs->count, 4, 'Count without DISTINCT');
+
+$rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] }, { group_by => 'tag' });
+is($rs->count, 2, 'Count with single column group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => [ 'Blue', 'Cheesy' ] }, { group_by => 'cd' });
+is($rs->count, 5, 'Count with another single column group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { group_by => [ qw/tag cd/ ]});
+is($rs->count, 4, 'Count with multiple column group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { distinct => 1 });
+is($rs->count, 4, 'Count with single column distinct');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } });
+is($rs->count, 7, 'Count with IN subquery');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { group_by => 'tag' });
+is($rs->count, 2, 'Count with IN subquery with outside group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { distinct => 1 });
+is($rs->count, 7, 'Count with IN subquery with outside distinct');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->get_column('tag')->as_query } }, { distinct => 1, select => 'tag' }),
+is($rs->count, 2, 'Count with IN subquery with outside distinct on a single column');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => 'tag' })->get_column('tag')->as_query } });
+is($rs->count, 7, 'Count with IN subquery with single group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => 'cd' })->get_column('tag')->as_query } });
+is($rs->count, 7, 'Count with IN subquery with another single group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => { -in => $in_rs->search({}, { group_by => [ qw/tag cd/ ] })->get_column('tag')->as_query } });
+is($rs->count, 7, 'Count with IN subquery with multiple group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => \"= 'Blue'" });
+is($rs->count, 4, 'Count without DISTINCT, using literal SQL');
+
+$rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => 'tag' });
+is($rs->count, 2, 'Count with literal SQL and single group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => 'cd' });
+is($rs->count, 5, 'Count with literal SQL and another single group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => [ qw/tag cd/ ] });
+is($rs->count, 7, 'Count with literal SQL and multiple group_by');
+
+$rs = $schema->resultset('Tag')->search({ tag => 'Blue' }, { '+select' => { max => 'tagid' }, distinct => 1 });
+is($rs->count, 4, 'Count with +select aggreggate');
+
+$rs = $schema->resultset('Tag')->search({}, { select => 'length(me.tag)', distinct => 1 });
+is($rs->count, 3, 'Count by distinct function result as select literal');
+
+eval {
+ my @warnings;
+ local $SIG{__WARN__} = sub { $_[0] =~ /The select => { distinct => ... } syntax will be deprecated/
+ ? push @warnings, @_
+ : warn @_
+ };
+ my $row = $schema->resultset('Tag')->search({}, { select => { distinct => 'tag' } })->first;
+ is (@warnings, 1, 'Warned about deprecated distinct') if $DBIx::Class::VERSION < 0.09;
+};
+ok ($@, 'Exception on deprecated distinct usage thrown') if $DBIx::Class::VERSION >= 0.09;
+
+throws_ok(
+ sub { my $row = $schema->resultset('Tag')->search({}, { select => { distinct => [qw/tag cd/] } })->first },
+ qr/select => { distinct => ... } syntax is not supported for multiple columns/,
+ 'throw on unsupported syntax'
+);
+
+# These two rely on the database to throw an exception. This might not be the case one day. Please revise.
+dies_ok(sub { my $count = $schema->resultset('Tag')->search({}, { '+select' => \'tagid AS tag_id', distinct => 1 })->count }, 'expecting to die');
+dies_ok(sub { my $count = $schema->resultset('Tag')->search({}, { select => { length => 'tag' }, distinct => 1 })->count }, 'expecting to die');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/count/distinct.t
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/count/grouped_pager.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/count/grouped_pager.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/count/grouped_pager.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib qw(t/lib);
+
+use DBICTest;
+
+plan tests => 7;
+
+my $schema = DBICTest->init_schema();
+
+use Data::Dumper;
+
+# add 2 extra artists
+$schema->populate ('Artist', [
+ [qw/name/],
+ [qw/ar_1/],
+ [qw/ar_2/],
+]);
+
+# add 3 extra cds to every artist
+for my $ar ($schema->resultset ('Artist')->all) {
+ for my $cdnum (1 .. 3) {
+ $ar->create_related ('cds', {
+ title => "bogon $cdnum",
+ year => 2000 + $cdnum,
+ });
+ }
+}
+
+my $cds = $schema->resultset ('CD')->search ({}, { group_by => 'artist' } );
+is ($cds->count, 5, 'Resultset collapses to 5 groups');
+
+my ($pg1, $pg2, $pg3) = map { $cds->search_rs ({}, {rows => 2, page => $_}) } (1..3);
+
+for ($pg1, $pg2, $pg3) {
+ is ($_->pager->total_entries, 5, 'Total count via pager correct');
+}
+
+is ($pg1->count, 2, 'First page has 2 groups');
+is ($pg2->count, 2, 'Second page has 2 groups');
+is ($pg3->count, 1, 'Third page has one group remaining');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/count/grouped_pager.t
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/count/in_subquery.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/count/in_subquery.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/count/in_subquery.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Data::Dumper;
+
+use Test::More;
+
+plan ( tests => 1 );
+
+use lib qw(t/lib);
+use DBICTest;
+use DBIC::SqlMakerTest;
+
+my $schema = DBICTest->init_schema();
+
+{
+ my $rs = $schema->resultset("CD")->search(
+ { 'artist.name' => 'Caterwauler McCrae' },
+ { join => [qw/artist/]}
+ );
+ my $squery = $rs->get_column('cdid')->as_query;
+ my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $squery } } );
+ is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/count/in_subquery.t
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/count/joined.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/count/joined.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/count/joined.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib qw(t/lib);
+
+use DBICTest;
+
+plan tests => 3;
+
+my $schema = DBICTest->init_schema();
+
+my $cds = $schema->resultset("CD")->search({ cdid => 1 }, { join => { cd_to_producer => 'producer' } });
+cmp_ok($cds->count, '>', 1, "extra joins explode entity count");
+
+is (
+ $cds->search({}, { prefetch => 'cd_to_producer' })->count,
+ 1,
+ "Count correct with extra joins collapsed by prefetch"
+);
+
+is (
+ $cds->search({}, { distinct => 1 })->count,
+ 1,
+ "Count correct with requested distinct collapse of main table"
+);
+
+
+
+
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/count/joined.t
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/count/prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/count/prefetch.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/count/prefetch.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,63 @@
+use strict;
+use warnings;
+
+use lib qw(t/lib);
+
+use Test::More;
+use DBICTest;
+use DBIC::SqlMakerTest;
+use DBIC::DebugObj;
+
+plan tests => 6;
+
+my $schema = DBICTest->init_schema();
+
+# collapsing prefetch
+{
+ my $rs = $schema->resultset("Artist")
+ ->search_related('cds',
+ { 'tracks.position' => [1,2] },
+ { prefetch => [qw/tracks artist/] },
+ );
+ is ($rs->all, 5, 'Correct number of objects');
+
+
+ my ($sql, @bind);
+ $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
+ $schema->storage->debug(1);
+
+
+ is ($rs->count, 5, 'Correct count');
+
+ is_same_sql_bind (
+ $sql,
+ \@bind,
+ 'SELECT COUNT( * ) FROM (SELECT cds.cdid FROM artist me LEFT JOIN cd cds ON cds.artist = me.artistid LEFT JOIN track tracks ON tracks.cd = cds.cdid JOIN artist artist ON artist.artistid = cds.artist WHERE tracks.position = ? OR tracks.position = ? GROUP BY cds.cdid) count_subq',
+ [ qw/'1' '2'/ ],
+ );
+}
+
+# non-collapsing prefetch (no multi prefetches)
+{
+ my $rs = $schema->resultset("CD")
+ ->search_related('tracks',
+ { position => [1,2] },
+ { prefetch => [qw/disc lyrics/] },
+ );
+ is ($rs->all, 10, 'Correct number of objects');
+
+
+ my ($sql, @bind);
+ $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
+ $schema->storage->debug(1);
+
+
+ is ($rs->count, 10, 'Correct count');
+
+ is_same_sql_bind (
+ $sql,
+ \@bind,
+ 'SELECT COUNT( * ) FROM cd me LEFT JOIN track tracks ON tracks.cd = me.cdid JOIN cd disc ON disc.cdid = tracks.cd LEFT JOIN lyrics lyrics ON lyrics.track_id = tracks.trackid WHERE ( ( position = ? OR position = ? ) )',
+ [ qw/'1' '2'/ ],
+ );
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/count/prefetch.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/dbh_do.t
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: DBIx-Class/0.08/branches/multi_stuff/t/delete/m2m.t (from rev 5335, DBIx-Class/0.08/branches/multi_stuff/t/deleting_many_to_many.t)
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/delete/m2m.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/delete/m2m.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+plan tests => 5;
+
+my $cd = $schema->resultset("CD")->find(2);
+ok $cd->liner_notes;
+ok keys %{$cd->{_relationship_data}}, "_relationship_data populated";
+
+$cd->discard_changes;
+ok $cd->liner_notes, 'relationships still valid after discarding changes';
+
+ok $cd->liner_notes->delete;
+$cd->discard_changes;
+ok !$cd->liner_notes, 'discard_changes resets relationship';
\ No newline at end of file
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/delete/m2m.t
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: DBIx-Class/0.08/branches/multi_stuff/t/delete/related.t (from rev 5335, DBIx-Class/0.08/branches/multi_stuff/t/53delete_related.t)
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/delete/related.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/delete/related.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,45 @@
+use Test::More;
+use strict;
+use warnings;
+use lib qw(t/lib);
+use DBICTest;
+
+plan tests => 3;
+
+my $schema = DBICTest->init_schema();
+
+my $ars = $schema->resultset('Artist');
+my $cdrs = $schema->resultset('CD');
+
+# create some custom entries
+$ars->populate ([
+ [qw/artistid name/],
+ [qw/71 a1/],
+ [qw/72 a2/],
+ [qw/73 a3/],
+]);
+$cdrs->populate ([
+ [qw/cdid artist title year/],
+ [qw/70 71 delete0 2005/],
+ [qw/71 72 delete1 2005/],
+ [qw/72 72 delete2 2005/],
+ [qw/73 72 delete3 2006/],
+ [qw/74 72 delete4 2007/],
+ [qw/75 73 delete5 2008/],
+]);
+
+my $total_cds = $cdrs->count;
+
+# test that delete_related w/o conditions deletes all related records only
+$ars->search ({name => 'a3' })->search_related ('cds')->delete;
+is ($cdrs->count, $total_cds -= 1, 'related delete ok');
+
+my $a2_cds = $ars->search ({ name => 'a2' })->search_related ('cds');
+
+# test that related deletion w/conditions deletes just the matched related records only
+$a2_cds->search ({ year => 2005 })->delete;
+is ($cdrs->count, $total_cds -= 2, 'related + condition delete ok');
+
+# test that related deletion with limit condition works
+$a2_cds->search ({}, { rows => 1})->delete;
+is ($cdrs->count, $total_cds -= 1, 'related + limit delete ok');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/delete/related.t
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: DBIx-Class/0.08/branches/multi_stuff/t/deleting_many_to_many.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/deleting_many_to_many.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/deleting_many_to_many.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,23 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use warnings;
-
-use Test::More;
-use lib qw(t/lib);
-use DBICTest;
-
-my $schema = DBICTest->init_schema();
-
-plan tests => 5;
-
-my $cd = $schema->resultset("CD")->find(2);
-ok $cd->liner_notes;
-ok keys %{$cd->{_relationship_data}}, "_relationship_data populated";
-
-$cd->discard_changes;
-ok $cd->liner_notes, 'relationships still valid after discarding changes';
-
-ok $cd->liner_notes->delete;
-$cd->discard_changes;
-ok !$cd->liner_notes, 'discard_changes resets relationship';
\ No newline at end of file
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/discard_changes_in_DESTROY.t
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/from_subquery.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/from_subquery.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/from_subquery.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,174 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Test::More;
+
+BEGIN {
+ eval "use SQL::Abstract 1.49";
+ plan $@
+ ? ( skip_all => "Needs SQLA 1.49+" )
+ : ( tests => 8 );
+}
+
+use lib qw(t/lib);
+use DBICTest;
+use DBIC::SqlMakerTest;
+
+my $schema = DBICTest->init_schema();
+my $art_rs = $schema->resultset('Artist');
+my $cdrs = $schema->resultset('CD');
+
+{
+ my $cdrs2 = $cdrs->search({
+ artist_id => { 'in' => $art_rs->search({}, { rows => 1 })->get_column( 'id' )->as_query },
+ });
+
+ is_same_sql_bind(
+ $cdrs2->as_query,
+ "(SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me LIMIT 1 ))",
+ [],
+ );
+}
+
+{
+ my $rs = $art_rs->search(
+ {},
+ {
+ 'select' => [
+ $cdrs->search({}, { rows => 1 })->get_column('id')->as_query,
+ ],
+ },
+ );
+
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT (SELECT id FROM cd me LIMIT 1) FROM artist me)",
+ [],
+ );
+}
+
+{
+ my $rs = $art_rs->search(
+ {},
+ {
+ '+select' => [
+ $cdrs->search({}, { rows => 1 })->get_column('id')->as_query,
+ ],
+ },
+ );
+
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT me.artistid, me.name, me.rank, me.charfield, (SELECT id FROM cd me LIMIT 1) FROM artist me)",
+ [],
+ );
+}
+
+# simple from
+{
+ my $rs = $cdrs->search(
+ {},
+ {
+ alias => 'cd2',
+ from => [
+ { cd2 => $cdrs->search({ id => { '>' => 20 } })->as_query },
+ ],
+ },
+ );
+
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE ( id > ? ) ) cd2)",
+ [
+ [ 'id', 20 ]
+ ],
+ );
+}
+
+# nested from
+{
+ my $art_rs2 = $schema->resultset('Artist')->search({},
+ {
+ from => [ { 'me' => 'artist' },
+ [ { 'cds' => $cdrs->search({},{ 'select' => [\'me.artist as cds_artist' ]})->as_query },
+ { 'me.artistid' => 'cds_artist' } ] ]
+ });
+
+ is_same_sql_bind(
+ $art_rs2->as_query,
+ "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me JOIN (SELECT me.artist as cds_artist FROM cd me) cds ON me.artistid = cds_artist)",
+ []
+ );
+
+
+}
+
+# nested subquery in from
+{
+ my $rs = $cdrs->search(
+ {},
+ {
+ alias => 'cd2',
+ from => [
+ { cd2 => $cdrs->search(
+ { id => { '>' => 20 } },
+ {
+ alias => 'cd3',
+ from => [
+ { cd3 => $cdrs->search( { id => { '<' => 40 } } )->as_query }
+ ],
+ }, )->as_query },
+ ],
+ },
+ );
+
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track
+ FROM
+ (SELECT cd3.cdid,cd3.artist,cd3.title,cd3.year,cd3.genreid,cd3.single_track
+ FROM
+ (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track
+ FROM cd me WHERE ( id < ? ) ) cd3
+ WHERE ( id > ? ) ) cd2)",
+ [
+ [ 'id', 40 ],
+ [ 'id', 20 ]
+ ],
+ );
+
+}
+
+{
+ my $rs = $cdrs->search({
+ year => {
+ '=' => $cdrs->search(
+ { artistid => { '=' => \'me.artistid' } },
+ { alias => 'inner' }
+ )->get_column('year')->max_rs->as_query,
+ },
+ });
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE year = (SELECT MAX(inner.year) FROM cd inner WHERE artistid = me.artistid))",
+ [],
+ );
+}
+
+{
+ my $rs = $cdrs->search(
+ {},
+ {
+ alias => 'cd2',
+ from => [
+ { cd2 => $cdrs->search({ title => 'Thriller' })->as_query },
+ ],
+ },
+ );
+
+ is_same_sql_bind(
+ $rs->as_query,
+ "(SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE ( title = ? ) ) cd2)",
+ [ [ 'title', 'Thriller' ] ],
+ );
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/from_subquery.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBIC/SqlMakerTest.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBIC/SqlMakerTest.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBIC/SqlMakerTest.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,145 +3,53 @@
use strict;
use warnings;
-use base qw/Test::Builder::Module Exporter/;
+use base qw/Exporter/;
+use Carp;
+use SQL::Abstract::Test;
+
our @EXPORT = qw/
- &is_same_sql_bind
- &is_same_sql
- &is_same_bind
- &eq_sql
- &eq_bind
- &eq_sql_bind
+ is_same_sql_bind
+ is_same_sql
+ is_same_bind
/;
+our @EXPORT_OK = qw/
+ eq_sql
+ eq_bind
+ eq_sql_bind
+/;
+sub is_same_sql_bind {
+ # unroll possible as_query arrayrefrefs
+ my @args;
-{
- package DBIC::SqlMakerTest::SQLATest;
+ for (1,2) {
+ my $chunk = shift @_;
- # replacement for SQL::Abstract::Test if not available
-
- use strict;
- use warnings;
-
- use base qw/Test::Builder::Module Exporter/;
-
- use Scalar::Util qw(looks_like_number blessed reftype);
- use Data::Dumper;
- use Test::Builder;
- use Test::Deep qw(eq_deeply);
-
- our $tb = __PACKAGE__->builder;
-
- sub is_same_sql_bind
- {
- my ($sql1, $bind_ref1, $sql2, $bind_ref2, $msg) = @_;
-
- my $same_sql = eq_sql($sql1, $sql2);
- my $same_bind = eq_bind($bind_ref1, $bind_ref2);
-
- $tb->ok($same_sql && $same_bind, $msg);
-
- if (!$same_sql) {
- _sql_differ_diag($sql1, $sql2);
+ if ( ref $chunk eq 'REF' and ref $$chunk eq 'ARRAY' ) {
+ my ($sql, @bind) = @$$chunk;
+ push @args, ($sql, \@bind);
}
- if (!$same_bind) {
- _bind_differ_diag($bind_ref1, $bind_ref2);
+ else {
+ push @args, $chunk, shift @_;
}
- }
- sub is_same_sql
- {
- my ($sql1, $sql2, $msg) = @_;
-
- my $same_sql = eq_sql($sql1, $sql2);
-
- $tb->ok($same_sql, $msg);
-
- if (!$same_sql) {
- _sql_differ_diag($sql1, $sql2);
- }
}
- sub is_same_bind
- {
- my ($bind_ref1, $bind_ref2, $msg) = @_;
+ push @args, shift @_;
- my $same_bind = eq_bind($bind_ref1, $bind_ref2);
+ croak "Unexpected argument(s) supplied to is_same_sql_bind: " . join ('; ', @_)
+ if @_;
- $tb->ok($same_bind, $msg);
-
- if (!$same_bind) {
- _bind_differ_diag($bind_ref1, $bind_ref2);
- }
- }
-
- sub _sql_differ_diag
- {
- my ($sql1, $sql2) = @_;
-
- $tb->diag("SQL expressions differ\n"
- . " got: $sql1\n"
- . "expected: $sql2\n"
- );
- }
-
- sub _bind_differ_diag
- {
- my ($bind_ref1, $bind_ref2) = @_;
-
- $tb->diag("BIND values differ\n"
- . " got: " . Dumper($bind_ref1)
- . "expected: " . Dumper($bind_ref2)
- );
- }
-
- sub eq_sql
- {
- my ($left, $right) = @_;
-
- $left =~ s/\s+//g;
- $right =~ s/\s+//g;
-
- return $left eq $right;
- }
-
- sub eq_bind
- {
- my ($bind_ref1, $bind_ref2) = @_;
-
- return eq_deeply($bind_ref1, $bind_ref2);
- }
-
- sub eq_sql_bind
- {
- my ($sql1, $bind_ref1, $sql2, $bind_ref2) = @_;
-
- return eq_sql($sql1, $sql2) && eq_bind($bind_ref1, $bind_ref2);
- }
+ SQL::Abstract::Test::is_same_sql_bind (@args);
}
-eval "use SQL::Abstract::Test;";
-if ($@ eq '') {
- # SQL::Abstract::Test available
+*is_same_sql = \&SQL::Abstract::Test::is_same_sql;
+*is_same_bind = \&SQL::Abstract::Test::is_same_bind;
+*eq_sql = \&SQL::Abstract::Test::eq_sql;
+*eq_bind = \&SQL::Abstract::Test::eq_bind;
+*eq_sql_bind = \&SQL::Abstract::Test::eq_sql_bind;
- *is_same_sql_bind = \&SQL::Abstract::Test::is_same_sql_bind;
- *is_same_sql = \&SQL::Abstract::Test::is_same_sql;
- *is_same_bind = \&SQL::Abstract::Test::is_same_bind;
- *eq_sql = \&SQL::Abstract::Test::eq_sql;
- *eq_bind = \&SQL::Abstract::Test::eq_bind;
- *eq_sql_bind = \&SQL::Abstract::Test::eq_sql_bind;
-} else {
- # old SQL::Abstract
-
- *is_same_sql_bind = \&DBIC::SqlMakerTest::SQLATest::is_same_sql_bind;
- *is_same_sql = \&DBIC::SqlMakerTest::SQLATest::is_same_sql;
- *is_same_bind = \&DBIC::SqlMakerTest::SQLATest::is_same_bind;
- *eq_sql = \&DBIC::SqlMakerTest::SQLATest::eq_sql;
- *eq_bind = \&DBIC::SqlMakerTest::SQLATest::eq_bind;
- *eq_sql_bind = \&DBIC::SqlMakerTest::SQLATest::eq_sql_bind;
-}
-
-
1;
__END__
@@ -167,23 +75,31 @@
Exports functions that can be used to compare generated SQL and bind values.
-If L<SQL::Abstract::Test> (packaged in L<SQL::Abstract> versions 1.50 and
-above) is available, then it is used to perform the comparisons (all functions
-are delegated to id). Otherwise uses simple string comparison for the SQL
-statements and simple L<Data::Dumper>-like recursive stringification for
-comparison of bind values.
+This is a thin wrapper around L<SQL::Abstract::Test>, which makes it easier
+to compare as_query sql/bind arrayrefrefs directly.
-
=head1 FUNCTIONS
=head2 is_same_sql_bind
is_same_sql_bind(
- $given_sql, \@given_bind,
+ $given_sql, \@given_bind,
$expected_sql, \@expected_bind,
$test_msg
);
+ is_same_sql_bind(
+ $rs->as_query
+ $expected_sql, \@expected_bind,
+ $test_msg
+ );
+
+ is_same_sql_bind(
+ \[$given_sql, @given_bind],
+ $expected_sql, \@expected_bind,
+ $test_msg
+ );
+
Compares given and expected pairs of C<($sql, \@bind)>, and calls
L<Test::Builder/ok> on the result, with C<$test_msg> as message.
@@ -245,4 +161,4 @@
Copyright 2008 by Norbert Buchmuller.
This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+it under the same terms as Perl itself.
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/OtherRslt/D.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RSBase.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RSet/A.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RSet/C.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Result/A.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Result/B.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/ResultSet/A.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/ResultSet/C.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Rslt/A.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/Rslt/B.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/ResultSet/Foo.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/ResultSet.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema/Foo/Sub.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema/Foo.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema_A/A/Sub.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICNSTest/RtBug41083/Schema_A/A.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/AuthorCheck.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/AuthorCheck.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/AuthorCheck.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,106 @@
+package # hide from PAUSE
+ DBICTest::AuthorCheck;
+
+use strict;
+use warnings;
+
+use Path::Class qw/file dir/;
+
+_check_author_makefile() unless $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION};
+
+# Die if the author did not update his makefile
+#
+# This is pretty heavy handed, so the check is pretty solid:
+#
+# 1) Assume that this particular module is loaded from -I <$root>/t/lib
+# 2) Make sure <$root>/Makefile.PL exists
+# 3) Make sure we can stat() <$root>/Makefile.PL
+#
+# If all of the above is satisfied
+#
+# *) die if <$root>/inc does not exist
+# *) die if no stat() results for <$root>/Makefile (covers no Makefile)
+# *) die if Makefile.PL mtime > Makefile mtime
+#
+sub _check_author_makefile {
+
+ my $root = _find_co_root()
+ or return;
+
+ # not using file->stat as it invokes File::stat which in turn breaks stat(_)
+ my ($mf_pl_mtime, $mf_mtime) = ( map
+ { (stat ($root->file ($_)) )[9] }
+ qw/Makefile.PL Makefile/
+ );
+
+ return unless $mf_pl_mtime; # something went wrong during co_root detection ?
+
+ if (
+ not -d $root->subdir ('inc')
+ or
+ not $mf_mtime
+ or
+ $mf_mtime < $mf_pl_mtime
+ ) {
+ print STDERR <<'EOE';
+
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+======================== FATAL ERROR ===========================
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+We have a number of reasons to believe that this is a development
+checkout and that you, the user, did not run `perl Makefile.PL`
+before using this code. You absolutely _must_ perform this step,
+as not doing so often results in a lot of wasted time for other
+contributors trying to assit you with "it broke!" problems.
+
+If you are seeing this message unexpectedly (i.e. you are in fact
+attempting a regular installation be it through CPAN or manually,
+set the variable DBICTEST_NO_MAKEFILE_VERIFICATION to a true value
+so you can continue. Also _make_absolutely_sure_ to report this to
+either the mailing list or to the irc channel as described in
+
+http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT
+
+Failure to do this will make us believe that all these checks are
+indeed foolproof and we will remove the ability to override this
+entirely.
+
+The DBIC team
+
+
+
+EOE
+
+ exit 1;
+ }
+}
+
+# Try to determine the root of a checkout/untar if possible
+# or return undef
+sub _find_co_root {
+
+ my @mod_parts = split /::/, (__PACKAGE__ . '.pm');
+ my $rel_path = file (@mod_parts);
+
+ return undef unless ($INC{$rel_path});
+
+ # a bit convoluted, but what we do here essentially is:
+ # - get the file name of this particular module
+ # - do 'cd ..' as many times as necessary to get to t/lib/../..
+
+ my $root = dir ($INC{$rel_path});
+ for (0 .. @mod_parts + 1) {
+ $root = $root->parent;
+ }
+
+ return (-f $root->file ('Makefile.PL') )
+ ? $root
+ : undef
+ ;
+}
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/AuthorCheck.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResult.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResult.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResult.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,14 @@
+package #hide from pause
+ DBICTest::BaseResult;
+
+use strict;
+use warnings;
+
+use base qw/DBIx::Class/;
+use DBICTest::BaseResultSet;
+
+__PACKAGE__->load_components (qw/Core/);
+__PACKAGE__->table ('bogus');
+__PACKAGE__->resultset_class ('DBICTest::BaseResultSet');
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResult.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResultSet.pm (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResultSet.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,13 @@
+package #hide from pause
+ DBICTest::BaseResultSet;
+
+use strict;
+use warnings;
+
+use base qw/DBIx::Class::ResultSet/;
+
+sub hri_dump {
+ return shift->search ({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' });
+}
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/BaseResultSet.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ErrorComponent.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/FakeComponent.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ForeignComponent/TestComp.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ForeignComponent.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/OptionalComponent.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Plain/Test.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Plain.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ResultSetManager/Foo.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/ResultSetManager.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artist.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artist.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Artist;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('artist');
__PACKAGE__->source_info({
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artist.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistSourceName.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistSubclass.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::ArtistUndirectedMap;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('artist_undirected_map');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Artwork;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('cd_artwork');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork_to_Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork_to_Artist.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork_to_Artist.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Artwork_to_Artist;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('artwork_to_artist');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Artwork_to_Artist.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BindType.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BindType.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BindType.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::BindType;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('bindtype_test');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BindType.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Bookmark.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Bookmark.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Bookmark.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Bookmark;
- use base 'DBIx::Class::Core';
+ use base qw/DBICTest::BaseResult/;
use strict;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Bookmark.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BooksInLibrary.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BooksInLibrary.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BooksInLibrary.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,32 +1,32 @@
-package # hide from PAUSE
- DBICTest::Schema::BooksInLibrary;
-
-use base qw/DBIx::Class::Core/;
-
-__PACKAGE__->table('books');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'source' => {
- data_type => 'varchar',
- size => '100',
- },
- 'owner' => {
- data_type => 'integer',
- },
- 'title' => {
- data_type => 'varchar',
- size => '100',
- },
- 'price' => {
- data_type => 'integer',
- is_nullable => 1,
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-__PACKAGE__->resultset_attributes({where => { source => "Library" } });
-
-1;
+package # hide from PAUSE
+ DBICTest::Schema::BooksInLibrary;
+
+use base qw/DBICTest::BaseResult/;
+
+__PACKAGE__->table('books');
+__PACKAGE__->add_columns(
+ 'id' => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ 'source' => {
+ data_type => 'varchar',
+ size => '100',
+ },
+ 'owner' => {
+ data_type => 'integer',
+ },
+ 'title' => {
+ data_type => 'varchar',
+ size => '100',
+ },
+ 'price' => {
+ data_type => 'integer',
+ is_nullable => 1,
+ },
+);
+__PACKAGE__->set_primary_key('id');
+
+__PACKAGE__->resultset_attributes({where => { source => "Library" } });
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/BooksInLibrary.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::CD;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('cd');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD_to_Producer.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD_to_Producer.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD_to_Producer.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,12 +1,13 @@
package # hide from PAUSE
DBICTest::Schema::CD_to_Producer;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('cd_to_producer');
__PACKAGE__->add_columns(
cd => { data_type => 'integer' },
producer => { data_type => 'integer' },
+ attribute => { data_type => 'integer', is_nullable => 1 },
);
__PACKAGE__->set_primary_key(qw/cd producer/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CD_to_Producer.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Collection.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Collection.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Collection.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,30 +1,30 @@
-package # hide from PAUSE
- DBICTest::Schema::Collection;
-
-use base qw/DBIx::Class::Core/;
-
-__PACKAGE__->table('collection');
-__PACKAGE__->add_columns(
- 'collectionid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('collectionid');
-
-__PACKAGE__->has_many( collection_object => "DBICTest::Schema::CollectionObject",
- { "foreign.collection" => "self.collectionid" }
- );
-__PACKAGE__->many_to_many( objects => collection_object => "object" );
-__PACKAGE__->many_to_many( pointy_objects => collection_object => "object",
- { where => { "object.type" => "pointy" } }
- );
-__PACKAGE__->many_to_many( round_objects => collection_object => "object",
- { where => { "object.type" => "round" } }
- );
-
-1;
+package # hide from PAUSE
+ DBICTest::Schema::Collection;
+
+use base qw/DBICTest::BaseResult/;
+
+__PACKAGE__->table('collection');
+__PACKAGE__->add_columns(
+ 'collectionid' => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ 'name' => {
+ data_type => 'varchar',
+ size => 100,
+ },
+);
+__PACKAGE__->set_primary_key('collectionid');
+
+__PACKAGE__->has_many( collection_object => "DBICTest::Schema::CollectionObject",
+ { "foreign.collection" => "self.collectionid" }
+ );
+__PACKAGE__->many_to_many( objects => collection_object => "object" );
+__PACKAGE__->many_to_many( pointy_objects => collection_object => "object",
+ { where => { "object.type" => "pointy" } }
+ );
+__PACKAGE__->many_to_many( round_objects => collection_object => "object",
+ { where => { "object.type" => "round" } }
+ );
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Collection.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CollectionObject.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CollectionObject.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CollectionObject.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,24 +1,24 @@
-package # hide from PAUSE
- DBICTest::Schema::CollectionObject;
-
-use base qw/DBIx::Class::Core/;
-
-__PACKAGE__->table('collection_object');
-__PACKAGE__->add_columns(
- 'collection' => {
- data_type => 'integer',
- },
- 'object' => {
- data_type => 'integer',
- },
-);
-__PACKAGE__->set_primary_key(qw/collection object/);
-
-__PACKAGE__->belongs_to( collection => "DBICTest::Schema::Collection",
- { "foreign.collectionid" => "self.collection" }
- );
-__PACKAGE__->belongs_to( object => "DBICTest::Schema::TypedObject",
- { "foreign.objectid" => "self.object" }
- );
-
-1;
+package # hide from PAUSE
+ DBICTest::Schema::CollectionObject;
+
+use base qw/DBICTest::BaseResult/;
+
+__PACKAGE__->table('collection_object');
+__PACKAGE__->add_columns(
+ 'collection' => {
+ data_type => 'integer',
+ },
+ 'object' => {
+ data_type => 'integer',
+ },
+);
+__PACKAGE__->set_primary_key(qw/collection object/);
+
+__PACKAGE__->belongs_to( collection => "DBICTest::Schema::Collection",
+ { "foreign.collectionid" => "self.collection" }
+ );
+__PACKAGE__->belongs_to( object => "DBICTest::Schema::TypedObject",
+ { "foreign.objectid" => "self.object" }
+ );
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/CollectionObject.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Dummy.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Dummy.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Dummy.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Dummy;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
use strict;
use warnings;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Dummy.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Employee.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Employee.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Employee.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Employee;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->load_components(qw( Ordered ));
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Employee.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Encoded.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Encoded.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Encoded.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Encoded;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
use strict;
use warnings;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Encoded.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Event.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Event.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Event.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Event.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZ.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZ.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZ.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZ.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZDeprecated.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZDeprecated.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZDeprecated.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/EventTZDeprecated.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FileColumn.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FileColumn.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FileColumn.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
use File::Temp qw/tempdir/;
__PACKAGE__->load_components(qw/InflateColumn::File/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FileColumn.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ForceForeign.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ForceForeign.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ForceForeign.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::ForceForeign;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('forceforeign');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/ForceForeign.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::FourKeys;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('fourkeys');
__PACKAGE__->add_columns(
@@ -9,7 +9,8 @@
'bar' => { data_type => 'integer' },
'hello' => { data_type => 'integer' },
'goodbye' => { data_type => 'integer' },
- 'sensors' => { data_type => 'character' },
+ 'sensors' => { data_type => 'character', size => 10 },
+ 'read_count' => { data_type => 'integer', is_nullable => 1 },
);
__PACKAGE__->set_primary_key(qw/foo bar hello goodbye/);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::FourKeys_to_TwoKeys;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('fourkeys_to_twokeys');
__PACKAGE__->add_columns(
@@ -12,6 +12,7 @@
't_artist' => { data_type => 'integer' },
't_cd' => { data_type => 'integer' },
'autopilot' => { data_type => 'character' },
+ 'pilot_sequence' => { data_type => 'integer', is_nullable => 1 },
);
__PACKAGE__->set_primary_key(
qw/f_foo f_bar f_hello f_goodbye t_artist t_cd/
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Genre.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Genre.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Genre.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,7 @@
use strict;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('genre');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Genre.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Image.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Image.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Image.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Image;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('images');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Image.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LinerNotes.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LinerNotes.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LinerNotes.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::LinerNotes;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('liner_notes');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LinerNotes.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Link.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Link.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Link.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Link;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
use strict;
use warnings;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Link.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LyricVersion.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LyricVersion.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LyricVersion.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::LyricVersion;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('lyric_versions');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/LyricVersion.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Lyrics.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Lyrics.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Lyrics.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Lyrics;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('lyrics');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Lyrics.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoPrimaryKey.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoPrimaryKey.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoPrimaryKey.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::NoPrimaryKey;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('noprimarykey');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoPrimaryKey.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/NoSuchClass.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/OneKey.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/OneKey.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/OneKey.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::OneKey;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('onekey');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/OneKey.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Owners.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Owners.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Owners.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,21 +1,21 @@
-package # hide from PAUSE
- DBICTest::Schema::Owners;
-
-use base qw/DBIx::Class::Core/;
-
-__PACKAGE__->table('owners');
-__PACKAGE__->add_columns(
- 'ownerid' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => '100',
- },
-);
-__PACKAGE__->set_primary_key('ownerid');
-
-__PACKAGE__->has_many(books => "DBICTest::Schema::BooksInLibrary", "owner");
-
-1;
+package # hide from PAUSE
+ DBICTest::Schema::Owners;
+
+use base qw/DBICTest::BaseResult/;
+
+__PACKAGE__->table('owners');
+__PACKAGE__->add_columns(
+ 'ownerid' => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ 'name' => {
+ data_type => 'varchar',
+ size => '100',
+ },
+);
+__PACKAGE__->set_primary_key('ownerid');
+
+__PACKAGE__->has_many(books => "DBICTest::Schema::BooksInLibrary", "owner");
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Owners.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Producer.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Producer.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Producer.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Producer;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('producer');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Producer.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRef.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRef.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRef.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,21 +1,21 @@
-package # hide from PAUSE
- DBICTest::Schema::SelfRef;
-
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->table('self_ref');
-__PACKAGE__->add_columns(
- 'id' => {
- data_type => 'integer',
- is_auto_increment => 1,
- },
- 'name' => {
- data_type => 'varchar',
- size => 100,
- },
-);
-__PACKAGE__->set_primary_key('id');
-
-__PACKAGE__->has_many( aliases => 'DBICTest::Schema::SelfRefAlias' => 'self_ref' );
-
-1;
+package # hide from PAUSE
+ DBICTest::Schema::SelfRef;
+
+use base qw/DBICTest::BaseResult/;
+
+__PACKAGE__->table('self_ref');
+__PACKAGE__->add_columns(
+ 'id' => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ 'name' => {
+ data_type => 'varchar',
+ size => 100,
+ },
+);
+__PACKAGE__->set_primary_key('id');
+
+__PACKAGE__->has_many( aliases => 'DBICTest::Schema::SelfRefAlias' => 'self_ref' );
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRef.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRefAlias.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRefAlias.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRefAlias.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,20 +1,20 @@
-package # hide from PAUSE
- DBICTest::Schema::SelfRefAlias;
-
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->table('self_ref_alias');
-__PACKAGE__->add_columns(
- 'self_ref' => {
- data_type => 'integer',
- },
- 'alias' => {
- data_type => 'integer',
- },
-);
-__PACKAGE__->set_primary_key(qw/self_ref alias/);
-
-__PACKAGE__->belongs_to( self_ref => 'DBICTest::Schema::SelfRef' );
-__PACKAGE__->belongs_to( alias => 'DBICTest::Schema::SelfRef' );
-
-1;
+package # hide from PAUSE
+ DBICTest::Schema::SelfRefAlias;
+
+use base qw/DBICTest::BaseResult/;
+
+__PACKAGE__->table('self_ref_alias');
+__PACKAGE__->add_columns(
+ 'self_ref' => {
+ data_type => 'integer',
+ },
+ 'alias' => {
+ data_type => 'integer',
+ },
+);
+__PACKAGE__->set_primary_key(qw/self_ref alias/);
+
+__PACKAGE__->belongs_to( self_ref => 'DBICTest::Schema::SelfRef' );
+__PACKAGE__->belongs_to( alias => 'DBICTest::Schema::SelfRef' );
+
+1;
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SelfRefAlias.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SequenceTest.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SequenceTest.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SequenceTest.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::SequenceTest;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('sequence_test');
__PACKAGE__->source_info({
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/SequenceTest.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Serialized.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Serialized.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Serialized.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Serialized;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('serialized');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Serialized.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Tag.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Tag.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Tag.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Tag;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('tags');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Tag.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Track.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Track.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Track.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::Track;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->load_components(qw/InflateColumn::DateTime Ordered/);
__PACKAGE__->table('track');
@@ -26,6 +26,10 @@
accessor => 'updated_date',
is_nullable => 1
},
+ last_updated_at => {
+ data_type => 'datetime',
+ is_nullable => 1
+ },
);
__PACKAGE__->set_primary_key('trackid');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Track.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TreeLike.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TreeLike.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TreeLike.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::TreeLike;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('treelike');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TreeLike.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::TwoKeyTreeLike;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('twokeytreelike');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeys.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeys.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeys.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::TwoKeys;
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('twokeys');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TwoKeys.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TypedObject.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TypedObject.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TypedObject.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,7 +1,7 @@
package # hide from PAUSE
DBICTest::Schema::TypedObject;
-use base qw/DBIx::Class::Core/;
+use base qw/DBICTest::BaseResult/;
__PACKAGE__->table('typed_object');
__PACKAGE__->add_columns(
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/TypedObject.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year1999CDs.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year1999CDs.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year1999CDs.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,7 @@
DBICTest::Schema::Year1999CDs;
## Used in 104view.t
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
use DBIx::Class::ResultSource::View;
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year1999CDs.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year2000CDs.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year2000CDs.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year2000CDs.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -2,7 +2,7 @@
DBICTest::Schema::Year2000CDs;
## Used in 104view.t
-use base 'DBIx::Class::Core';
+use base qw/DBICTest::BaseResult/;
use DBIx::Class::ResultSource::View;
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema/Year2000CDs.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Schema.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Stats.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/SyntaxErrorComponent1.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/SyntaxErrorComponent2.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/SyntaxErrorComponent3.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Taint/Classes/Auto.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Taint/Classes/Manual.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest/Taint/Namespaces/Result/Test.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest.pm 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest.pm 2009-05-25 16:46:59 UTC (rev 6421)
@@ -3,6 +3,7 @@
use strict;
use warnings;
+use DBICTest::AuthorCheck;
use DBICTest::Schema;
=head1 NAME
@@ -74,7 +75,7 @@
my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
- my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+ my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1, %args });
return @connect_info;
}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICTest.pm
___________________________________________________________________
Name: svn:executable
- *
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICVersionNew.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/DBICVersionOrig.pm
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/lib/sqlite.sql 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/lib/sqlite.sql 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Thu Apr 30 10:04:57 2009
+-- Created on Sat May 23 21:30:53 2009
--
@@ -108,6 +108,7 @@
CREATE TABLE cd_to_producer (
cd integer NOT NULL,
producer integer NOT NULL,
+ attribute integer,
PRIMARY KEY (cd, producer)
);
@@ -194,7 +195,8 @@
bar integer NOT NULL,
hello integer NOT NULL,
goodbye integer NOT NULL,
- sensors character NOT NULL,
+ sensors character(10) NOT NULL,
+ read_count integer,
PRIMARY KEY (foo, bar, hello, goodbye)
);
@@ -209,6 +211,7 @@
t_artist integer NOT NULL,
t_cd integer NOT NULL,
autopilot character NOT NULL,
+ pilot_sequence integer,
PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
);
@@ -375,7 +378,8 @@
cd integer NOT NULL,
position integer NOT NULL,
title varchar(100) NOT NULL,
- last_updated_on datetime
+ last_updated_on datetime,
+ last_updated_at datetime
);
CREATE INDEX track_idx_cd_track ON track (cd);
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/lib/sqlite.sql
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/ordered/cascade_delete.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/attrs_untouched.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/prefetch/attrs_untouched.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/prefetch/attrs_untouched.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -19,18 +19,6 @@
: ( tests => 3 );
}
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
- split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
- ( ($sqlite_major_ver < 3) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
- $is_broken_sqlite = 1;
-}
-
# bug in 0.07000 caused attr (join/prefetch) to be modifed by search
# so we check the search & attr arrays are not modified
my $search = { 'artist.name' => 'Caterwauler McCrae' };
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/attrs_untouched.t
___________________________________________________________________
Name: svn:eol-style
+ native
Added: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/diamond.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/prefetch/diamond.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/prefetch/diamond.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,107 @@
+# Test if prefetch and join in diamond relationship fetching the correct rows
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+$schema->populate('Artwork', [
+ [ qw/cd_id/ ],
+ [ 1 ],
+]);
+
+$schema->populate('Artwork_to_Artist', [
+ [ qw/artwork_cd_id artist_id/ ],
+ [ 1, 2 ],
+]);
+
+my $ars = $schema->resultset ('Artwork');
+
+# The relationship diagram here is:
+#
+# $ars --> artwork_to_artist
+# | |
+# | |
+# V V
+# cd ------> artist
+#
+# The current artwork belongs to a cd by artist1
+# but the artwork itself is painted by artist2
+#
+# What we try is all possible permutations of join/prefetch
+# combinations in both directions, while always expecting to
+# arrive at the specific artist at the end of each path.
+
+
+my $cd_paths = {
+ 'no cd' => [],
+ 'cd' => ['cd'],
+ 'cd->artist1' => [{'cd' => 'artist'}]
+};
+my $a2a_paths = {
+ 'no a2a' => [],
+ 'a2a' => ['artwork_to_artist'],
+ 'a2a->artist2' => [{'artwork_to_artist' => 'artist'}]
+};
+
+my %tests;
+
+foreach my $cd_path (keys %$cd_paths) {
+
+ foreach my $a2a_path (keys %$a2a_paths) {
+
+
+ $tests{sprintf "join %s, %s", $cd_path, $a2a_path} = $ars->search({}, {
+ 'join' => [
+ @{ $cd_paths->{$cd_path} },
+ @{ $a2a_paths->{$a2a_path} },
+ ],
+ 'prefetch' => [
+ ],
+ });
+
+
+ $tests{sprintf "prefetch %s, %s", $cd_path, $a2a_path} = $ars->search({}, {
+ 'join' => [
+ ],
+ 'prefetch' => [
+ @{ $cd_paths->{$cd_path} },
+ @{ $a2a_paths->{$a2a_path} },
+ ],
+ });
+
+
+ $tests{sprintf "join %s, prefetch %s", $cd_path, $a2a_path} = $ars->search({}, {
+ 'join' => [
+ @{ $cd_paths->{$cd_path} },
+ ],
+ 'prefetch' => [
+ @{ $a2a_paths->{$a2a_path} },
+ ],
+ });
+
+
+ $tests{sprintf "join %s, prefetch %s", $a2a_path, $cd_path} = $ars->search({}, {
+ 'join' => [
+ @{ $a2a_paths->{$a2a_path} },
+ ],
+ 'prefetch' => [
+ @{ $cd_paths->{$cd_path} },
+ ],
+ });
+
+ }
+}
+
+plan tests => (scalar (keys %tests) * 3);
+
+foreach my $name (keys %tests) {
+ foreach my $artwork ($tests{$name}->all()) {
+ is($artwork->id, 1, $name . ', correct artwork');
+ is($artwork->cd->artist->artistid, 1, $name . ', correct artist_id over cd');
+ is($artwork->artwork_to_artist->first->artist->artistid, 2, $name . ', correct artist_id over A2A');
+ }
+}
\ No newline at end of file
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/diamond.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/multiple_hasmany.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/prefetch/multiple_hasmany.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/prefetch/multiple_hasmany.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -20,18 +20,6 @@
: ( tests => 16 );
}
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
- split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
- ( ($sqlite_major_ver < 3) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
- $is_broken_sqlite = 1;
-}
-
# once the following TODO is complete, remove the 2 warning tests immediately
# after the TODO block
# (the TODO block itself contains tests ensuring that the warns are removed)
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/multiple_hasmany.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/pollute_already_joined.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/prefetch/pollute_already_joined.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/prefetch/pollute_already_joined.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -20,18 +20,6 @@
: ( tests => 10 );
}
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
- split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
- ( ($sqlite_major_ver < 3) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
- $is_broken_sqlite = 1;
-}
-
# A search() with prefetch seems to pollute an already joined resultset
# in a way that offsets future joins (adapted from a test case by Debolaz)
{
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/pollute_already_joined.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/rows_bug.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/standard.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/prefetch/standard.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/prefetch/standard.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -20,18 +20,6 @@
: ( tests => 45 );
}
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
-# which case COUNT(DISTINCT()) doesn't work
-my $is_broken_sqlite = 0;
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
- split /\./, $schema->storage->dbh->get_info(18);
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
- ( ($sqlite_major_ver < 3) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
- ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
- $is_broken_sqlite = 1;
-}
-
my $queries = 0;
$schema->storage->debugcb(sub { $queries++; });
$schema->storage->debug(1);
@@ -160,11 +148,7 @@
{ group_by => [qw/ title me.cdid /] }
);
-SKIP: {
- skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1
- if $is_broken_sqlite;
- cmp_ok( $rs->count, '==', 5, "count() ok after group_by on main pk" );
-}
+cmp_ok( $rs->count, '==', 5, "count() ok after group_by on main pk" );
cmp_ok( scalar $rs->all, '==', 5, "all() returns same count as count() after group_by on main pk" );
@@ -173,11 +157,7 @@
{ join => [qw/ artist /], group_by => [qw/ artist.name /] }
);
-SKIP: {
- skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1
- if $is_broken_sqlite;
- cmp_ok( $rs->count, '==', 3, "count() ok after group_by on related column" );
-}
+cmp_ok( $rs->count, '==', 3, "count() ok after group_by on related column" );
$rs = $schema->resultset("Artist")->search(
{},
@@ -195,11 +175,7 @@
'cds_2.title' => 'Forkful of bees' },
{ join => [ 'cds', 'cds' ] });
-SKIP: {
- skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1
- if $is_broken_sqlite;
- cmp_ok($rs->count, '==', 1, "single artist returned from multi-join");
-}
+cmp_ok($rs->count, '==', 1, "single artist returned from multi-join");
is($rs->next->name, 'Caterwauler McCrae', "Correct artist returned");
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/prefetch/standard.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/relationship_after_update.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/relationship_doesnt_exist.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/resultset/as_query.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/resultset/as_query.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/resultset/as_query.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -7,7 +7,7 @@
use Test::More;
-plan ( tests => 4 );
+plan ( tests => 5 );
use lib qw(t/lib);
use DBICTest;
@@ -18,11 +18,8 @@
my $cdrs = $schema->resultset('CD');
{
- my $arr = $art_rs->as_query;
- my ($query, @bind) = @{$$arr};
-
is_same_sql_bind(
- $query, \@bind,
+ $art_rs->as_query,
"(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me)", [],
);
}
@@ -30,11 +27,8 @@
$art_rs = $art_rs->search({ name => 'Billy Joel' });
{
- my $arr = $art_rs->as_query;
- my ($query, @bind) = @{$$arr};
-
is_same_sql_bind(
- $query, \@bind,
+ $art_rs->as_query,
"(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? ))",
[ [ name => 'Billy Joel' ] ],
);
@@ -43,11 +37,8 @@
$art_rs = $art_rs->search({ rank => 2 });
{
- my $arr = $art_rs->as_query;
- my ($query, @bind) = @{$$arr};
-
is_same_sql_bind(
- $query, \@bind,
+ $art_rs->as_query,
"(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
[ [ rank => 2 ], [ name => 'Billy Joel' ] ],
);
@@ -56,14 +47,18 @@
my $rscol = $art_rs->get_column( 'charfield' );
{
- my $arr = $rscol->as_query;
- my ($query, @bind) = @{$$arr};
-
is_same_sql_bind(
- $query, \@bind,
+ $rscol->as_query,
"(SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
[ [ rank => 2 ], [ name => 'Billy Joel' ] ],
);
}
-__END__
+{
+ my $rs = $schema->resultset("CD")->search(
+ { 'artist.name' => 'Caterwauler McCrae' },
+ { join => [qw/artist/]}
+ );
+ my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $rs->get_column('cdid')->as_query } } );
+ is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/resultset/as_query.t
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: DBIx-Class/0.08/branches/multi_stuff/t/resultset/update_delete.t (from rev 5335, DBIx-Class/0.08/branches/multi_stuff/t/53delete_related.t)
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/resultset/update_delete.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/resultset/update_delete.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,95 @@
+use strict;
+use warnings;
+
+use lib qw(t/lib);
+use Test::More;
+use Test::Exception;
+use DBICTest;
+
+#plan tests => 5;
+plan 'no_plan';
+
+my $schema = DBICTest->init_schema();
+
+my $tkfks = $schema->resultset('FourKeys_to_TwoKeys');
+
+my ($fa, $fb) = $tkfks->related_resultset ('fourkeys')->populate ([
+ [qw/foo bar hello goodbye sensors read_count/],
+ [qw/1 1 1 1 a 10 /],
+ [qw/2 2 2 2 b 20 /],
+]);
+
+# This is already provided by DBICTest
+#my ($ta, $tb) = $tkfk->related_resultset ('twokeys')->populate ([
+# [qw/artist cd /],
+# [qw/1 1 /],
+# [qw/2 2 /],
+#]);
+my ($ta, $tb) = $schema->resultset ('TwoKeys')
+ ->search ( [ { artist => 1, cd => 1 }, { artist => 2, cd => 2 } ])
+ ->all;
+
+my $tkfk_cnt = $tkfks->count;
+
+my $non_void_ctx = $tkfks->populate ([
+ { autopilot => 'a', fourkeys => $fa, twokeys => $ta, pilot_sequence => 10 },
+ { autopilot => 'b', fourkeys => $fb, twokeys => $tb, pilot_sequence => 20 },
+ { autopilot => 'x', fourkeys => $fa, twokeys => $tb, pilot_sequence => 30 },
+ { autopilot => 'y', fourkeys => $fb, twokeys => $ta, pilot_sequence => 40 },
+]);
+is ($tkfks->count, $tkfk_cnt += 4, 'FourKeys_to_TwoKeys populated succesfully');
+
+#
+# Make sure the forced group by works (i.e. the joining does not cause double-updates)
+#
+
+# create a resultset matching $fa and $fb only
+my $fks = $schema->resultset ('FourKeys')
+ ->search ({ map { $_ => [1, 2] } qw/foo bar hello goodbye/}, { join => 'fourkeys_to_twokeys' });
+
+is ($fks->count, 4, 'Joined FourKey count correct (2x2)');
+$fks->update ({ read_count => \ 'read_count + 1' });
+$_->discard_changes for ($fa, $fb);
+
+is ($fa->read_count, 11, 'Update ran only once on joined resultset');
+is ($fb->read_count, 21, 'Update ran only once on joined resultset');
+
+
+#
+# Make sure multicolumn in or the equivalen functions correctly
+#
+
+my $sub_rs = $tkfks->search (
+ [
+ { map { $_ => 1 } qw/artist.artistid cd.cdid fourkeys.foo fourkeys.bar fourkeys.hello fourkeys.goodbye/ },
+ { map { $_ => 2 } qw/artist.artistid cd.cdid fourkeys.foo fourkeys.bar fourkeys.hello fourkeys.goodbye/ },
+ ],
+ {
+ join => [ 'fourkeys', { twokeys => [qw/artist cd/] } ],
+ },
+);
+
+is ($sub_rs->count, 2, 'Only two rows from fourkeys match');
+
+# attempts to delete a grouped rs should fail miserably
+throws_ok (
+ sub { $sub_rs->search ({}, { distinct => 1 })->delete },
+ qr/attempted a delete operation on a resultset which does group_by/,
+ 'Grouped rs update/delete not allowed',
+);
+
+# grouping on PKs only should pass
+$sub_rs->search ({}, { group_by => [ reverse $sub_rs->result_source->primary_columns ] }) # reverse to make sure the comaprison works
+ ->update ({ pilot_sequence => \ 'pilot_sequence + 1' });
+
+is_deeply (
+ [ $tkfks->search ({ autopilot => [qw/a b x y/]}, { order_by => 'autopilot' })
+ ->get_column ('pilot_sequence')->all
+ ],
+ [qw/11 21 30 40/],
+ 'Only two rows incremented',
+);
+
+$sub_rs->delete;
+
+is ($tkfks->count, $tkfk_cnt -= 2, 'Only two rows deleted');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/resultset/update_delete.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/resultset_class.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/resultset_class.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/resultset_class.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -11,7 +11,7 @@
use DBICTest;
-is(DBICTest::Schema->source('Artist')->resultset_class, 'DBIx::Class::ResultSet', 'default resultset class');
+is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class');
ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded');
DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A');
ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded automatically');
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/resultset_class.t
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/resultset_overload.t
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: DBIx-Class/0.08/branches/multi_stuff/t/search/subquery.t
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/search/subquery.t 2009-05-25 16:33:46 UTC (rev 6420)
+++ DBIx-Class/0.08/branches/multi_stuff/t/search/subquery.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -1,13 +1,12 @@
#!/usr/bin/perl
use strict;
-use warnings FATAL => 'all';
+use warnings;
use Data::Dumper;
use Test::More;
-plan ( tests => 7 );
use lib qw(t/lib);
use DBICTest;
@@ -17,103 +16,70 @@
my $art_rs = $schema->resultset('Artist');
my $cdrs = $schema->resultset('CD');
-{
- my $cdrs2 = $cdrs->search({
- artist_id => { 'in' => $art_rs->search({}, { rows => 1 })->get_column( 'id' )->as_query },
- });
+my @tests = (
+ {
+ rs => $cdrs,
+ search => {
+ artist_id => { 'in' => $art_rs->search({}, { rows => 1 })->get_column( 'id' )->as_query },
+ },
+ sqlbind => \[
+ "( SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me LIMIT 1 ) )",
+ ],
+ },
- my $arr = $cdrs2->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me LIMIT 1 ) )",
- [],
- );
-}
-
-{
- my $rs = $art_rs->search(
- {},
- {
+ {
+ rs => $art_rs,
+ attrs => {
'select' => [
$cdrs->search({}, { rows => 1 })->get_column('id')->as_query,
],
},
- );
+ sqlbind => \[
+ "( SELECT (SELECT id FROM cd me LIMIT 1) FROM artist me )",
+ ],
+ },
- my $arr = $rs->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT (SELECT id FROM cd me LIMIT 1) FROM artist me )",
- [],
- );
-}
-
-{
- my $rs = $art_rs->search(
- {},
- {
+ {
+ rs => $art_rs,
+ attrs => {
'+select' => [
$cdrs->search({}, { rows => 1 })->get_column('id')->as_query,
],
},
- );
+ sqlbind => \[
+ "( SELECT me.artistid, me.name, me.rank, me.charfield, (SELECT id FROM cd me LIMIT 1) FROM artist me )",
+ ],
+ },
- my $arr = $rs->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT me.artistid, me.name, me.rank, me.charfield, (SELECT id FROM cd me LIMIT 1) FROM artist me )",
- [],
- );
-}
-
-# simple from
-{
- my $rs = $cdrs->search(
- {},
- {
+ {
+ rs => $cdrs,
+ attrs => {
alias => 'cd2',
from => [
{ cd2 => $cdrs->search({ id => { '>' => 20 } })->as_query },
],
},
- );
+ sqlbind => \[
+ "( SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE id > ?) cd2 )",
+ [ 'id', 20 ]
+ ],
+ },
- my $arr = $rs->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE id > 20) cd2 )",
- [],
- );
-}
-
-# nested from
-{
- my $art_rs2 = $schema->resultset('Artist')->search({},
{
- from => [ { 'me' => 'artist' },
- [ { 'cds' => $cdrs->search({},{ 'select' => [\'me.artist as cds_artist' ]})->as_query },
- { 'me.artistid' => 'cds_artist' } ] ]
- });
+ rs => $art_rs,
+ attrs => {
+ from => [ { 'me' => 'artist' },
+ [ { 'cds' => $cdrs->search({},{ 'select' => [\'me.artist as cds_artist' ]})->as_query },
+ { 'me.artistid' => 'cds_artist' } ] ]
+ },
+ sqlbind => \[
+ "( SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me JOIN (SELECT me.artist as cds_artist FROM cd me) cds ON me.artistid = cds_artist )"
+ ],
+ },
- my $arr = $art_rs2->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me JOIN (SELECT me.artist as cds_artist FROM cd me) cds ON me.artistid = cds_artist )", []
- );
-
-
-}
-
-# nested subquery in from
-{
- my $rs = $cdrs->search(
- {},
- {
+ {
+ rs => $cdrs,
+ attrs => {
alias => 'cd2',
from => [
{ cd2 => $cdrs->search(
@@ -126,41 +92,62 @@
}, )->as_query },
],
},
- );
+ sqlbind => \[
+ "( SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track
+ FROM
+ (SELECT cd3.cdid,cd3.artist,cd3.title,cd3.year,cd3.genreid,cd3.single_track
+ FROM
+ (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track
+ FROM cd me WHERE id < ?) cd3
+ WHERE id > ?) cd2
+ )",
+ [ 'id', 40 ],
+ [ 'id', 20 ]
+ ],
+ },
- my $arr = $rs->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track
- FROM
- (SELECT cd3.cdid,cd3.artist,cd3.title,cd3.year,cd3.genreid,cd3.single_track
- FROM
- (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track
- FROM cd me WHERE id < 40) cd3
- WHERE id > 20) cd2
- )",
- [],
- );
+ {
+ rs => $cdrs,
+ search => {
+ year => {
+ '=' => $cdrs->search(
+ { artistid => { '=' => \'me.artistid' } },
+ { alias => 'inner' }
+ )->get_column('year')->max_rs->as_query,
+ },
+ },
+ sqlbind => \[
+ "( SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE year = (SELECT MAX(inner.year) FROM cd inner WHERE artistid = me.artistid) )",
+ ],
+ },
-}
-
-{
- my $rs = $cdrs->search({
- year => {
- '=' => $cdrs->search(
- { artistid => { '=' => \'me.artistid' } },
- { alias => 'inner' }
- )->get_column('year')->max_rs->as_query,
+ {
+ rs => $cdrs,
+ attrs => {
+ alias => 'cd2',
+ from => [
+ { cd2 => $cdrs->search({ title => 'Thriller' })->as_query },
+ ],
},
- });
- my $arr = $rs->as_query;
- my ($query, @bind) = @{$$arr};
- is_same_sql_bind(
- $query, \@bind,
- "( SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE year = (SELECT MAX(inner.year) FROM cd inner WHERE artistid = me.artistid) )",
- [],
- );
-}
+ sqlbind => \[
+ "(SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE title = ?) cd2)",
+ [ 'title',
+ 'Thriller'
+ ]
+ ],
+ },
+);
-__END__
+
+plan tests => @tests * 2;
+
+for my $i (0 .. $#tests) {
+ my $t = $tests[$i];
+ for my $p (1, 2) { # repeat everything twice, make sure we do not clobber search arguments
+ is_same_sql_bind (
+ $t->{rs}->search ($t->{search}, $t->{attrs})->as_query,
+ $t->{sqlbind},
+ sprintf 'Testcase %d, pass %d', $i+1, $p,
+ );
+ }
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/search/subquery.t
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: DBIx-Class/0.08/branches/multi_stuff/t/zzzzzzz_perl_perf_bug.t (from rev 5529, DBIx-Class/0.08/branches/multi_stuff/t/99rh_perl_perf_bug.t)
===================================================================
--- DBIx-Class/0.08/branches/multi_stuff/t/zzzzzzz_perl_perf_bug.t (rev 0)
+++ DBIx-Class/0.08/branches/multi_stuff/t/zzzzzzz_perl_perf_bug.t 2009-05-25 16:46:59 UTC (rev 6421)
@@ -0,0 +1,121 @@
+use strict;
+use warnings;
+use Test::More;
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
+
+# This is a rather unusual test.
+# It does not test any aspect of DBIx::Class, but instead tests the
+# perl installation this is being run under to see if it is:-
+# 1. Potentially affected by a RH perl build bug
+# 2. If so we do a performance test for the effect of
+# that bug.
+#
+# You can skip these tests by setting the DBIC_NO_WARN_BAD_PERL env
+# variable
+#
+# If these tests fail then please read the section titled
+# Perl Performance Issues on Red Hat Systems in
+# L<DBIx::Class::Manual::Troubleshooting>
+
+plan skip_all =>
+ 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set'
+ if ( $ENV{DBIC_NO_WARN_BAD_PERL} );
+
+plan skip_all => 'Skipping as AUTOMATED_TESTING is set'
+ if ( $ENV{AUTOMATED_TESTING} );
+
+eval "use Benchmark ':all'";
+plan skip_all => 'needs Benchmark for testing' if $@;
+
+plan tests => 3;
+
+ok( 1, 'Dummy - prevents next test timing out' );
+
+# we do a benchmark test filling an array with blessed/overloaded references,
+# against an array filled with array refs.
+# On a sane system the ratio between these operation sets is 1 - 1.5,
+# whereas a bugged system gives a ratio of around 8
+# we therefore consider there to be a problem if the ratio is >= 2
+
+my $results = timethese(
+ -1, # run for 1 CPU second each
+ {
+ no_bless => sub {
+ my %h;
+ for ( my $i = 0 ; $i < 10000 ; $i++ ) {
+ $h{$i} = [];
+ }
+ },
+ bless_overload => sub {
+ use overload q(<) => sub { };
+ my %h;
+ for ( my $i = 0 ; $i < 10000 ; $i++ ) {
+ $h{$i} = bless [] => 'main';
+ }
+ },
+ },
+);
+
+my $ratio = $results->{no_bless}->iters / $results->{bless_overload}->iters;
+
+ok( ( $ratio < 2 ), 'Overload/bless performance acceptable' )
+ || diag(
+ "\n",
+ "This perl has a substantial slow down when handling large numbers\n",
+ "of blessed/overloaded objects. This can severely adversely affect\n",
+ "the performance of DBIx::Class programs. Please read the section\n",
+ "in the Troubleshooting POD documentation entitled\n",
+ "'Perl Performance Issues on Red Hat Systems'\n",
+ "As this is an extremely serious condition, the only way to skip\n",
+ "over this test is to --force the installation, or to edit the test\n",
+ "file " . __FILE__ . "\n",
+ );
+
+# We will only check for the difference in bless handling (whether the
+# bless applies to the reference or the referent) if we have seen a
+# performance issue...
+
+SKIP: {
+ skip "Not checking for bless handling as performance is OK", 1
+ if ( $ratio < 2 );
+
+ {
+ package # don't want this in PAUSE
+ TestRHBug;
+ use overload bool => sub { 0 }
+ }
+
+ sub _has_bug_34925 {
+ my %thing;
+ my $r1 = \%thing;
+ my $r2 = \%thing;
+ bless $r1 => 'TestRHBug';
+ return !!$r2;
+ }
+
+ sub _possibly_has_bad_overload_performance {
+ return $] < 5.008009 && !_has_bug_34925();
+ }
+
+ # If this next one fails then you almost certainly have a RH derived
+ # perl with the performance bug
+ # if this test fails, look at the section titled
+ # "Perl Performance Issues on Red Hat Systems" in
+ # L<DBIx::Class::Manual::Troubleshooting>
+ # Basically you may suffer severe performance issues when running
+ # DBIx::Class (and many other) modules. Look at getting a fixed
+ # version of the perl interpreter for your system.
+ #
+ ok( !_possibly_has_bad_overload_performance(),
+ 'Checking whether bless applies to reference not object' )
+ || diag(
+ "\n",
+ "This perl is probably derived from a buggy Red Hat perl build\n",
+ "Please read the section in the Troubleshooting POD documentation\n",
+ "entitled 'Perl Performance Issues on Red Hat Systems'\n",
+ "As this is an extremely serious condition, the only way to skip\n",
+ "over this test is to --force the installation, or to edit the test\n",
+ "file " . __FILE__ . "\n",
+ );
+}
Property changes on: DBIx-Class/0.08/branches/multi_stuff/t/zzzzzzz_perl_perf_bug.t
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Bast-commits
mailing list