/**
 * 
 * 
 */
function buildResultSet(&$dbHandler, &$guiObj, $tproject_id, $tplan_id)
{
    $cfieldMgr = new cfield_mgr($dbHandler);
    // Get the custom fields linked/enabled on execution to a test project
    // This will be used on report to give name to header of columns that hold custom field value
    $guiObj->cfields = $cfieldMgr->get_linked_cfields_at_execution($tproject_id, 1, 'testcase', null, null, null, 'name');
    // this way on caller can be used on array operations, without warnings
    $guiObj->cfields = (array) $guiObj->cfields;
    if (count($guiObj->cfields) > 0) {
        foreach ($guiObj->cfields as $key => $values) {
            $cf_place_holder['cfields'][$key] = '';
        }
    }
    $cf_map = $cfieldMgr->get_linked_cfields_at_execution($tproject_id, 1, 'testcase', null, null, $tplan_id, 'exec_id');
    // need to transform in structure that allow easy display
    // Every row is an execution with exec data plus a column that contains following map:
    // 'cfields' => CFNAME1 => value
    //              CFNAME2 => value
    $guiObj->resultSet = array();
    if (!is_null($cf_map)) {
        foreach ($cf_map as $exec_id => $exec_info) {
            // Get common exec info and remove useless keys
            $guiObj->resultSet[$exec_id] = $exec_info[0];
            unset($guiObj->resultSet[$exec_id]['name']);
            unset($guiObj->resultSet[$exec_id]['label']);
            unset($guiObj->resultSet[$exec_id]['display_order']);
            unset($guiObj->resultSet[$exec_id]['id']);
            unset($guiObj->resultSet[$exec_id]['value']);
            // Collect custom fields values
            $guiObj->resultSet[$exec_id] += $cf_place_holder;
            foreach ($exec_info as $cfield_data) {
                $guiObj->resultSet[$exec_id]['cfields'][$cfield_data['name']] = $cfieldMgr->string_custom_field_value($cfield_data, null);
            }
        }
    }
    if (($guiObj->row_qty = count($cf_map)) == 0) {
        $guiObj->warning_msg = lang_get('no_linked_tc_cf');
    }
}