Merge 'trunk' into 'pod_fixes'
Peter Rabbitson [Sun, 31 Jan 2010 08:41:45 +0000 (08:41 +0000)]
r8426@Thesaurus (orig r8413):  ribasushi | 2010-01-22 11:35:15 +0100
Moev failing regression test away from trunk
r8431@Thesaurus (orig r8418):  frew | 2010-01-22 17:05:12 +0100
fix name of _is_numeric to _is_column_numeric

r8437@Thesaurus (orig r8424):  ribasushi | 2010-01-26 09:33:42 +0100
Switch to Test::Exception
r8438@Thesaurus (orig r8425):  ribasushi | 2010-01-26 09:48:30 +0100
Test txn_scope_guard regression
r8439@Thesaurus (orig r8426):  ribasushi | 2010-01-26 10:10:11 +0100
Fix txn_begin on external non-AC coderef regression
r8443@Thesaurus (orig r8430):  ribasushi | 2010-01-26 14:19:50 +0100
 r8304@Thesaurus (orig r8292):  nigel | 2010-01-13 16:05:48 +0100
 Branch to extend ::Schema::Versioned to handle series of upgrades
 r8320@Thesaurus (orig r8308):  nigel | 2010-01-14 16:52:50 +0100
 Changes to support multiple step schema version updates
 r8321@Thesaurus (orig r8309):  nigel | 2010-01-14 17:05:21 +0100
 Changelog for Changes to support multiple step schema version updates
 r8393@Thesaurus (orig r8380):  ribasushi | 2010-01-19 13:59:51 +0100
 Botched merge (tests still fail)
 r8395@Thesaurus (orig r8382):  ribasushi | 2010-01-19 17:37:07 +0100
 More cleanup
 r8396@Thesaurus (orig r8383):  ribasushi | 2010-01-19 17:48:09 +0100
 Fix last pieces of retardation and UNtodo the quick cycle
 r8442@Thesaurus (orig r8429):  ribasushi | 2010-01-26 14:18:53 +0100
 No need for 2 statements to get the version

r8445@Thesaurus (orig r8432):  ribasushi | 2010-01-26 14:22:16 +0100
 r8161@Thesaurus (orig r8149):  ovid | 2009-12-18 15:59:56 +0100
 Prefetch queries make inefficient SQL when combined with a pager.  This branch
 is to try to isolate some of the join conditions and figure out if we can fix
 this.

 r8166@Thesaurus (orig r8154):  ovid | 2009-12-18 18:17:55 +0100
 Refactor internals to expose some join logic. Awful method and args :(

 r8319@Thesaurus (orig r8307):  ovid | 2010-01-14 15:37:35 +0100
 Attempt to factor our alias handling has mostly failed.

 r8330@Thesaurus (orig r8318):  ribasushi | 2010-01-15 03:02:21 +0100
 Better refactor
 r8332@Thesaurus (orig r8320):  ribasushi | 2010-01-15 03:14:39 +0100
 Better varnames
 r8347@Thesaurus (orig r8335):  ribasushi | 2010-01-17 11:33:55 +0100
 More mangling
 r8348@Thesaurus (orig r8336):  ribasushi | 2010-01-17 13:44:00 +0100
 Getting warmer
 r8349@Thesaurus (orig r8337):  ribasushi | 2010-01-17 14:00:20 +0100
 That was tricky :)
 r8352@Thesaurus (orig r8340):  ribasushi | 2010-01-17 15:57:06 +0100
 Turned out to be much trickier
 r8354@Thesaurus (orig r8342):  ribasushi | 2010-01-17 16:29:20 +0100
 This is made out of awesome
 r8355@Thesaurus (orig r8343):  ribasushi | 2010-01-17 16:46:02 +0100
 Changes
 r8400@Thesaurus (orig r8387):  ribasushi | 2010-01-20 08:17:44 +0100
 Whoops - need to dsable quoting

r8459@Thesaurus (orig r8446):  ribasushi | 2010-01-27 11:56:15 +0100
Clean up some stuff
r8463@Thesaurus (orig r8450):  ribasushi | 2010-01-27 12:08:04 +0100
Merge some cleanups from the prefetch branch
r8466@Thesaurus (orig r8453):  ribasushi | 2010-01-27 12:33:33 +0100
DSNs can not be empty
r8471@Thesaurus (orig r8458):  frew | 2010-01-27 21:38:42 +0100
fix silly multipk bug
r8472@Thesaurus (orig r8459):  ribasushi | 2010-01-28 11:13:16 +0100
Consolidate insert_bulk guards (and make them show up correctly in the trace)
r8473@Thesaurus (orig r8460):  ribasushi | 2010-01-28 11:28:30 +0100
Fix bogus test DDL
r8480@Thesaurus (orig r8467):  ribasushi | 2010-01-28 22:11:59 +0100
 r8381@Thesaurus (orig r8368):  moses | 2010-01-18 16:41:38 +0100
 Test commit
 r8425@Thesaurus (orig r8412):  ribasushi | 2010-01-22 11:25:01 +0100
 Informix test + cleanups
 r8428@Thesaurus (orig r8415):  ribasushi | 2010-01-22 11:59:25 +0100
 Initial informix support

