On 10/30/06, Igor Tandetnik <[EMAIL PROTECTED]> wrote:

Jonas Sandman <[EMAIL PROTECTED]>
wrote:
>> Data.artist LIKE (SELECT '%' || ? || '%') OR Data.album LIKE (SELECT
>>> '%' || ? || '%') OR Data.genre LIKE (SELECT '%' || ? || '%') OR
>>> Data.comment LIKE (SELECT '%' || ? || '%') AND Data.path LIKE
>>> (SELECT
>>
>> You have AND here, while elsewhere you have OR. Is it intentional?
>
>
> Yes, path is most important. I am searching for some mp3-files in
> different folders. I am looking for
> C:\MP3\Albums and don't want C:\MP3\Singles to show up in the results
> (they do)

They do? Didn't you say that the moment at least one parameter is a
non-empty string, you get no results? I'm confused.


Yes, but path isn't part of the query. I ask for query = "", path =
"C:\MP3\Albums" and I get all the results in the entire database. If I set
query = "madonna" and same path. I get no results.

Be aware that AND has higher precedence than OR. Your condition is
interpreted as

title like x1 OR
artist like x2 OR
album like x3 OR
genre like x4 OR
(comment like x5 AND path like x6)

which apparently is not the effect you were shooting for. You probably
want

(title like x1 OR artist like x2 OR album like x3 OR genre like x4 OR
comment like x5)
     AND path like x6

Use parentheses to achieve this result.


Okay, that could've been it. But when I put that parenthesis in there, I get
no results ever. No matter of the query.

If I set query to anything, I receive NO results.
>>
>> Show a sample of the data in the table, and a set of parameters you
>> bind.
>
>
> An example is path = "C:\MP3\Madonna\Like a virgin.mp3", the title,
> artist etc are empty or 0.

What do you mean "empty or 0"? Binding integer 0 is not the same thing
as binding an empty string.


I meant 0 as in NULL. But I checked and I add an empty string ("") if I
don't have the appropriate tag.

You do in fact have a row in Data table where Data.path =
'C:\MP3\Madonna\Like a virgin.mp3', right?


Yes, there are a lot of  entries in the database. They did show up before I
added the parenthesis :(

Igor Tandetnik


Jonas

Reply via email to