in reply to DBI Placeholders and REGEXP

There is no support for Perl regular expressions in SQL. You'll need to do an SQL equivalent, e.g. % is the same as .* and ? is the same as .+ IIRC

You'll need to convert your regular expressions to something more SQL-like

Update: Do a search on the "SELECT .. WHERE .. LIKE" statement. Check this SQL Resource or search the mySQL site.

Update2: I am wrong. Check here for info on REGEXP.

$code or die
Using perl at
The Spiders Web

Replies are listed 'Best First'.
Re: Re: DBI Placeholders and REGEXP
by dws (Chancellor) on Feb 15, 2001 at 05:56 UTC
Re: Re: DBI Placeholders and REGEXP
by Masem (Monsignor) on Feb 15, 2001 at 06:27 UTC
    I know for sure that REXEXP works -- I'm using it currently. :) This is with mysql, and the docs say it aims for Posix like functionality, so while I don't expect it to handle some of the re's that pass PM's nodes, something simple like what I have above is doable (I can enter this from the direct db connection).

    LIKE could work, but it requires 'extra' to handle the cases where I may have subset matches: eg, if I'm looking for ABC, and both ABC and ABCD exists, I'll get both. To solve the case where the items are in a ;-delimited list, I'd need 4 LIKE phases.. LIKE "ABC;%", LIKE ";ABC;", LIKE "%;ABC", and LIKE "ABC".

      Please post a code fragment that shows how you're setting up the query. That'll give us more to go on.