googleapis / google-cloud-php

Google Cloud Client Library for PHP
https://cloud.google.com/php/docs/reference
Apache License 2.0
1.09k stars 436 forks source link

Query result to array or json #645

Closed lesterjanpearson closed 7 years ago

lesterjanpearson commented 7 years ago

is there a way to convert the query result to an array or json?

because I have 10k results and I have to iterate it. was wondering if there is fast way to convert all the result. $queryResults = $job->queryResults($options);

dwsupplee commented 7 years ago

Hey @lesterjanpearson, do you think iterator_to_array might fit your use case?

$array = iterator_to_array($queryResults->rows());
lesterjanpearson commented 7 years ago

this might be faster than looping and turning it into an array. thanks.

dwsupplee commented 7 years ago

No problem! I'm going to close out the issue, but feel free to re-open if there's anything else you'd like to discuss.