'SQL query based upon unknown variables

I want to filter my data based on applied filters across multiples pages that have different filters.

I receive a query object from my url. Something like this :

query : { {filterProperty1 : someValue1}, {filterProperty2, someValue2} }

My filters properties and the values associated with are dynamics. I can't hardcod in my script certains values.

Consequently I have to retrieve the data of my database based upon these dynamic filter properties and values.

My difficulty is that I can't say "go to the Table that contains this filter properties to find if there is a value corresponding to the value of the filter property that I receive from my query object", because I have currently no way of knowing the value of this filter properties without the possibility of hardcoding anything in my script and add conditions based on it.

In a NoSQL database it would be easy because I could centralize all my data at the same place so I wouldn't need to know the value of my filter properties to know where to search. Everything that I need would be at the same place.

But in a SQL database I have no clue how to achieve the same result since I have to know where to search based on data that could have a indefinity of values that I can't hardcode and consequently conditionnaly test inside the script of my app.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source