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

J. Shirley jshirley at gmail.com
Thu Jan 31 16:29:51 GMT 2008


On Jan 31, 2008 8:23 AM, Matt Lawrence <matt.lawrence at ymogen.net> wrote:

> 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.
> >
> > =3D=3D=3D lib/SQL/Translator/Parser/DBIx/Class.pm
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > --- lib/SQL/Translator/Parser/DBIx/Class.pm     (revision 3808)
> > +++ lib/SQL/Translator/Parser/DBIx/Class.pm     (local)
> > @@ -70,11 +70,17 @@
> >          my $source =3D $dbixschema->source($moniker);
> >
> >          next if $seen_tables{$source->name}++;
> > +        # Not a traditional table
> > +        next if ref $source->name;
> >
> >          my $table =3D $schema->add_table(
> >                                         name =3D> $source->name,
> >
> > Comments?
> >
> Does it matter if %seen_tables gets a "SCALAR(0xdeadbeef)" key?
>
> Matt
>
>
It _shouldn't_, since seen tables is only used there for that loop there.
It can go before that too (not sure what is best going forward)

-J


-- =

J. Shirley :: jshirley at gmail.com :: Killing two stones with one bird...
http://www.toeat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080131/8e5=
f9d94/attachment.htm


More information about the DBIx-Class mailing list