* @return primary keys in the given range
*/
public static NSArray<NSDictionary<String, Object>> primaryKeyValuesInRange(EOEditingContext ec, EOFetchSpecification spec, int start, int end) {
EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, spec.entityName());
NSArray<String> pkNames = entity.primaryKeyAttributeNames();
EOFetchSpecification clonedFetchSpec = (EOFetchSpecification)spec.clone();
clonedFetchSpec.setFetchesRawRows(true);
clonedFetchSpec.setRawRowKeyPaths(pkNames);
if (clonedFetchSpec instanceof ERXFetchSpecification) {
// remove any range setting as we will explicitly set start and end limit
((ERXFetchSpecification)clonedFetchSpec).setFetchRange(null);
}
EOSQLExpression sql = ERXEOAccessUtilities.sqlExpressionForFetchSpecification(ec, clonedFetchSpec, start, end);
NSDictionary<String, EOSQLExpression> hints = new NSDictionary<String, EOSQLExpression>(sql, EODatabaseContext.CustomQueryExpressionHintKey);
clonedFetchSpec.setHints(hints);
return ec.objectsWithFetchSpecification(clonedFetchSpec);
}