r8482@Thesaurus (orig r8469):  ribasushi | 2010-01-28 22:19:23 +0100
Informix changes
r8483@Thesaurus (orig r8470):  ribasushi | 2010-01-29 12:01:41 +0100
Require non-warning-spewing MooseX::Types
r8484@Thesaurus (orig r8471):  ribasushi | 2010-01-29 12:15:15 +0100
Enhance warning test a bit (seems to fail on 5.8)
r8485@Thesaurus (orig r8472):  ribasushi | 2010-01-29 13:00:54 +0100
Fugly 5.8 workaround
r8494@Thesaurus (orig r8481):  frew | 2010-01-31 06:47:42 +0100
cleanup (3 arg open, 1 grep instead of 3)

Changes
lib/DBIx/Class/InflateColumn/File.pm
lib/DBIx/Class/Manual/Cookbook.pod
lib/DBIx/Class/Manual/Intro.pod

diff --git a/Changes b/Changes
index 53026f5..564b6c3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for DBIx::Class
 
         - Perl 5.8.1 is now the minimum supported version
+        - DBIx::Class::InflateColumn::File entered deprecated state
         - Massive optimization of the join resolution code - now joins
           will be removed from the resulting SQL if DBIC can prove they
           are not referenced by anything
index 0fde5e8..a1fc613 100644 (file)
@@ -107,7 +107,15 @@ sub _save_file_column {
 
 =head1 NAME
 
-DBIx::Class::InflateColumn::File -  map files from the Database to the filesystem.
+DBIx::Class::InflateColumn::File -  DEPRECATED (superseded by DBIx::Class::InflateColumn::FS)
+
+=head2 Deprecation Notice
+
+ This component has a number of architectural deficiencies and is not
+ recommended for further use. It will be retained for backwards
+ compatibility, but no new functionality patches will be accepted.
+ Please consider using the much more mature and actively supported
+ DBIx::Class::InflateColumn::FS
 
 =head1 SYNOPSIS
 
index 8082ebf..fc7891c 100644 (file)
@@ -1821,12 +1821,27 @@ You can accomplish this by overriding C<insert> on your objects:
   sub insert {
     my ( $self, @args ) = @_;
     $self->next::method(@args);
-    $self->cds->new({})->fill_from_artist($self)->insert;
+    $self->create_related ('cds', \%initial_cd_data );
     return $self;
   }
 
-where C<fill_from_artist> is a method you specify in C<CD> which sets
-values in C<CD> based on the data in the C<Artist> object you pass in.
+If you want to wrap the two inserts in a transaction (for consistency,
+an excellent idea), you can use the awesome
+L<DBIx::Class::Storage::TxnScopeGuard>:
+
+  sub insert {
+    my ( $self, @args ) = @_;
+
+    my $guard = $self->result_source->schema->txn_scope_guard;
+
+    $self->next::method(@args);
+    $self->create_related ('cds', \%initial_cd_data );
+
+    $guard->commit;
+
+    return $self
+  }
+
 
 =head2 Wrapping/overloading a column accessor
 
index 4625d06..2728c5a 100644 (file)
@@ -397,6 +397,52 @@ L<DBIx::Class::ResultSet/ATTRIBUTES>.
 
 =head1 NOTES
 
+=head2 The Significance and Importance of Primary Keys
+
+The concept of a L<primary key|DBIx::Class::ResultSource/set_primary_key> in
+DBIx::Class warrants special discussion. The formal definition (which somewhat
+resembles that of a classic RDBMS) is I<a unique constraint that is least
+likely to change after initial row creation>. However this is where the
+similarity ends. While in a RDBMS you can safely change any column within a
+row, you can not do the same in DBIC because B<you will be breaking the tie
+between a specific L<DBIx::Class::Row> object and a specific row in your
+database>. Any time you call a CRUD operation on a row (e.g.
+L<delete|DBIx::Class::Row/delete>,
+L<update|DBIx::Class::Row/update>,
+L<discard_changes|DBIx::Class::Row/discard_changes>,
+etc.) DBIx::Class will use the B<current values> of the
+L<primary key|DBIx::Class::ResultSource/set_primary_key> columns to populate
+the C<WHERE> clause necessary to accomplish the operation.
+
+This is why it is important to declare a
+L<primary key|DBIx::Class::ResultSource/set_primary_key> on all your result
+sources B<even if the underlying RDBMS does not have one>. In a pinch one can
+always declare each row identifiable by all its columns:
+
+ __PACKAGE__->set_primary_keys (__PACKAGE__->columns);
+
+If you elect not to declare a C<primary key>, DBIx::Class will behave correctly
+by throwing exceptions on any row operation that relies on unique identifiable
+rows. If you inherited datasets with multiple identical rows in them, you can
+still operate with such sets provided you only utilize
+L<DBIx::Class::ResultSet> CRUD methods:
+L<search|DBIx::Class::ResultSet/search>,
+L<update|DBIx::Class::ResultSet/update>,
+L<delete|DBIx::Class::ResultSet/delete>
+
+For example, the following would not work:
+
+ my $row = $schema->resultset('People')
+   ->search({ last_name => 'Dantes' })
+   ->next;
+ $row->update({ children => 2 }); # <-- exception thrown because $row isn't
+                                  # necessarily unique
+
+So instead the following should be done:
+
+ $schema->resultset('People')->search({ last_name => 'Dantes' })
+   ->update({ children => 2 }); # <-- update's ALL Dantes to have children of 2
+
 =head2 Problems on RHEL5/CentOS5
 
 There used to be an issue with the system perl on Red Hat Enterprise