[Bast-commits] r5490 - in DBIx-Class/0.08/branches/subquery: .
lib/DBIx/Class lib/DBIx/Class/InflateColumn
lib/DBIx/Class/Manual lib/DBIx/Class/Relationship
lib/DBIx/Class/Schema lib/DBIx/Class/Storage
lib/DBIx/Class/Storage/DBI/Oracle
lib/SQL/Translator/Parser/DBIx t t/lib t/lib/DBICTest
t/lib/DBICTest/Schema
robkinyon at dev.catalyst.perl.org
robkinyon at dev.catalyst.perl.org
Mon Feb 16 22:03:55 GMT 2009
Author: robkinyon
Date: 2009-02-16 22:03:55 +0000 (Mon, 16 Feb 2009)
New Revision: 5490
Added:
DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Encoded.pm
Modified:
DBIx-Class/0.08/branches/subquery/
DBIx-Class/0.08/branches/subquery/Changes
DBIx-Class/0.08/branches/subquery/Makefile.PL
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/InflateColumn/DateTime.pm
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/Cookbook.pod
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/FAQ.pod
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Relationship/Accessor.pm
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Row.pm
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Schema/Versioned.pm
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
DBIx-Class/0.08/branches/subquery/lib/SQL/Translator/Parser/DBIx/Class.pm
DBIx-Class/0.08/branches/subquery/t/103many_to_many_warning.t
DBIx-Class/0.08/branches/subquery/t/60core.t
DBIx-Class/0.08/branches/subquery/t/66relationship.t
DBIx-Class/0.08/branches/subquery/t/73oracle.t
DBIx-Class/0.08/branches/subquery/t/745db2.t
DBIx-Class/0.08/branches/subquery/t/746db2_400.t
DBIx-Class/0.08/branches/subquery/t/76joins.t
DBIx-Class/0.08/branches/subquery/t/77prefetch.t
DBIx-Class/0.08/branches/subquery/t/81transactions.t
DBIx-Class/0.08/branches/subquery/t/86sqlt.t
DBIx-Class/0.08/branches/subquery/t/89dbicadmin.t
DBIx-Class/0.08/branches/subquery/t/89inflate_datetime.t
DBIx-Class/0.08/branches/subquery/t/94versioning.t
DBIx-Class/0.08/branches/subquery/t/99dbic_sqlt_parser.t
DBIx-Class/0.08/branches/subquery/t/99rh_perl_perf_bug.t
DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema.pm
DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Artist.pm
DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/EventTZ.pm
DBIx-Class/0.08/branches/subquery/t/lib/sqlite.sql
Log:
r5380 at rkinyon-lt-osx (orig r5379): jmmills | 2009-01-29 20:37:01 -0500
Added a more verbose non column accessor example.
r5381 at rkinyon-lt-osx (orig r5380): jmmills | 2009-01-29 20:42:02 -0500
editorial typo in my previous commit.
r5383 at rkinyon-lt-osx (orig r5382): semifor | 2009-01-30 08:54:42 -0500
Bring test current with DBICTest schema.
r5384 at rkinyon-lt-osx (orig r5383): castaway | 2009-01-30 09:27:38 -0500
DB2 compatibility fix, update test to add new artist column (ick)
remove code that calls now removed sub _RowNumberOver
r5385 at rkinyon-lt-osx (orig r5384): ribasushi | 2009-01-30 09:32:42 -0500
Add the _find_syntax caching back
r5386 at rkinyon-lt-osx (orig r5385): castaway | 2009-01-30 09:33:24 -0500
DB2 compat: add new artist rank field to col_info_for test
r5393 at rkinyon-lt-osx (orig r5392): ribasushi | 2009-01-31 15:40:50 -0500
pod align by dandv
r5394 at rkinyon-lt-osx (orig r5393): ribasushi | 2009-02-01 16:33:32 -0500
Fix the dbicadmin test for good
r5395 at rkinyon-lt-osx (orig r5394): ribasushi | 2009-02-01 17:44:39 -0500
Fix the dbicadmin test for good (take 2)
r5400 at rkinyon-lt-osx (orig r5399): ribasushi | 2009-02-02 12:38:16 -0500
Bring back _RowNumberOver deleted in the sqla commotion (revs: 5096,5322,5383)
r5401 at rkinyon-lt-osx (orig r5400): ribasushi | 2009-02-02 12:52:20 -0500
part 2
r5414 at rkinyon-lt-osx (orig r5413): ribasushi | 2009-02-05 04:09:39 -0500
Commit some debugging code
r5420 at rkinyon-lt-osx (orig r5419): plu | 2009-02-07 08:40:41 -0500
Possible to set locale in IC::DateTime extra => {} config
r5427 at rkinyon-lt-osx (orig r5426): ribasushi | 2009-02-07 12:57:53 -0500
Up trunk dependency versions
r5428 at rkinyon-lt-osx (orig r5427): ribasushi | 2009-02-07 12:59:04 -0500
Up dependency on SQLT (releasing now)
r5432 at rkinyon-lt-osx (orig r5431): groditi | 2009-02-09 15:27:27 -0500
backporting the set_column/store_column fix
r5433 at rkinyon-lt-osx (orig r5432): groditi | 2009-02-09 15:29:03 -0500
ahhhh my bad. svk patch ne patch. oops adding missing file
r5439 at rkinyon-lt-osx (orig r5438): ribasushi | 2009-02-10 05:18:09 -0500
Finally make the indexer happy wrt SQL::Translator::Parser::DBIx::Class
Hide DBIx::Class::CDBICompat::ColumnGroups::GrouperShim (was never indexed to begin with)
r5441 at rkinyon-lt-osx (orig r5440): ribasushi | 2009-02-10 06:19:20 -0500
More rh-bug related stuff:
- Improve message emmitted when confronted with a buggy system
- Port forgotten pieces from trunk to stopgap
r5442 at rkinyon-lt-osx (orig r5441): castaway | 2009-02-10 08:57:34 -0500
More docs, pointing at using deploy/create_ddl_dir
r5445 at rkinyon-lt-osx (orig r5444): castaway | 2009-02-10 16:41:58 -0500
1) Add docs to ATTRIBUTES to better explain where to use them
2) Make all() die if passed arguments.
r5447 at rkinyon-lt-osx (orig r5446): ribasushi | 2009-02-11 03:24:58 -0500
Test for resultset corruption by search()
r5448 at rkinyon-lt-osx (orig r5447): ribasushi | 2009-02-11 04:02:42 -0500
Add a weird extra test, that should work nevertheless
r5449 at rkinyon-lt-osx (orig r5448): ribasushi | 2009-02-11 04:17:55 -0500
Add missing shallow copy of seen_join
r5450 at rkinyon-lt-osx (orig r5449): ribasushi | 2009-02-11 05:37:36 -0500
make single() die if passed attributes
r5455 at rkinyon-lt-osx (orig r5454): nigel | 2009-02-11 10:07:28 -0500
r10743 at hex: nigel | 2009-02-11 15:07:05 +0000
Documentation update on startup speed
r5459 at rkinyon-lt-osx (orig r5458): groditi | 2009-02-11 20:49:26 -0500
fixed bug for undef_on_null_fk edge case
r5464 at rkinyon-lt-osx (orig r5463): nigel | 2009-02-12 09:27:38 -0500
r10772 at hex: nigel | 2009-02-12 14:27:22 +0000
Made update() on a rs that includes joins complain in the same way that delete() does. Added tests for both update and delete checks.
r5465 at rkinyon-lt-osx (orig r5464): plu | 2009-02-13 05:27:36 -0500
Refactored and re-added r5041: Split sql statements for deploy only if SQLT::Producer returned a scalar containing all statements to be executed
r5466 at rkinyon-lt-osx (orig r5465): caelum | 2009-02-13 05:40:55 -0500
Some fixes for Oracle edge cases
r5467 at rkinyon-lt-osx (orig r5466): ribasushi | 2009-02-13 05:45:46 -0500
Some forgotten tests
r5468 at rkinyon-lt-osx (orig r5467): caelum | 2009-02-13 06:29:37 -0500
Throw exception on invalidated session if in a transaction.
r5472 at rkinyon-lt-osx (orig r5471): ribasushi | 2009-02-14 19:44:02 -0500
Make 81transactions.t DBIC_TRACE friendly
r5473 at rkinyon-lt-osx (orig r5472): ribasushi | 2009-02-14 19:45:44 -0500
A dbh_do statement executed with bind values will confuse the hell out of DBIC running in DBIC_TRACE=1 mode - stop sending TMI to _query_[start|end] from within dbh_do/_do_query
r5475 at rkinyon-lt-osx (orig r5474): plu | 2009-02-15 09:20:25 -0500
RT#38251: DBIx::Class::Storage::DBI::Oracle::Generic does not handle fully-qualified table names
r5480 at rkinyon-lt-osx (orig r5479): caelum | 2009-02-15 18:30:00 -0500
Improved connected logic for Oracle storage
r5481 at rkinyon-lt-osx (orig r5480): caelum | 2009-02-15 19:20:27 -0500
sorry, I fucked up the indentation...
r5482 at rkinyon-lt-osx (orig r5481): ribasushi | 2009-02-16 03:48:49 -0500
Some cleanups of oracle patch
r5490 at rkinyon-lt-osx (orig r5489): robkinyon | 2009-02-16 16:27:49 -0500
Added a bit of explanation to resultsets to cut down on the repeated questions in #dbix-class
Property changes on: DBIx-Class/0.08/branches/subquery
___________________________________________________________________
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:5420
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/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/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/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/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
+ 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5420
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_trunk:10772
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/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/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/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:5489
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/subquery/Changes
===================================================================
--- DBIx-Class/0.08/branches/subquery/Changes 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/Changes 2009-02-16 22:03:55 UTC (rev 5490)
@@ -1,4 +1,9 @@
Revision history for DBIx::Class
+ - Possible to set locale in IC::DateTime extra => {} config
+ - Calling the accessor of a belongs_to when the foreign_key
+ was NULL and the row was not stored would unexpectedly fail (groditi)
+ - Split sql statements for deploy only if SQLT::Producer returned a scalar
+ containing all statements to be executed
0.08099_06 2009-01-23 07:30:00 (UTC)
- Allow a scalarref to be supplied to the 'from' resultset attribute
@@ -16,6 +21,8 @@
- new order_by => { -desc => 'colname' } syntax supported with
SQLA >= 1.50
- PG array datatype supported with SQLA >= 1.50
+ - insert should use store_column, not set_column to avoid marking
+ clean just-stored values as dirty. New test for this (groditi)
0.08099_05 2008-10-30 21:30:00 (UTC)
- Rewritte of Storage::DBI::connect_info(), extended with an
Modified: DBIx-Class/0.08/branches/subquery/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/subquery/Makefile.PL 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/Makefile.PL 2009-02-16 22:03:55 UTC (rev 5490)
@@ -10,16 +10,16 @@
requires 'Data::Page' => 2.00;
requires 'Scalar::Util' => 0;
-requires 'SQL::Abstract' => 1.20;
-requires 'SQL::Abstract::Limit' => 0.101;
-requires 'Class::C3' => 0.13;
+requires 'SQL::Abstract' => 1.24;
+requires 'SQL::Abstract::Limit' => 0.13;
+requires 'Class::C3' => 0.20;
requires 'Class::C3::Componentised' => 0;
requires 'Storable' => 0;
requires 'Carp::Clan' => 0;
requires 'DBI' => 1.40;
requires 'Module::Find' => 0;
requires 'Class::Inspector' => 0;
-requires 'Class::Accessor::Grouped' => 0.05002;
+requires 'Class::Accessor::Grouped' => 0.08002;
requires 'JSON::Any' => 1.17;
requires 'Scope::Guard' => 0.03;
requires 'Path::Class' => 0;
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/InflateColumn/DateTime.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/InflateColumn/DateTime.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -27,10 +27,10 @@
print "This event starts the month of ".
$event->starts_when->month_name();
-If you want to set a specific timezone for that field, use:
+If you want to set a specific timezone and locale for that field, use:
__PACKAGE__->add_columns(
- starts_when => { data_type => 'datetime', extra => { timezone => "America/Chicago" } }
+ starts_when => { data_type => 'datetime', extra => { timezone => "America/Chicago", locale => "de_DE" } }
);
If you want to inflate no matter what data_type your column is,
@@ -110,10 +110,15 @@
}
my $timezone;
- if ( exists $info->{extra} and exists $info->{extra}{timezone} and defined $info->{extra}{timezone} ) {
+ if ( defined $info->{extra}{timezone} ) {
$timezone = $info->{extra}{timezone};
}
+ my $locale;
+ if ( defined $info->{extra}{locale} ) {
+ $locale = $info->{extra}{locale};
+ }
+
my $undef_if_invalid = $info->{datetime_undef_if_invalid};
if ($type eq 'datetime' || $type eq 'date') {
@@ -143,6 +148,7 @@
die "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;
return $dt;
},
deflate => sub {
@@ -154,6 +160,7 @@
and not $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);
},
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/Cookbook.pod 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/Cookbook.pod 2009-02-16 22:03:55 UTC (rev 5490)
@@ -833,7 +833,7 @@
my $hash_ref = $rs->find(1);
Wasn't that easy?
-
+
=head2 Get raw data for blindingly fast results
If the L<HashRefInflator|DBIx::Class::ResultClass::HashRefInflator> solution
@@ -1639,5 +1639,67 @@
statement and dig down to see if certain parameters cause aberrant behavior.
You might want to check out L<DBIx::Class::QueryLog> as well.
+=head1 STARTUP SPEED
+L<DBIx::Class|DBIx::Class> programs can have a significant startup delay
+as the ORM loads all the relevant classes. This section examines
+techniques for reducing the startup delay.
+
+These tips are are listed in order of decreasing effectiveness - so the
+first tip, if applicable, should have the greatest effect on your
+application.
+
+=head2 Statically Define Your Schema
+
+If you are using
+L<DBIx::Class::Schema::Loader|DBIx::Class::Schema::Loader> to build the
+classes dynamically based on the database schema then there will be a
+significant startup delay.
+
+For production use a statically defined schema (which can be generated
+using L<DBIx::Class::Schema::Loader|DBIx::Class::Schema::Loader> to dump
+the database schema once - see
+L<make_schema_at|DBIx::Class::Schema::Loader/make_schema_at> and
+L<dump_directory|DBIx::Class::Schema::Loader/dump_directory> for more
+details on creating static schemas from a database).
+
+=head2 Move Common Startup into a Base Class
+
+Typically L<DBIx::Class> result classes start off with
+
+ use base qw/DBIx::Class/;
+ __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
+
+If this preamble is moved into a common base class:-
+
+ package MyDBICbase;
+
+ use base qw/DBIx::Class/;
+ __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
+ 1;
+
+and each result class then uses this as a base:-
+
+ use base qw/MyDBICbase/;
+
+then the load_components is only performed once, which can result in a
+considerable startup speedup for schemas with many classes.
+
+=head2 Explicitly List Schema Result Classes
+
+The schema class will normally contain
+
+ __PACKAGE__->load_classes();
+
+to load the result classes. This will use L<Module::Find|Module::Find>
+to find and load the appropriate modules. Explicitly defining the
+classes you wish to load will remove the overhead of
+L<Module::Find|Module::Find> and the related directory operations:-
+
+ __PACKAGE__->load_classes(qw/ CD Artist Track /);
+
+If you are instead using the L<load_namespaces|DBIx::Class::Schema/load_namespaces>
+syntax to load the appropriate classes there is not a direct alternative
+avoiding L<Module::Find|Module::Find>.
+
=cut
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/FAQ.pod
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/FAQ.pod 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Manual/FAQ.pod 2009-02-16 22:03:55 UTC (rev 5490)
@@ -428,6 +428,41 @@
You can add your own data accessors to your classes.
+One method is to use the built in mk_group_accessors (via L<Class::Accessor::Grouped>)
+
+ package MyTable;
+
+ use parent 'DBIx::Class';
+
+ __PACKAGE__->table('foo'); #etc
+ __PACKAGE__->mk_group_accessors('simple' => qw/non_column_data/); # must use simple group
+
+An another method is to use L<Moose> with your L<DBIx::Class> package.
+
+ package MyTable;
+
+ use Moose; # import Moose
+ use Moose::Util::TypeConstraint; # import Moose accessor type constraints
+
+ extends 'DBIx::Class'; # Moose changes the way we define our parent (base) package
+
+ has 'non_column_data' => ( is => 'rw', isa => 'Str' ); # define a simple attribute
+
+ __PACKAGE__->table('foo'); # etc
+
+With either of these methods the resulting use of the accesssor would be
+
+ my $row;
+
+ # assume that some where in here $row will get assigned to a MyTable row
+
+ $row->non_column_data('some string'); # would set the non_column_data accessor
+
+ # some other stuff happens here
+
+ $row->update(); # would not inline the non_column_data accessor into the update
+
+
=item How do I use DBIx::Class objects in my TT templates?
Like normal objects, mostly. However you need to watch out for TT
@@ -462,6 +497,16 @@
$resultset->set_primary_key(@column);
+=item How do I make my program start faster?
+
+Look at the tips in L<DBIx::Class::Manual::Cookbook/"STARTUP SPEED">
+
+=item How do I reduce the overhead of database queries?
+
+You can reduce the overhead of object creation within L<DBIx::Class>
+using the tips in L<DBIx::Class::Manual::Cookbook/"Skip row object creation for faster results">
+and L<DBIx::Class::Manual::Cookbook/"Get raw data for blindingly fast results">
+
=back
=head2 Notes for CDBI users
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Relationship/Accessor.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Relationship/Accessor.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Relationship/Accessor.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -31,6 +31,7 @@
$rel_info->{cond}, $rel, $self
);
if ($rel_info->{attrs}->{undef_on_null_fk}){
+ return unless ref($cond) eq 'HASH';
return if grep { not defined } values %$cond;
}
my $val = $self->find_related($rel, {}, {});
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/ResultSet.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/ResultSet.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -52,6 +52,86 @@
__PACKAGE__->belongs_to(artist => 'MyApp::Schema::Artist');
1;
+=head1 DISCUSSION
+
+When you create a resultset (usually as a result of calling search()), DBIx::Class
+B<doesn't> make a DB call. Not yet. A resultset is (in simplistic terms) a set of
+where conditions, join conditions, and other metadata that would be needed to execute
+a SELECT statement. This has several big implications:
+
+=over 4
+
+=item * You can chain resultsets
+
+=item * You can run multiple queries using the same resultset
+
+=back
+
+=head2 Chaining resultsets
+
+Let's say you've got a query that needs to be run to return some data to the user. But,
+you have an authorization system in place that prevents certain users from seeing certain
+information. So, you want to construct the query in one method, but add constraints to it
+in another.
+
+ sub get_data {
+ my $self = shift;
+ my $request = $self->get_request; # Get a request object somehow.
+ my $schema = $self->get_schema; # Get the DBIC schema object somehow.
+
+ my $rs = $schema->resultset('some_data')->search({
+ foo => $request->param('foo'),
+ bar => $request->param('bar'),
+ });
+
+ $self->apply_security_policy( $rs );
+
+ return $rs->all;
+ }
+
+ sub apply_security_policy {
+ my $self = shift;
+ my ($rs) = @_;
+
+ return $rs->search({
+ hidden_data => 0,
+ });
+ }
+
+=head2 Multiple queries
+
+Since a resultset hasn't hit the database yet, you can do all sorts of things with it.
+
+ # Don't hit the DB yet.
+ my $rs = $schema->resultset('some_table')->search({
+ foo => 1,
+ bar => 2,
+ });
+
+ # Each of these hits the DB individually.
+ my $count = $rs->count;
+ my $max_baz = $rs->get_column('baz')->max;
+ my @records = $rs->all;
+
+And it's not just limited to SELECT statements.
+
+ $rs->delete;
+
+This is even cooler
+
+ $rs->create({ baz => 20 });
+
+That is equivalent to
+
+ $schema->resultset('some_table')->create({
+ foo => 1,
+ bar => 2,
+ baz => 20,
+ });
+
+Note that C<get_column()> returns a ResultSetColumn object. This will behave almost
+exactly like a resultset, except it has methods tuned for working with columns.
+
=head1 OVERLOADING
If a resultset is used in a numeric context it returns the L</count>.
@@ -607,6 +687,10 @@
sub single {
my ($self, $where) = @_;
+ if(@_ > 2) {
+ $self->throw_exception('single() only takes search conditions, no attributes. You want ->search( $cond, $attrs )->single()');
+ }
+
my $attrs = { %{$self->_resolved_attrs} };
if ($where) {
if (defined $attrs->{where}) {
@@ -1109,7 +1193,11 @@
=cut
sub all {
- my ($self) = @_;
+ my $self = shift;
+ if(@_) {
+ $self->throw_exception("all() doesn't take any arguments, you probably wanted ->search(...)->all()");
+ }
+
return @{ $self->get_cache } if $self->get_cache;
my @obj;
@@ -1261,6 +1349,11 @@
$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(
@@ -1808,7 +1901,7 @@
$person_rs->create({
name=>"Some Person",
- email=>"somebody at someplace.com"
+ email=>"somebody at someplace.com"
});
Example of creating a new row and also creating rows in a related C<has_many>
@@ -1827,10 +1920,10 @@
$cd_rs->create({
title=>"Music for Silly Walks",
- year=>2000,
- artist => {
- name=>"Silly Musician",
- }
+ year=>2000,
+ artist => {
+ name=>"Silly Musician",
+ }
});
=cut
@@ -2260,7 +2353,7 @@
if (my $prefetch = delete $attrs->{prefetch}) {
$prefetch = $self->_merge_attr({}, $prefetch);
my @pre_order;
- my $seen = $attrs->{seen_join} || {};
+ my $seen = { %{ $attrs->{seen_join} || {} } };
foreach my $p (ref $prefetch eq 'ARRAY' ? @$prefetch : ($prefetch)) {
# bring joins back to level of current class
my @prefetch = $source->resolve_prefetch(
@@ -2416,9 +2509,13 @@
=head1 ATTRIBUTES
-The resultset takes various attributes that modify its behavior. Here's an
-overview of them:
+Attributes are used to refine a ResultSet in various ways when
+searching for data. They can be passed to any method which takes an
+C<\%attrs> argument. See L</search>, L</search_rs>, L</find>,
+L</count>.
+These are in no particular order:
+
=head2 order_by
=over 4
@@ -2510,7 +2607,7 @@
=over 4
-Indicates additional column names for those added via L</+select>.
+Indicates additional column names for those added via L</+select>. See L</as>.
=back
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Row.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Row.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -263,7 +263,9 @@
}
my $updated_cols = $source->storage->insert($source, { $self->get_columns });
- $self->set_columns($updated_cols);
+ foreach my $col (keys %$updated_cols) {
+ $self->store_column($col, $updated_cols->{$col});
+ }
## PK::Auto
my @auto_pri = grep {
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Schema/Versioned.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Schema/Versioned.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -519,9 +519,9 @@
return;
}
- eval 'require SQL::Translator "0.09"';
+ eval 'require SQL::Translator "0.09003"';
if ($@) {
- $self->throw_exception("SQL::Translator 0.09 required");
+ $self->throw_exception("SQL::Translator 0.09003 required");
}
my $db_tr = SQL::Translator->new({
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -55,8 +55,23 @@
# trigger_body is a LONG
$dbh->{LongReadLen} = 64 * 1024 if ($dbh->{LongReadLen} < 64 * 1024);
- my $sth = $dbh->prepare($sql);
- $sth->execute( uc($source->name) );
+ my $sth;
+
+ # check for fully-qualified name (eg. SCHEMA.TABLENAME)
+ if ( my ( $schema, $table ) = $source->name =~ /(\w+)\.(\w+)/ ) {
+ $sql = q{
+ SELECT trigger_body FROM ALL_TRIGGERS t
+ WHERE t.owner = ? AND t.table_name = ?
+ AND t.triggering_event = 'INSERT'
+ AND t.status = 'ENABLED'
+ };
+ $sth = $dbh->prepare($sql);
+ $sth->execute( uc($schema), uc($table) );
+ }
+ else {
+ $sth = $dbh->prepare($sql);
+ $sth->execute( uc( $source->name ) );
+ }
while (my ($insert_trigger) = $sth->fetchrow_array) {
return uc($1) if $insert_trigger =~ m!(\w+)\.nextval!i; # col name goes here???
}
@@ -69,6 +84,59 @@
return $id;
}
+sub connected {
+ my $self = shift;
+
+ if (not $self->SUPER::connected(@_)) {
+ return 0;
+ }
+ else {
+ my $dbh = $self->_dbh;
+
+ local $dbh->{RaiseError} = 1;
+
+ eval {
+ my $ping_sth = $dbh->prepare_cached("select 1 from dual");
+ $ping_sth->execute;
+ $ping_sth->finish;
+ };
+
+ return $@ ? 0 : 1;
+ }
+}
+
+sub _dbh_execute {
+ my $self = shift;
+ my ($dbh, $op, $extra_bind, $ident, $bind_attributes, @args) = @_;
+
+ my $wantarray = wantarray;
+
+ my (@res, $exception, $retried);
+
+ do {
+ eval {
+ if ($wantarray) {
+ @res = $self->SUPER::_dbh_execute(@_);
+ } else {
+ $res[0] = $self->SUPER::_dbh_execute(@_);
+ }
+ };
+ $exception = $@;
+ if ($exception =~ /ORA-01003/) {
+ # ORA-01003: no statement parsed (someone changed the table somehow,
+ # invalidating your cursor.)
+ my ($sql, $bind) = $self->_prep_for_execute($op, $extra_bind, $ident, \@args);
+ delete $dbh->{CachedKids}{$sql};
+ } else {
+ last;
+ }
+ } while (not $retried++);
+
+ $self->throw_exception($exception) if $exception;
+
+ wantarray ? @res : $res[0]
+}
+
=head2 get_autoinc_seq
Returns the sequence name for an autoincrement column
Modified: DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/DBIx/Class/Storage/DBI.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -50,16 +50,46 @@
$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) = @_;
- my $dbhname = blessed($syntax) ? $syntax->{Driver}{Name} : $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);
}
@@ -922,10 +952,18 @@
$self->_do_query($_) foreach @$action;
}
else {
- my @to_run = (ref $action eq 'ARRAY') ? (@$action) : ($action);
- $self->_query_start(@to_run);
- $self->_dbh->do(@to_run);
- $self->_query_end(@to_run);
+ # Most debuggers expect ($sql, @bind), so we need to exclude
+ # the attribute hash which is the second argument to $dbh->do
+ # furthermore the bind values are usually to be presented
+ # as named arrayref pairs, so wrap those here too
+ my @do_args = (ref $action eq 'ARRAY') ? (@$action) : ($action);
+ my $sql = shift @do_args;
+ my $attrs = shift @do_args;
+ my @bind = map { [ undef, $_ ] } @do_args;
+
+ $self->_query_start($sql, @bind);
+ $self->_dbh->do($sql, $attrs, @do_args);
+ $self->_query_end($sql, @bind);
}
return $self;
@@ -1585,7 +1623,7 @@
%{$sqltargs || {}}
};
- $self->throw_exception(q{Can't create a ddl file without SQL::Translator 0.09: '}
+ $self->throw_exception(q{Can't create a ddl file without SQL::Translator 0.09003: '}
. $self->_check_sqlt_message . q{'})
if !$self->_check_sqlt_version;
@@ -1732,7 +1770,7 @@
return join('', @rows);
}
- $self->throw_exception(q{Can't deploy without SQL::Translator 0.09: '}
+ $self->throw_exception(q{Can't deploy without SQL::Translator 0.09003: '}
. $self->_check_sqlt_message . q{'})
if !$self->_check_sqlt_version;
@@ -1752,24 +1790,34 @@
sub deploy {
my ($self, $schema, $type, $sqltargs, $dir) = @_;
- foreach my $statement ( $self->deployment_statements($schema, $type, undef, $dir, { no_comments => 1, %{ $sqltargs || {} } } ) ) {
- foreach my $line ( split(";\n", $statement)) {
- next if($line =~ /^--/);
- next if(!$line);
-# next if($line =~ /^DROP/m);
- next if($line =~ /^BEGIN TRANSACTION/m);
- next if($line =~ /^COMMIT/m);
- next if $line =~ /^\s+$/; # skip whitespace only
- $self->_query_start($line);
- eval {
- $self->dbh->do($line); # shouldn't be using ->dbh ?
- };
- if ($@) {
- warn qq{$@ (running "${line}")};
- }
- $self->_query_end($line);
+ my $deploy = sub {
+ my $line = shift;
+ return if($line =~ /^--/);
+ return if(!$line);
+ # next if($line =~ /^DROP/m);
+ return if($line =~ /^BEGIN TRANSACTION/m);
+ return if($line =~ /^COMMIT/m);
+ return if $line =~ /^\s+$/; # skip whitespace only
+ $self->_query_start($line);
+ eval {
+ $self->dbh->do($line); # shouldn't be using ->dbh ?
+ };
+ if ($@) {
+ warn qq{$@ (running "${line}")};
}
+ $self->_query_end($line);
+ };
+ my @statements = $self->deployment_statements($schema, $type, undef, $dir, { no_comments => 1, %{ $sqltargs || {} } } );
+ if (@statements > 1) {
+ foreach my $statement (@statements) {
+ $deploy->( $statement );
+ }
}
+ elsif (@statements == 1) {
+ foreach my $line ( split(";\n", $statements[0])) {
+ $deploy->( $line );
+ }
+ }
}
=head2 datetime_parser
@@ -1814,7 +1862,7 @@
my $_check_sqlt_message; # private
sub _check_sqlt_version {
return $_check_sqlt_version if defined $_check_sqlt_version;
- eval 'use SQL::Translator "0.09"';
+ eval 'use SQL::Translator "0.09003"';
$_check_sqlt_message = $@ || '';
$_check_sqlt_version = !$@;
}
Modified: DBIx-Class/0.08/branches/subquery/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/lib/SQL/Translator/Parser/DBIx/Class.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/lib/SQL/Translator/Parser/DBIx/Class.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -8,7 +8,8 @@
use strict;
use warnings;
-use vars qw($DEBUG @EXPORT_OK);
+use vars qw($DEBUG $VERSION @EXPORT_OK);
+$VERSION = '1.10';
$DEBUG = 0 unless defined $DEBUG;
use Exporter;
@@ -233,7 +234,15 @@
=head1 SYNOPSIS
+ ## Via DBIx::Class
use MyApp::Schema;
+ my $schema = MyApp::Schema->connect("dbi:SQLite:something.db");
+ $schema->create_ddl_dir();
+ ## or
+ $schema->deploy();
+
+ ## Standalone
+ use MyApp::Schema;
use SQL::Translator;
my $schema = MyApp::Schema->connect;
@@ -246,12 +255,24 @@
=head1 DESCRIPTION
+This class requires L<SQL::Translator> installed to work.
+
C<SQL::Translator::Parser::DBIx::Class> reads a DBIx::Class schema,
interrogates the columns, and stuffs it all in an $sqlt_schema object.
+It's primary use is in deploying database layouts described as a set
+of L<DBIx::Class> classes, to a database. To do this, see the
+L<DBIx::Class::Schema/deploy> method.
+
+This can also be achieved by having DBIx::Class export the schema as a
+set of SQL files ready for import into your database, or passed to
+other machines that need to have your application installed but don't
+have SQL::Translator installed. To do this see the
+L<DBIx::Class::Schema/create_ddl_dir> method.
+
=head1 SEE ALSO
-SQL::Translator.
+L<SQL::Translator>, L<DBIx::Class::Schema>
=head1 AUTHORS
Modified: DBIx-Class/0.08/branches/subquery/t/103many_to_many_warning.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/103many_to_many_warning.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/103many_to_many_warning.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -7,15 +7,16 @@
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 => 2)
+ : (tests => 4)
);
{
my @w;
local $SIG{__WARN__} = sub { push @w, @_ };
-
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'");
}
@@ -26,6 +27,8 @@
my $code = gen_code ( suffix => 2, no_warn => 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'");
}
@@ -47,6 +50,7 @@
package #
DBICTest::Schema::Foo${suffix};
use base 'DBIx::Class::Core';
+
__PACKAGE__->table('foo');
__PACKAGE__->add_columns(
'fooid' => {
@@ -82,6 +86,7 @@
DBICTest::Schema::Bar${suffix};
use base 'DBIx::Class::Core';
+
__PACKAGE__->table('bar');
__PACKAGE__->add_columns(
'barid' => {
Modified: DBIx-Class/0.08/branches/subquery/t/60core.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/60core.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/60core.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -7,7 +7,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 86;
+plan tests => 88;
eval { require DateTime::Format::MySQL };
my $NO_DTFM = $@ ? 1 : 0;
@@ -379,3 +379,11 @@
my $table = $class->table($class->table);
is($table, $class->table, '->table($table) returns $table');
}
+
+#make sure insert doesn't use set_column
+{
+ my $en_row = $schema->resultset('Encoded')->new_result({encoded => 'wilma'});
+ is($en_row->encoded, 'amliw', 'new encodes');
+ $en_row->insert;
+ is($en_row->encoded, 'amliw', 'insert does not encode again');
+}
Modified: DBIx-Class/0.08/branches/subquery/t/66relationship.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/66relationship.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/66relationship.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -8,7 +8,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 74;
+plan tests => 75;
# has_a test
my $cd = $schema->resultset("CD")->find(4);
@@ -228,7 +228,10 @@
$undef_artist_cd->related_resultset('artist')->new({name => 'foo'});
};
is( $@, '', "Object created on a resultset related to not yet inserted object");
-
+lives_ok{
+ $schema->resultset('Artwork')->new_result({})->cd;
+} 'undef_on_null_fk does not choke on empty conds';
+
my $def_artist_cd = $schema->resultset("CD")->new_result({ 'title' => 'badgers', 'year' => 2007, artist => undef });
is($def_artist_cd->has_column_loaded('artist'), 1, 'FK loaded');
is($def_artist_cd->search_related('artist')->count, 0, 'closed search on null FK');
Modified: DBIx-Class/0.08/branches/subquery/t/73oracle.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/73oracle.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/73oracle.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -1,3 +1,30 @@
+{
+ package # hide from PAUSE
+ DBICTest::Schema::ArtistFQN;
+
+ use base 'DBIx::Class::Core';
+
+ __PACKAGE__->table(
+ defined $ENV{DBICTEST_ORA_USER}
+ ? $ENV{DBICTEST_ORA_USER} . '.artist'
+ : 'artist'
+ );
+ __PACKAGE__->add_columns(
+ 'artistid' => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ 'name' => {
+ data_type => 'varchar',
+ size => 100,
+ is_nullable => 1,
+ },
+ );
+ __PACKAGE__->set_primary_key('artistid');
+
+ 1;
+}
+
use strict;
use warnings;
@@ -12,8 +39,9 @@
' as well as following sequences: \'pkid1_seq\', \'pkid2_seq\' and \'nonpkid_seq\''
unless ($dsn && $user && $pass);
-plan tests => 23;
+plan tests => 24;
+DBICTest::Schema->load_classes('ArtistFQN');
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
my $dbh = $schema->storage->dbh;
@@ -62,6 +90,10 @@
my $new = $schema->resultset('Artist')->create({ name => 'foo' });
is($new->artistid, 1, "Oracle Auto-PK worked");
+# test again with fully-qualified table name
+$new = $schema->resultset('ArtistFQN')->create( { name => 'bar' } );
+is( $new->artistid, 2, "Oracle Auto-PK worked with fully-qualified tablename" );
+
# test join with row count ambiguity
my $cd = $schema->resultset('CD')->create({ cdid => 1, artist => 1, title => 'EP C', year => '2003' });
my $track = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1' });
@@ -90,7 +122,7 @@
}
my $it = $schema->resultset('Artist')->search( {},
{ rows => 3,
- offset => 2,
+ offset => 3,
order_by => 'artistid' }
);
is( $it->count, 3, "LIMIT count ok" );
@@ -117,7 +149,7 @@
# clean up our mess
END {
- if($dbh) {
+ if($dbh = $schema->storage->dbh) {
$dbh->do("DROP SEQUENCE artist_seq");
$dbh->do("DROP SEQUENCE pkid1_seq");
$dbh->do("DROP SEQUENCE pkid2_seq");
Modified: DBIx-Class/0.08/branches/subquery/t/745db2.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/745db2.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/745db2.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -20,7 +20,7 @@
eval { $dbh->do("DROP TABLE artist") };
-$dbh->do("CREATE TABLE artist (artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(255), charfield CHAR(10));");
+$dbh->do("CREATE TABLE artist (artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(255), charfield CHAR(10), rank INTEGER DEFAULT 13);");
# This is in core, just testing that it still loads ok
$schema->class('Artist')->load_components('PK::Auto');
@@ -60,6 +60,11 @@
'is_nullable' => 1,
'size' => 10
},
+ 'rank' => {
+ 'data_type' => 'INTEGER',
+ 'is_nullable' => 1,
+ 'size' => 10
+ },
};
Modified: DBIx-Class/0.08/branches/subquery/t/746db2_400.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/746db2_400.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/746db2_400.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -23,7 +23,13 @@
eval { $dbh->do("DROP TABLE artist") };
-$dbh->do("CREATE TABLE artist (artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(255), charfield CHAR(10))");
+$dbh->do(<<'');
+CREATE TABLE artist (
+ artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ name VARCHAR(255),
+ rank INTEGER default 13 not null,
+ charfield CHAR(10)
+)
# Just to test loading, already in Core
$schema->class('Artist')->load_components('PK::Auto');
@@ -58,6 +64,11 @@
'is_nullable' => 1,
'size' => 255
},
+ 'rank' => {
+ 'data_type' => 'INTEGER',
+ 'is_nullable' => 0,
+ 'size' => 10,
+ },
'charfield' => {
'data_type' => 'CHAR',
'is_nullable' => 1,
Modified: DBIx-Class/0.08/branches/subquery/t/76joins.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/76joins.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/76joins.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -17,7 +17,7 @@
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 16 );
+ : ( tests => 18 );
}
# figure out if we've got a version of sqlite that is older than 3.2.6, in
@@ -179,3 +179,28 @@
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');
+
+# 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 });
+};
+
+ok( ($@ || $tst_update_warning), 'fail/warning on attempt to update a join-ed resultset');
Modified: DBIx-Class/0.08/branches/subquery/t/77prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/77prefetch.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/77prefetch.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -2,6 +2,7 @@
use warnings;
use Test::More;
+use Test::Exception;
use lib qw(t/lib);
use DBICTest;
use Data::Dumper;
@@ -16,7 +17,7 @@
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 58 );
+ : ( tests => 68 );
}
# figure out if we've got a version of sqlite that is older than 3.2.6, in
@@ -45,6 +46,49 @@
is(Dumper($attr), $attr_str, 'Attribute hash untouched after search()');
cmp_ok($rs + 0, '==', 3, 'Correct number of records returned');
+# 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)
+{
+ my ($cd_rs, $attrs);
+
+ # test a real-life case - rs is obtained by an implicit m2m join
+ $cd_rs = $schema->resultset ('Producer')->first->cds;
+ $attrs = Dumper $cd_rs->{attrs};
+
+ $cd_rs->search ({})->all;
+ is (Dumper ($cd_rs->{attrs}), $attrs, 'Resultset attributes preserved after a simple search');
+
+ lives_ok (sub {
+ $cd_rs->search ({'artist.artistid' => 1}, { prefetch => 'artist' })->all;
+ is (Dumper ($cd_rs->{attrs}), $attrs, 'Resultset attributes preserved after search with prefetch');
+ }, 'first prefetching search ok');
+
+ lives_ok (sub {
+ $cd_rs->search ({'artist.artistid' => 1}, { prefetch => 'artist' })->all;
+ is (Dumper ($cd_rs->{attrs}), $attrs, 'Resultset attributes preserved after another search with prefetch')
+ }, 'second prefetching search ok');
+
+
+ # test a regular rs with an empty seen_join injected - it should still work!
+ $cd_rs = $schema->resultset ('CD');
+ $cd_rs->{attrs}{seen_join} = {};
+ $attrs = Dumper $cd_rs->{attrs};
+
+ $cd_rs->search ({})->all;
+ is (Dumper ($cd_rs->{attrs}), $attrs, 'Resultset attributes preserved after a simple search');
+
+ lives_ok (sub {
+ $cd_rs->search ({'artist.artistid' => 1}, { prefetch => 'artist' })->all;
+ is (Dumper ($cd_rs->{attrs}), $attrs, 'Resultset attributes preserved after search with prefetch');
+ }, 'first prefetching search ok');
+
+ lives_ok (sub {
+ $cd_rs->search ({'artist.artistid' => 1}, { prefetch => 'artist' })->all;
+ is (Dumper ($cd_rs->{attrs}), $attrs, 'Resultset attributes preserved after another search with prefetch')
+ }, 'second prefetching search ok');
+}
+
+
my $queries = 0;
$schema->storage->debugcb(sub { $queries++; });
$schema->storage->debug(1);
Modified: DBIx-Class/0.08/branches/subquery/t/81transactions.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/81transactions.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/81transactions.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -260,7 +260,7 @@
});
$guard->commit;
- } qr/No such column made_up_column .*? at .*?81transactions.t line \d+/, "Error propogated okay";
+ } qr/No such column made_up_column .*? at .*?81transactions.t line \d+/s, "Error propogated okay";
ok(!$artist_rs->find({name => 'Death Cab for Cutie'}), "Artist not created");
Modified: DBIx-Class/0.08/branches/subquery/t/86sqlt.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/86sqlt.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/86sqlt.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -10,7 +10,7 @@
my $schema = DBICTest->init_schema;
-plan tests => 132;
+plan tests => 133;
my $translator = SQL::Translator->new(
parser_args => {
@@ -29,7 +29,7 @@
$schema->source('Track')->sqlt_deploy_callback(sub {
my ($self, $sqlt_table) = @_;
- if ($sqlt_table->schema->translator->producer_type =~ /SQLite$/ ) {
+ if ($schema->storage->sqlt_type eq 'SQLite' ) {
$sqlt_table->add_index( name => 'track_title', fields => ['title'] )
or die $sqlt_table->error;
}
@@ -282,6 +282,18 @@
# the 'dummy' table
ok( !defined($tschema->get_table('dummy')), "Dummy table was removed by hook");
+# Test that the Artist resultsource sqlt_deploy_hook was called okay and added
+# an index
+SKIP: {
+ skip ('Artist sqlt_deploy_hook is only called with an SQLite backend', 1)
+ if $schema->storage->sqlt_type ne 'SQLite';
+
+ ok( ( grep
+ { $_->name eq 'artist_name_hookidx' }
+ $tschema->get_table('artist')->get_indices
+ ), 'sqlt_deploy_hook fired within a resultsource');
+}
+
# Test that nonexistent constraints are not found
my $constraint = get_constraint('FOREIGN KEY', 'cd', ['title'], 'cd', ['year']);
ok( !defined($constraint), 'nonexistent FOREIGN KEY constraint not found' );
Modified: DBIx-Class/0.08/branches/subquery/t/89dbicadmin.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/89dbicadmin.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/89dbicadmin.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -38,25 +38,53 @@
my $schema = DBICTest->init_schema( sqlite_use_file => 1 ); # reinit a fresh db for every run
my $employees = $schema->resultset('Employee');
- my @cmd = ($^X, qw|script/dbicadmin --quiet --schema=DBICTest::Schema --class=Employee --tlibs|, q|--connect=["dbi:SQLite:dbname=t/var/DBIxClass.db","","",{"AutoCommit":1}]|, qw|--force --tlibs|);
- system(@cmd, qw|--op=insert --set={"name":"Matt"}|);
- ok( ($employees->count()==1), 'insert count' );
+ system( _prepare_system_args( qw|--op=insert --set={"name":"Matt"}| ) );
+ ok( ($employees->count()==1), "$ENV{JSON_ANY_ORDER}: insert count" );
my $employee = $employees->find(1);
- ok( ($employee->name() eq 'Matt'), 'insert valid' );
+ ok( ($employee->name() eq 'Matt'), "$ENV{JSON_ANY_ORDER}: insert valid" );
- system(@cmd, qw|--op=update --set={"name":"Trout"}|);
+ system( _prepare_system_args( qw|--op=update --set={"name":"Trout"}| ) );
$employee = $employees->find(1);
- ok( ($employee->name() eq 'Trout'), 'update' );
+ ok( ($employee->name() eq 'Trout'), "$ENV{JSON_ANY_ORDER}: update" );
- system(@cmd, qw|--op=insert --set={"name":"Aran"}|);
+ system( _prepare_system_args( qw|--op=insert --set={"name":"Aran"}| ) );
- open(my $fh, "-|", @cmd, qw|--op=select --attrs={"order_by":"name"}|) or die $!;
- my $data = do { local $/; <$fh> };
- close($fh);
- ok( ($data=~/Aran.*Trout/s), 'select with attrs' );
+ SKIP: {
+ skip ("MSWin32 doesn't support -| either", 1) if $^O eq 'MSWin32';
- system(@cmd, qw|--op=delete --where={"name":"Trout"}|);
- ok( ($employees->count()==1), 'delete' );
+ open(my $fh, "-|", _prepare_system_args( qw|--op=select --attrs={"order_by":"name"}| ) ) or die $!;
+ my $data = do { local $/; <$fh> };
+ close($fh);
+ ok( ($data=~/Aran.*Trout/s), "$ENV{JSON_ANY_ORDER}: select with attrs" );
+ }
+
+ system( _prepare_system_args( qw|--op=delete --where={"name":"Trout"}| ) );
+ ok( ($employees->count()==1), "$ENV{JSON_ANY_ORDER}: delete" );
}
+
+# Why do we need this crap? Apparently MSWin32 can not pass through quotes properly
+# (sometimes it will and sometimes not, depending on what compiler was used to build
+# perl). So we go the extra mile to escape all the quotes. We can't also use ' instead
+# of ", because JSON::XS (proudly) does not support "malformed JSON" as the author
+# calls it. Bleh.
+#
+sub _prepare_system_args {
+ my $perl = $^X;
+ my @args = (
+ qw|script/dbicadmin --quiet --schema=DBICTest::Schema --class=Employee --tlibs|,
+ q|--connect=["dbi:SQLite:dbname=t/var/DBIxClass.db","","",{"AutoCommit":1}]|,
+ qw|--force --tlibs|,
+ @_,
+ );
+
+ if ( $^O eq 'MSWin32' ) {
+ $perl = qq|"$perl"|; # execution will fail if $^X contains paths
+ for (@args) {
+ $_ =~ s/"/\\"/g;
+ }
+ }
+
+ return ($perl, @args);
+}
Modified: DBIx-Class/0.08/branches/subquery/t/89inflate_datetime.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/89inflate_datetime.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/89inflate_datetime.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -10,7 +10,7 @@
eval { require DateTime::Format::MySQL };
plan skip_all => "Need DateTime::Format::MySQL for inflation tests" if $@;
-plan tests => 28;
+plan tests => 32;
# inflation test
my $event = $schema->resultset("Event")->find(1);
@@ -58,6 +58,11 @@
hour => 13, minute => 34, second => 56, time_zone => "America/New_York" ),
});
+is ($event_tz->starts_at->day_name, "Montag", 'Locale de_DE loaded: day_name');
+is ($event_tz->starts_at->month_name, "Dezember", 'Locale de_DE loaded: month_name');
+is ($event_tz->created_on->day_name, "Tuesday", 'Default locale loaded: day_name');
+is ($event_tz->created_on->month_name, "January", 'Default locale loaded: month_name');
+
my $starts_at = $event_tz->starts_at;
is("$starts_at", '2007-12-31T00:00:00', 'Correct date/time using timezone');
Modified: DBIx-Class/0.08/branches/subquery/t/94versioning.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/94versioning.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/94versioning.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -16,9 +16,9 @@
unless ($dsn);
- eval "use DBD::mysql; use SQL::Translator 0.09;";
+ eval "use DBD::mysql; use SQL::Translator 0.09003;";
plan $@
- ? ( skip_all => 'needs DBD::mysql and SQL::Translator 0.09 for testing' )
+ ? ( skip_all => 'needs DBD::mysql and SQL::Translator 0.09003 for testing' )
: ( tests => 22 );
}
Modified: DBIx-Class/0.08/branches/subquery/t/99dbic_sqlt_parser.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/99dbic_sqlt_parser.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/99dbic_sqlt_parser.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -7,9 +7,9 @@
BEGIN {
- eval "use DBD::mysql; use SQL::Translator 0.09;";
+ eval "use DBD::mysql; use SQL::Translator 0.09003;";
if ($@) {
- plan skip_all => 'needs DBD::mysql and SQL::Translator 0.09 for testing';
+ plan skip_all => 'needs DBD::mysql and SQL::Translator 0.09003 for testing';
}
}
Modified: DBIx-Class/0.08/branches/subquery/t/99rh_perl_perf_bug.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/99rh_perl_perf_bug.t 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/99rh_perl_perf_bug.t 2009-02-16 22:03:55 UTC (rev 5490)
@@ -61,11 +61,15 @@
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
@@ -106,8 +110,12 @@
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",
);
}
Modified: DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Artist.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Artist.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -56,9 +56,8 @@
sub sqlt_deploy_hook {
my ($self, $sqlt_table) = @_;
-
if ($sqlt_table->schema->translator->producer_type =~ /SQLite$/ ) {
- $sqlt_table->add_index( name => 'artist_name', fields => ['name'] )
+ $sqlt_table->add_index( name => 'artist_name_hookidx', fields => ['name'] )
or die $sqlt_table->error;
}
}
Added: DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Encoded.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Encoded.pm (rev 0)
+++ DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/Encoded.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -0,0 +1,39 @@
+package # hide from PAUSE
+ DBICTest::Schema::Encoded;
+
+use base 'DBIx::Class::Core';
+
+use strict;
+use warnings;
+
+__PACKAGE__->table('encoded');
+__PACKAGE__->add_columns(
+ 'id' => {
+ data_type => 'integer',
+ is_auto_increment => 1
+ },
+ 'encoded' => {
+ data_type => 'varchar',
+ size => 100,
+ is_nullable => 1,
+ },
+);
+
+__PACKAGE__->set_primary_key('id');
+
+sub set_column {
+ my ($self, $col, $value) = @_;
+ if( $col eq 'encoded' ){
+ $value = reverse split '', $value;
+ }
+ $self->next::method($col, $value);
+}
+
+sub new {
+ my($self, $attr, @rest) = @_;
+ $attr->{encoded} = reverse split '', $attr->{encoded}
+ if defined $attr->{encoded};
+ return $self->next::method($attr, @rest);
+}
+
+1;
Modified: DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/EventTZ.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/EventTZ.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema/EventTZ.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -10,7 +10,7 @@
__PACKAGE__->add_columns(
id => { data_type => 'integer', is_auto_increment => 1 },
- starts_at => { data_type => 'datetime', extra => { timezone => "America/Chicago" } },
+ starts_at => { data_type => 'datetime', extra => { timezone => "America/Chicago", locale => 'de_DE' } },
created_on => { data_type => 'timestamp', extra => { timezone => "America/Chicago", floating_tz_ok => 1 } },
);
Modified: DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema.pm 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/lib/DBICTest/Schema.pm 2009-02-16 22:03:55 UTC (rev 5490)
@@ -44,7 +44,7 @@
),
qw/SelfRefAlias TreeLike TwoKeyTreeLike Event EventTZ NoPrimaryKey/,
qw/Collection CollectionObject TypedObject Owners BooksInLibrary/,
- qw/ForceForeign/,
+ qw/ForceForeign Encoded/,
);
sub sqlt_deploy_hook {
Modified: DBIx-Class/0.08/branches/subquery/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/lib/sqlite.sql 2009-02-16 21:27:49 UTC (rev 5489)
+++ DBIx-Class/0.08/branches/subquery/t/lib/sqlite.sql 2009-02-16 22:03:55 UTC (rev 5490)
@@ -411,5 +411,12 @@
value varchar(100) NOT NULL
);
+--
+-- Table: encoded
+--
+CREATE TABLE encoded (
+ id INTEGER PRIMARY KEY NOT NULL,
+ encoded varchar(100) NOT NULL
+);
COMMIT;
More information about the Bast-commits
mailing list