Check if sql query is empty

I want to use dynamic query building specifically if my other query is non-empty.

My code block should determine is a specific value was passed as input (location data). If it wasn't then the query should be run as normal. If it has then I should adjust query where clause using the helper function.

Having problems with when no input is provided because I can't compare my variable to sql.empty() or sql'' template.

Here is the snippet:
if(locationSqlClause != sql.empty()){
            query = withLocations(query, locationSqlClause);
          }
Was this page helpful?