Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Prepared query not accepting || instruction at execution

by pfaut (Priest)
on Dec 28, 2002 at 16:00 UTC ( [id://222741]=note: print w/replies, xml ) Need Help??


in reply to Prepared query not accepting || instruction at execution

Using placeholders, mysql is going to compare the field to the text provided for the placeholder. In your case, "('Y' || 'N')". Have you any rows in that table with that text in the workrelated field?

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Re: Re: Prepared query not accepting || instruction at execution
by jpfarmer (Pilgrim) on Dec 28, 2002 at 16:02 UTC
    No, just 'Y' or 'N'. I'm trying to select fields that match either 'Y' or 'N'.

      In that case you will need two placeholders: one for the 'Y' and one for the 'N'.

      Using placehodlers will do all the quoting internally for you. This means that your filterstring will be quoted in such a way that it is no longer a boolean operation but a single string to be matched against. Hence, the empty recordset as a result.

      If for reasons internally to the logic of your program, you need the filterstring to be modifiable (e.g. sometimes 'OR' or 'AND' or more or less arguments, ...) then the only solution is to put the SQL string together yourself and not rely on placeholders.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://222741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-19 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found