(Ignition 8.0.13, SQL Server 2017, default Microsoft SQLServer JDBC Driver)
In my quest for mobile performance, I’m attempting to limit query results on a table when a user is on a mobile device while not impacting desktop users. To that end, I’ve tried to make a named query like the following (where
:isMobile is a boolean param):
SELECT TOP (CASE :isMobile WHEN 1 THEN 250 ELSE 9223372036854775807 END) -- no performance penalty for huge TOP() <my_columns> FROM <my_table>
However, this produces an error:
com.microsoft.sqlserver.jdbc.SQLServerException: The number of rows provided for a TOP or FETCH clauses row count parameter must be an integer.
:isMobile to bool/int/what have you doesn’t help, nor does storing it in a variable.
This query works in the Database Query Browser when I replace
isMobile with a constant, which leads me to believe the named query parameter replacement is what’s not playing nice with the JDBC.
Is there a way around this, or am I just barking up the wrong tree with this solution? Any insight appreciated.