I know I can get a views result programatically with:
$view = views_get_view('view_name'); $view->execute(); $response1 = $view->result;
I can get this views sql query from the views ui (views->settings->show sql). If I place this query in a db_query() and get the results with:
$query = "... "; //long sql query from views ui (in my case with left_joins which reference field collections $result = db_query($query); $response2 = $result->fetchAll(); //different than $response1 above?
the responses returned from $response1 (from views) and $response2 (from db_query) are different, namely, the $response2 doesn't contain my field data (or at least not all of it). I'm not sure if this has anything to do with the fact that I'm using field collections. It also seems to not work when using the different fetch() functions. If I run this query through phpmyadmin it produces the same limited results as $response2 (from db_query) so I'm wondering if views runs something aside from the query. I'd like to find out what the method result() does for the views object, but I'm not sure where that is in the docs or where the function is in my views source. If someone can show me where that is, that would also be helpful.