Quote:
Originally Posted by Unregistered
Your code samples are quite useful. I do have a question though. . Despite the number of rows I pass in, SF seems to want to return 500, which is consistent with this description (which I actually found pretty funny)
****
By default, the number of rows returned in the query result object (batch size) returned in a query or queryMore call is set to 500. Client applications can change this setting by specifying the batch size in the call QueryOptions portion of the SOAP header before invoking the query call. The maximum batch size is 2,000 records. ___However this setting is only a suggestion. There is no guarantee that the requested batch size will be the actual batch size.___ This is done to maximize performance.
****
Is there an easy way to pull all the rows from a SF table in php?
Thanks-
jon dot bownds at praxisis dot com
|
If you look at this function:
PHP Code:
function get_accounts($connection)
{
$query = "Select Id FROM Account";
//$query = "Select Id, Name, ProductCode FROM product2";
$queryOptions = new QueryOptions(500);
$response = $connection->query(($query), $queryOptions);
// New code starts here
if ($response->size > 0)
{
$accounts = $response->records;
// Cycles through additional responses if the number of records
// exceeds the batch size
while (!$response->done)
{
set_time_limit(100);
$response = $connection->queryMore($response->queryLocator);
$accounts = array_merge($accounts, $response->records);
}
}
return $accounts;
}
the queryMore object will get all the rows, 500 at a time, until all the records are finished.
I have tables that which have over 130,000 records, running on Cron jobs every night to populate a local Oracle DB and I have examples on this site that will give you a complete working export script, using the account object as an example, that can be modified to work with any table
Hope that helps