fix ->isa check in Replicated trait, Model POD and SchemaProxy RS options
Rafael Kitover [Wed, 11 May 2011 06:00:06 +0000 (06:00 +0000)]
Changes
lib/Catalyst/Helper/Model/DBIC/Schema.pm
lib/Catalyst/Model/DBIC/Schema.pm
lib/Catalyst/TraitFor/Model/DBIC/Schema/Replicated.pm
lib/Catalyst/TraitFor/Model/DBIC/Schema/SchemaProxy.pm

diff --git a/Changes b/Changes
index 5df8166..9e21016 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,9 @@
 Revision history for Perl extension Catalyst::Model::DBIC::Schema
 
+        - make sure storage_type class is loaded before ->isa check in
+          Replicated trait (RT#65791)
         - fix regex stringification test for perl 5.14 (RT#68098)
+        - update connect_info POD (RT#66010)
 
 0.48  Thu Dec  9 21:08:33 UTC 2010
         - fix usage of Try::Tiny in helper
index e9cac2c..1c98a0f 100644 (file)
@@ -88,11 +88,7 @@ user and pass can be omitted for sqlite, since they are always empty
   script/myapp_create.pl model CatalystModelName DBIC::Schema \
     MyApp::SchemaClass create=static dbi:SQLite:foo.db \
     AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
-    on_connect_do='["select 1", "select 2"]' quote_char='"'
-
-If using a 2 character quote_char:
-
-  script/myapp_create.pl ... quote_char='[]'
+    on_connect_do='["select 1", "select 2"]' quote_names=1
 
 B<ON WINDOWS COMMAND LINES QUOTING RULES ARE DIFFERENT>
 
@@ -101,7 +97,7 @@ In C<cmd.exe> the above example would be:
   script/myapp_create.pl model CatalystModelName DBIC::Schema \
     MyApp::SchemaClass create=static dbi:SQLite:foo.db \
     AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
-    on_connect_do="[\"select 1\", \"select 2\"]" quote_char="\""
+    on_connect_do="[\"select 1\", \"select 2\"]" quote_names=1
 
 Same, but with extra Schema::Loader args (separate multiple values by commas):
 
index 493f38d..8dfe07c 100644 (file)
@@ -33,7 +33,7 @@ A typical usage of the helper script would be:
 
     script/myapp_create.pl model FilmDB DBIC::Schema MyApp::Schema::FilmDB \
         create=static dbi:mysql:filmdb dbusername dbpass \
-        quote_char='`' name_sep='.'
+        quote_names=1
 
 If you are unfamiliar with L<DBIx::Class>, see L<DBIx::Class::Manual::Intro>
 first.
@@ -169,13 +169,12 @@ C<Catalyst::Model::> namespace.  This parameter is required.
 
 =head2 connect_info
 
-This is an arrayref of connection parameters, which are specific to your
-C<storage_type> (see your storage type documentation for more details). 
-If you only need one parameter (e.g. the DSN), you can just pass a string 
-instead of an arrayref.
+This is a hashref or arrayref of connection parameters, which are specific to
+your C<storage_type> (see your storage type documentation for more details). If
+you only need one parameter (e.g. the DSN), you can just pass a string.
 
 This is not required if C<schema_class> already has connection information
-defined inside itself (which isn't highly recommended, but can be done)
+defined inside itself (which isn't highly recommended, but can be done.)
 
 For L<DBIx::Class::Storage::DBI>, which is the only supported
 C<storage_type> in L<DBIx::Class> at the time of this writing, the
@@ -220,7 +219,7 @@ Or using L<Config::General>:
             user   postgres
             password ""
             auto_savepoint 1
-           quote_char """
+            quote_names 1
             on_connect_do   some SQL statement
             on_connect_do   another SQL statement
         </connect_info>
@@ -246,7 +245,7 @@ Or using L<YAML>:
           LongReadLen: 1000000
           LongTruncOk: 1
           on_connect_call: 'datetime_setup'
-         quote_char: '"'
+          quote_names: 1
 
 The old arrayref style with hashrefs for L<DBI> then L<DBIx::Class> options is also
 supported:
index 5b38909..73317d8 100644 (file)
@@ -88,6 +88,8 @@ after setup => sub {
             "DBIx::Class::Storage$storage_type"
             : $storage_type;
 
+        Class::MOP::load_class($class);
+
         croak "This storage_type cannot be used with replication"
             unless $class->isa('DBIx::Class::Storage::DBI::Replicated');
     } else {
index 0f97e97..bba6279 100644 (file)
@@ -165,19 +165,10 @@ sub _pass_options_to_schema {
 sub _pass_options_to_resultset {
     my ($self, $source, $args) = @_;
 
-    my @attributes = map {
-        $_->init_arg || ()
-    } $self->meta->get_all_attributes;
-
-    my %attributes;
-    @attributes{@attributes} = ();
-
     for my $opt (keys %$args) {
-        if (not exists $attributes{$opt}) {
-            my $rs_class = $self->schema->source($source)->resultset_class;
-            next unless $rs_class->can($opt);
-            $rs_class->$opt($args->{$opt});
-        }
+        my $rs_class = $self->schema->source($source)->resultset_class;
+        next unless $rs_class->can($opt);
+        $rs_class->$opt($args->{$opt});
     }
 }