++ed by:
EMAZEP POTATOGIM ROMANF JROBINSON AWNCORP

11 PAUSE users
15 non-PAUSE users.

Henry Van Styn

NAME

RapidApp::DBIC::HashExtractor

SYNOPSYS

        my $ex= RapidApp::DBIC::HashExtractor->new(
     source => $db->source('Object'),
     spec => {
       workspace => {},
       user => {
         user_to_reporters_users => {},
       },
     },
  );
  
  my $rs= $db->resultset('Object')->search_rs({ object_id => 31188 });
  print Dumper $ex->process_resultset($rs);
  
  ---------------------
  
  {
    'deleted' => '0',
    'updated_ts' => '2011-06-17 23:37:57',
    'created_ts' => '2011-03-28 00:08:27',
    'parent_workspace_id' => '31180',
    'read_only' => '0',
    'type_id' => '1',
    'user' => {
      'disabled' => '0',
      'user_to_reporters_users' => [
        {
          'reporter_id' => '31185',
          'user_id' => '31188'
        },
        {
          'reporter_id' => '31186',
          'user_id' => '31188'
        }
      ],
      'username' => 'mconrad',
      'password' => 'foo',
      'object_id' => '31188',
      'last_login_ts' => '2011-06-17 23:37:57'
    },
  }

DESCRIPTION

This module takes a resultsource and a column/relation specification, and builds an extraction routine that efficiently pulls in the requested data, and returns it as a hash.

It is very similar to DbicExtQuery, except that it returns a tree of hashes instead of a flat table, and can "tree up" multi-relations.

The extraction routine can then be used to export any number of resultsets of that source with minimal overhead.

The current design pulls everything in as one query with potentially many joins. If several large many-to-many joins are used at once, this will result in a large cross-product, and will be slow. If the joined rows are relatively few, the cost of the cross-product should be outweighed by avoiding the overhead of setting up lots of tiny sub-queries.