If your script is for general consumption, I hope you're using -T and are untainting $SQLCommand. Otherwise, someone can slip something truly evil into your SQL stream.
I recommend that you use bind variables in the query, like
Then, when you execute the prepared query, you can wrap the variables. You'll need some logic to do it, so that you don't end up with '%%' if the variable is "". I do something like$SQLCommand = <<SQL; SELECT Client, Product, License, Issue, Data, Id, Call FROM support WHERE Client LIKE ? AND Product LIKE ? AND Issue LIKE ? AND Cause LIKE ? AND Call LIKE ? AND SupportDetails LIKE ? SQL
I'll leave like_arg() as an exercise.$sth->execute(like_arg(1, $Client, 1), ... etc ... );
In reply to Re: Passing data from one perl script to another.
by dws
in thread Problem constructing an SQL query with LIKE clauses
by sdyates
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |