How to find rows matched by either whole string or with wildcard star character
The reason is we have, for instance, db table with text column like 'name' and we have to find rows that matches one from set and the set may contain strings with wildcard token '*' at the end. Yes, you know, we can change wildcard patterns to db standard wildcards: '%' or' _', but what if we need to find also strings with those symbols too?
In unix/linux terminal you often write commands like 'find name_of_file*' to find all files matches pattern with wildcard. In frontend we want to let our backend support something similar without db/sql specific like constructions. It is secure do not let frontend/client app to control LIKE pattern straightly.
In this case we need to escape special sql wildcard characters for LIKE command with ESCAPE addition, so we need to write: LIKE 'string#_of#_text#_cr#%zy' ESCAPE '#'
Also, we have not just one string - we have set of strings. And we need in addition to LIKE operator add also simple set matching: in('string1', 'string2'...) for whole string matching.
So our nodejs code will be like: