#define SELECT_STATEMENT_TEXTSORT L"SELECT * FROM Data WHERE
(Data.titleLIKE (SELECT '%%' || ? || '%') OR
Data.artist LIKE (SELECT '%' || ? || '%') OR Data.album LIKE (SELECT '%' ||
? || '%') OR Data.genre LIKE (SELECT '%' || ? || '%') OR Data.comment LIKE
(SELECT '%' || ? || '%') OR Data.path LIKE (SELECT '%' || ? '%')) AND
Data.path LIKE (SELECT '%' || ? || '%');"

   ERR = sqlite3_prepare16(m_db, SELECT_STATEMENT_TEXTSORT, -1, &exc,
(const void**)&tail);

   wchar_t* errmsg = (wchar_t*) sqlite3_errmsg16(m_db);

   sqlite3_bind_text16(exc, 1, query, -1, SQLITE_STATIC);
   sqlite3_bind_text16(exc, 2, query, -1, SQLITE_STATIC);
   sqlite3_bind_text16(exc, 3, query, -1, SQLITE_STATIC);
   sqlite3_bind_text16(exc, 4, query, -1, SQLITE_STATIC);
   sqlite3_bind_text16(exc, 5, query, -1, SQLITE_STATIC);
   sqlite3_bind_text16(exc, 6, path, -1, SQLITE_STATIC);

   while ((ERR = sqlite3_step(exc)) == SQLITE_ROW)
   {
    // process data here like:
   // df->SetFileName((wchar_t*)sqlite3_column_text16(exc, 0));
   }


path and query are wchar_t variables.

Jonas

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

Jonas Sandman <[EMAIL PROTECTED]>
wrote:
> 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.
>
>> 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.

Right. A condition on path is mandatory now, whereas before it could be
false but you would still get results. This tells us that there's
something wrong with the value you bind to path parameter.

When you say "C:\MP3\Albums", are you literally hardcoding this string?
If so, are you aware that backslashes should be escaped in C string
literal?

Show the actual code that calls sqlite3_bind_text[16] . There's
something wrong there.

Igor Tandetnik



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

-----------------------------------------------------------------------------


Reply via email to