Skip to content

Commit

Permalink
fix for limit
Browse files Browse the repository at this point in the history
  • Loading branch information
moovida committed Dec 22, 2023
1 parent 98ea123 commit 64ae05a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,11 @@ public QueryResult getTableRecordsMapFromRawSql( String sql, int limit ) throws
IGeometryParser gp = getType().getGeometryParser();
return execOnConnection(connection -> {
QueryResult queryResult = new QueryResult();
String _sql = sql;
String _sql = sql.trim();
if(_sql.endsWith(";")) {
int index = _sql.lastIndexOf(';');
_sql = _sql.substring(0, index);
}
String lowerSql = _sql.trim().toLowerCase();
if (limit > 0 && lowerSql.startsWith("select") && !lowerSql.contains("limit")) {
_sql = _sql + " limit " + limit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
*/
package org.hortonmachine.hmachine.models.hm;

import java.util.HashMap;
import org.hortonmachine.gears.utils.RegionMap;
import org.geotools.coverage.grid.GridCoverage2D;
import org.hortonmachine.gears.utils.PrintUtilities;
import org.hortonmachine.gears.utils.RegionMap;
import org.hortonmachine.gears.utils.coverage.CoverageUtilities;
import org.hortonmachine.hmachine.modules.geomorphology.tca.OmsTca;
import org.hortonmachine.hmachine.utils.HMTestCase;
Expand Down

0 comments on commit 64ae05a

Please sign in to comment.