On 10/30/06, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
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?
I've tried both. I added it since the debugger seemed to drop it in the preview. But I guess it should only be one.
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)
? || '%');" You don't have '%' in front here, while elsewhere you do. Is it intentional?
Yes, the path shouldn't be wild-carded before my search path. C:\MP3\Albums\Madonna should be found. Adding the '%' before the path shouldn't make a difference though? Or does it?
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?
I bind empty strings yes.
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. Igor Tandetnik
----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------
Please ask if something more is incomplete. /Jonas