Today, I made some improvement to ActiveSalesforce Gem. The following method needs to be modified.
def extract_sql_modifier(soql, modifier)
value = soql.match(/\s+#{modifier}\s+(\d+)/mi)
if value
value = value[1].to_i
if !(modifier.upcase == "LIMIT")
# If it is not the keyword - LIMIT, remove it from the SOQL
soql.sub!(/\s+#{modifier}\s+\d+/mi, "")
else
# If it is the keyword - LIMIT, do not remove it from the SOQL
end
# SOQL now supports LIMIT clause. If the user is not an app admin &
# queries Newsfeed or EntitySubscription & without q limit (e.g. > 1000),
# it would cause MQL_FORMED_QUERY exception:
# However, OFFSET is still not supported by SOQL.
# ***NOTE: needs to change it in the gem to make it effective.
end
value
end
Because SOQL now supports the LIMIT clause and enforces it for non admin-users who tries to query the Newsfeed or EntitySubscription objects. (limit > 1000 will cause error), there it is added to preserve LIMIT and remove OFFSET clauses.
