in reply to Re: Passing data from one perl script to another.
in thread Problem constructing an SQL query with LIKE clauses

Ok, I must be really tired and am not seeing the obvious. I did not think I would need to use placeholders here, but can obviously see the advantage. I was hoping to avoid changing the entire script.

you have $STH->execute (like_arg(....
I tried $sth->execute($Client,$Product,....)
and it failed. I tried looking for like_arg and realise it must be something obvious I cannot grasp. I guess I have been going at this too long... Trying to get this ready for tomorrow. DId not see my bug until end of day and need the functionality. I also thought of adding \ into the string, but realise that would be sloppy and I do not want that.

I am ready for the next tid bit of info if you are willing to forward it
Simon

  • Comment on Re: Re: Passing data from one perl script to another.

Replies are listed 'Best First'.
Re: Re: Re: Passing data from one perl script to another.
by dws (Chancellor) on Apr 17, 2002 at 03:53 UTC
    Mea culpa for being obscure. By "left as an exercise" I meant that like_arg() was a piece that you would need to supply yourself.

    The idea is to form the wildcard string at runtime. It will look something like the following (from memory):

    sub like_arg { my ($prewild, $string, $postwild) = @_; return "%" if $string eq ""; return "%" . $string . "%" if $prewild and $postwild; return "%" . $string if $prewild; return $string . "%" if $postwild; ""; }