From: Peter Rabbitson Date: Fri, 19 Feb 2010 15:40:18 +0000 (+0000) Subject: Fix stupid sqlt parser regression X-Git-Tag: v0.08120~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=02730621d7fc84fa478c76c3c029baf855ad2c41;p=dbsrgits%2FDBIx-Class.git Fix stupid sqlt parser regression --- diff --git a/Changes b/Changes index 6be2659..6907498 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,9 @@ Revision history for DBIx::Class - Fix count() with group_by aliased-function resultsets - Massive refactor and cleanup of primary key handling - Fixed regression losing custom result_class (really this time) + (RT#54697) + - Fixed regression in DBIC SQLT::Parser failing with a classname + (as opposed to a schema object) 0.08119 2010-02-15 09:36:00 (UTC) - Add $rs->is_ordered to test for existing order_by on a resultset diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 2efc5b1..32fe04f 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -33,7 +33,7 @@ use base qw(Exporter); sub parse { # this is a hack to prevent schema leaks due to a retarded SQLT implementation # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway) - Scalar::Util::weaken ($_[1]); + Scalar::Util::weaken ($_[1]) if ref ($_[1]); my ($tr, $data) = @_; my $args = $tr->parser_args; diff --git a/t/99dbic_sqlt_parser.t b/t/99dbic_sqlt_parser.t index 7487c72..5ba72a8 100644 --- a/t/99dbic_sqlt_parser.t +++ b/t/99dbic_sqlt_parser.t @@ -18,12 +18,17 @@ BEGIN { # Test for SQLT-related leaks { my $s = DBICTest::Schema->clone; - create_schema ({ schema => $s }); + my $sqlt_schema = create_schema ({ schema => $s }); Scalar::Util::weaken ($s); ok (!$s, 'Schema not leaked'); + + isa_ok ($sqlt_schema, 'SQL::Translator::Schema', 'SQLT schema object produced'); } +# make sure classname-style works +lives_ok { isa_ok (create_schema ({ schema => 'DBICTest::Schema' }), 'SQL::Translator::Schema', 'SQLT schema object produced') }; + my $schema = DBICTest->init_schema(); # Dummy was yanked out by the sqlt hook test