GitHub user hansva added a comment to the discussion: How to get data from a 
database with a constructed query?

This is where you hit the limits of what is possible.
You could indeed compose the query insert it in a Hop variable and use that 
variable to execute the query, but as you have stated this would allow any part 
of the query to be modified. 
Prepared statements on the other hand are a safe way to inject values into a 
query but they can't be used to modify the statement on runtime.

What I have done in the past if the goal is to enable/disable specific filters 
in the where clause is adding a void condition

```
Select * from my_table
where
(field = ? or 1=?)
```

By providing a 0 or 1 in the second position you essentially enable or disable 
that condition


GitHub link: 
https://github.com/apache/hop/discussions/4566#discussioncomment-11256468

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to