Jonas Sandman <[EMAIL PROTECTED]>
wrote:
I have created a database like this:

CREATE TABLE Data (path VARCHAR(512) PRIMARY KEY, title VARCHAR(512),
artist VARCHAR(512), album VARCHAR(512), length INTEGER, genre
VARCHAR(512), comment VARCHAR(512), track INTEGER, year INTEGER,
bitrate INTEGER, playcount INTEGER, changed INTEGER, size INTEGER,
tagged INTEGER);

and then I want to select only certain elements from it. I've made
this select:

SELECT * FROM Data WHERE Data.title LIKE (SELECT '%%' || ? || '%') OR

You have two percent signs '%%' here, while I'd expect a single one. Is it intentional?

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?

? || '%');"

You don't have '%' in front here, while elsewhere you do. Is it intentional?

which I feed sqlite3_prepare16

then I bind a query to the first five texts and then the path (it's a
mp3-library) to the sixth ?

I still always retrieve ALL data in the database if query is empty.

What do you mean by "query is empty"? That you bind empty strings to all parameters?

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.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to