First poted on reddit, can't link here.
In a database I have, various field. The fields contain search criteria for that respective field e.g.
FOO
FOO|BAR|BAZ
*TEST*|*BLUE*
The | character here means 'or' in SQL. So if the column here was called PROD_TITLE, the SQL where clause for above would be:
where PROD_TITLE = 'FOO'
where PROD_TITLE in ('FOO','BAR','BAZ')
where PROD_TITLE like '*TEST* or PROD_TITLE like '*BLUE'
To complicate things further I have a specific column for free search data, containing key/value pairs (like URL params):
&BAZ=TEST
&BAZ=*TEST*
&ORDERDATE=20200101:2020130
&BAZ=TEST*&ORDERDATE=20200101:2020130
I looked at SQL::Abstract::FromQuery but I don't have this data as a URL param. Is there a clever perl way I can use either SQL::Abstract or SQL::Abstract form to generate a SQL query catering for all where clauses?