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
18 OR as an attribute:
19
20 my $rs = $schema->resultset('CD')->search({}, {
21 result_class => 'DBIx::Class::ResultClass::HashRefInflator',
22 });
23 while (my $hashref = $rs->next) {
24 ...
25 }
26
28 DBIx::Class is faster than older ORMs like Class::DBI but it still
29 isn't designed primarily for speed. Sometimes you need to quickly
30 retrieve the data from a massive resultset, while skipping the creation
31 of fancy result objects. Specifying this class as a "result_class" for
32 a resultset will change "$rs->next" to return a plain data hash-ref (or
33 a list of such hash-refs if "$rs->all" is used).
34
35 There are two ways of applying this class to a resultset:
36
37 • Specify "$rs->result_class" on a specific resultset to affect only
38 that resultset (and any chained off of it); or
39
40 • Specify "__PACKAGE__->result_class" on your source object to force
41 all uses of that result source to be inflated to hash-refs - this
42 approach is not recommended.
43
45 inflate_result
46 Inflates the result and prefetched data into a hash-ref (invoked by
47 DBIx::Class::ResultSet)
48
50 • This will not work for relationships that have been prefetched.
51 Consider the following:
52
53 my $artist = $artitsts_rs->search({}, {prefetch => 'cds' })->first;
54
55 my $cds = $artist->cds;
56 $cds->result_class('DBIx::Class::ResultClass::HashRefInflator');
57 my $first = $cds->first;
58
59 $first will not be a hashref, it will be a normal CD row since
60 HashRefInflator only affects resultsets at inflation time, and
61 prefetch causes relations to be inflated when the master $artist
62 row is inflated.
63
64 • Column value inflation, e.g., using modules like
65 DBIx::Class::InflateColumn::DateTime, is not performed. The
66 returned hash contains the raw database values.
67
69 Check the list of additional DBIC resources.
70
72 This module is free software copyright by the DBIx::Class (DBIC)
73 authors. You can redistribute it and/or modify it under the same terms
74 as the DBIx::Class library.
75
76
77
78perl v5.36.0 2D0B2I2x-:0:7C-l2a2ss::ResultClass::HashRefInflator(3)