FIX: limit maximum number of CSV rows correctly.

bbea8884db
This commit is contained in:
Vinoth Kannan 2020-02-24 10:53:48 +05:30
parent bbea8884db
commit 96a8d1862e
1 changed files with 9 additions and 3 deletions

View File

@ -1180,10 +1180,16 @@ SQL
opts[:explain] = true if params[:explain] == "true" opts[:explain] = true if params[:explain] == "true"
opts[:limit] = opts[:limit] =
if params[:limit] if params[:format] == "csv"
if params[:limit].present?
limit = params[:limit].to_i
limit = DataExplorer::QUERY_RESULT_MAX_LIMIT if limit > DataExplorer::QUERY_RESULT_MAX_LIMIT
limit
else
DataExplorer::QUERY_RESULT_MAX_LIMIT
end
elsif params[:limit].present?
params[:limit] == "ALL" ? "ALL" : params[:limit].to_i params[:limit] == "ALL" ? "ALL" : params[:limit].to_i
elsif params[:format] == "csv"
DataExplorer::QUERY_RESULT_MAX_LIMIT
end end
result = DataExplorer.run_query(query, query_params, opts) result = DataExplorer.run_query(query, query_params, opts)