get_column auto-inflate

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

get_column auto-inflate

Todd Rinaldo
Hi,
Hi, I'd like a get_columns in ResultSetRow that actually inflates
columns by default.  Is there an easy way to pull this off?

Thanks,
Todd Rinaldo

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get_column auto-inflate

Peter Rabbitson
Todd Rinaldo wrote:
> Hi,
> Hi, I'd like a get_columns in ResultSetRow that actually inflates
> columns by default.  Is there an easy way to pull this off?
>

http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Row.pm#get_inflated_columns
maybe? :)


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get_column auto-inflate

Todd Rinaldo
In reply to this post by Todd Rinaldo
get_inflated_columns doesn't return a hash like get_columns does. I'm looking for get_columns with an inflate option.

thanks,

-----Original Message-----

From:  Peter Rabbitson <[hidden email]>
Subj:  Re: [Dbix-class] get_column auto-inflate
Date:  Sun Jul 20, 2008 9:54 am
Size:  542 bytes
To:  DBIx::Class user and developer list <[hidden email]>

Todd Rinaldo wrote:
> Hi,
> Hi, I'd like a get_columns in ResultSetRow that actually inflates
> columns by default.  Is there an easy way to pull this off?
>

http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Row.pm#get_inflated_columns
maybe? :)




_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get_column auto-inflate

Todd Rinaldo
In reply to this post by Todd Rinaldo
get_inflated_columns doesn't return a hash like get_columns does. I'm looking for get_columns with an inflate option.

thanks,

-----Original Message-----

From:  Peter Rabbitson <[hidden email]>
Subj:  Re: [Dbix-class] get_column auto-inflate
Date:  Sun Jul 20, 2008 9:54 am
Size:  542 bytes
To:  DBIx::Class user and developer list <[hidden email]>

Todd Rinaldo wrote:
> Hi,
> Hi, I'd like a get_columns in ResultSetRow that actually inflates
> columns by default.  Is there an easy way to pull this off?
>

http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Row.pm#get_inflated_columns
maybe? :)




_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get_column auto-inflate

claco
In reply to this post by Todd Rinaldo
Todd Rinaldo wrote:
> get_inflated_columns doesn't return a hash like get_columns does. I'm looking for get_columns with an inflate option.
>
> thanks,

Huh? get_columns returns a list just like get_inflated
_columns does.

I believe the pod is wrong.


sub get_inflated_columns {
   my $self = shift;
   return map {
     my $accessor = $self->column_info($_)->{'accessor'} || $_;
     ($_ => $self->$accessor);
   } $self->columns;
}


sub get_columns {
   my $self = shift;
   if (exists $self->{_inflated_column}) {
     foreach my $col (keys %{$self->{_inflated_column}}) {
       $self->store_column($col, $self->_deflated_column($col,
$self->{_inflated_column}{$col}))
         unless exists $self->{_column_data}{$col};
     }
   }
   return %{$self->{_column_data}};
}

sub get_dirty_columns {
   my $self = shift;
   return map { $_ => $self->{_column_data}{$_} }
            keys %{$self->{_dirty_columns}};
}



_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...

signature.asc (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get_column auto-inflate

claco
Christopher H. Laco wrote:

> Todd Rinaldo wrote:
>> get_inflated_columns doesn't return a hash like get_columns does. I'm
>> looking for get_columns with an inflate option.
>>
>> thanks,
>
> Huh? get_columns returns a list just like get_inflated
> _columns does.
>
> I believe the pod is wrong.
>
>
> sub get_inflated_columns {
>   my $self = shift;
>   return map {
>     my $accessor = $self->column_info($_)->{'accessor'} || $_;
>     ($_ => $self->$accessor);
>   } $self->columns;
> }
>
>
> sub get_columns {
>   my $self = shift;
>   if (exists $self->{_inflated_column}) {
>     foreach my $col (keys %{$self->{_inflated_column}}) {
>       $self->store_column($col, $self->_deflated_column($col,
> $self->{_inflated_column}{$col}))
>         unless exists $self->{_column_data}{$col};
>     }
>   }
>   return %{$self->{_column_data}};
> }
>
> sub get_dirty_columns {
>   my $self = shift;
>   return map { $_ => $self->{_column_data}{$_} }
>            keys %{$self->{_dirty_columns}};
> }

Looks like someone corrected the docs already.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Loading...