コード例 #1
0
ファイル: Sql.php プロジェクト: nnnnathann/piwik
/**
 * Performs a SELECT on a table one chunk at a time and returns an array
 * of every fetched row.
 * 
 * This function will break up a SELECT into several smaller SELECTs and
 * should be used when performing a SELECT that can take a long time to finish.
 * Using several smaller SELECTs will ensure that the table will not be locked
 * for too long.
 * 
 * @see Piwik_Sql::segmentedFetchFirst
 * 
 * @param string $sql The SQL to perform. The last two conditions of the WHERE
 *                    expression must be as follows: 'id >= ? AND id < ?' where
 *                    'id' is the int id of the table.
 * @param int $first The minimum ID to loop from.
 * @param int $last The maximum ID to loop to.
 * @param int $step The maximum number of rows to scan in each smaller SELECT.
 * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2)
 * @return array
 */
function Piwik_SegmentedFetchAll($sql, $first, $last, $step, $params = array())
{
    return Piwik_Sql::segmentedFetchAll($sql, $first, $last, $step, $params);
}