Where is the result of the query is stored? I have created a view page and a block. I need to get the query from the view block. The query preview can be seen.

The following code was found to fetch the query from view

function status_update_views_pre_execute(&amp;$view) {
 if ($view-&gt;name == 'project_initiative') {
   $query = (string)$view-&gt;build_info['query'];
   echo $query;
 }
}


Where is the result of the query stored? How can I fetch it?

OR

the query is as follows

SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created, 'node' AS field_data_body_node_entity_type, 'node' AS field_data_field_project_name_node_entity_type FROM  {node} node LEFT JOIN {field_data_field_project_name} field_data_field_project_name ON node.nid = field_data_field_project_name.entity_id AND (field_data_field_project_name.entity_type = 'node' AND field_data_field_project_name.deleted = '0') WHERE (( (field_data_field_project_name.field_project_name_target_id = '55' ) )AND(( (node.status = '1') AND (node.type IN  ('status_update')) ))) ORDER BY node_created DESC LIMIT 10 OFFSET 0


How can I execute it to get the result in drupal custom module?
You could get the nids like this:

// load and display view
$view = views_get_view('view_name');
$view-&gt;set_display('block_1');
$view-&gt;execute();
$nids = [];
// get all nids from the result 
foreach ($view-&gt;result as $result) {
   $nids[] = $result-&gt;nid;
}
// render view
print $view-&gt;render();