1DBIx::Class::ResultClasUss:e:rHaCsohnRterfiIbnuDftBleIadxt:oP:reC(rl3la)sDso:c:uRmeesnutlattCiloanss::HashRefInflator(3)
2
3
4
6 DBIx::Class::ResultClass::HashRefInflator - Get raw hashrefs from a
7 resultset
8
10 use DBIx::Class::ResultClass::HashRefInflator;
11
12 my $rs = $schema->resultset('CD');
13 $rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
14 while (my $hashref = $rs->next) {
15 ...
16 }
17
19 DBIx::Class is faster than older ORMs like Class::DBI but it still
20 isn't designed primarily for speed. Sometimes you need to quickly
21 retrieve the data from a massive resultset, while skipping the creation
22 of fancy row objects. Specifying this class as a "result_class" for a
23 resultset will change "$rs->next" to return a plain data hash-ref (or a
24 list of such hash-refs if "$rs->all" is used).
25
26 There are two ways of applying this class to a resultset:
27
28 · Specify "$rs->result_class" on a specific resultset to affect only
29 that resultset (and any chained off of it); or
30
31 · Specify "__PACKAGE__->result_class" on your source object to force
32 all uses of that result source to be inflated to hash-refs - this
33 approach is not recommended.
34
36 inflate_result
37 Inflates the result and prefetched data into a hash-ref (invoked by
38 DBIx::Class::ResultSet)
39
41 · This will not work for relationships that have been prefetched.
42 Consider the following:
43
44 my $artist = $artitsts_rs->search({}, {prefetch => 'cds' })->first;
45
46 my $cds = $artist->cds;
47 $cds->result_class('DBIx::Class::ResultClass::HashRefInflator');
48 my $first = $cds->first;
49
50 $first will not be a hashref, it will be a normal CD row since
51 HashRefInflator only affects resultsets at inflation time, and
52 prefetch causes relations to be inflated when the master $artist
53 row is inflated.
54
55 · Column value inflation, e.g., using modules like
56 DBIx::Class::InflateColumn::DateTime, is not performed. The
57 returned hash contains the raw database values.
58
59
60
61perl v5.12.0 2D0B1I0x-:0:5C-l1a2ss::ResultClass::HashRefInflator(3)