[Dbix-class] Using result_source for custom query breaks with ->deploy

Matt Lawrence matt.lawrence at ymogen.net
Thu Jan 31 16:23:08 GMT 2008


J. Shirley wrote:
> Hey all,
>
> Easy patch for this, but wanted to make sure that I wasn't missing
> anything at all.  I have a custom result source instance to do a big
> query (subselect) as what is described in the cookbook.
>
> Works like a champ.  Except, I can't ->deploy anymore.  When it
> iterates through the tables (unless I specify which) it gets to this
> instance and does:
> CREATE TABLE SCALAR(0x8153720) ...
>
> That obviously doesn't work.  The quick fix to make this work is to
> just skip if the name of the source is a ref rather than a scalar.
>
> === lib/SQL/Translator/Parser/DBIx/Class.pm
> ==================================================================
> --- lib/SQL/Translator/Parser/DBIx/Class.pm     (revision 3808)
> +++ lib/SQL/Translator/Parser/DBIx/Class.pm     (local)
> @@ -70,11 +70,17 @@
>          my $source = $dbixschema->source($moniker);
>
>          next if $seen_tables{$source->name}++;
> +        # Not a traditional table
> +        next if ref $source->name;
>
>          my $table = $schema->add_table(
>                                         name => $source->name,
>
> Comments?
>
Does it matter if %seen_tables gets a "SCALAR(0xdeadbeef)" key?

Matt




More information about the DBIx-Class mailing list