Hi,

Yes I showed an example query. The query I used for sqlite3_prepare
is the following:

SELECT * FROM Objects WHERE ObjectID = ?

If I'd put quotes around the question mark, binding would have failed.

Interestingly I've even had some queries fail in the SQLite shell 
yesterday. Others worked. Looking at the EXPLAIN output the primary
key index is used as it should - but somehow fails to locate the row,
even though the where conditions are right and should return one row.

The SQLite shell is the Windows EXE you can download on sqlite.org. I 
compiled sqlite3.lib myself using Visual Studio 2005.

Where does SQLite compare the condition with the index? I'd try to
set a breakpoint and look further. Looking at the EXPLAIN output I 
haven't figured that out yet, but it was late yesterday.

Additionally I'll try to make a simple example program to find this 
bug.

Mike

-----Ursprüngliche Nachricht-----
Von: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 24. September 2006 22:45
An: SQLite
Betreff: [sqlite] Re: Queries fail - I can't figure out why

Michael Ruck <michael.ruck-4ptYESVdgRZ0eaEml/[EMAIL PROTECTED]>
wrote:
> I have the tables of the following style:
>
> CREATE TABLE Objects (ObjectID TEXT PRIMARY KEY, Class TEXT)
>
> And I'm executing the following statement in the sqlite3 shell:
>
> SELECT * FROM Objects WHERE ObjectID = 
> '{08021C17-46DD-4d83-A6FE-DDF0F7EC0AAE}'
>
> In the shell this query succeeds. However if I try to do the same 
> thing via sqlite3_prepare, sqlite3_bind_text16 and sqlite3_step, then 
> sqlite3_step always returns 101 (SQLITE_DONE.)

The query you show does not have any parameters - what are you using
sqlite3_bind_text16 for? You are probably using a different query in your
program - show it.

As a wild guess, does your query look anything like this:

SELECT * FROM Objects WHERE ObjectID = '?'

(with question mark in quotes)? Note that '?' is a string literal consisting
of one question mark character, not a parameter placeholder. 
The correct parameterized query is

SELECT * FROM Objects WHERE ObjectID = ?

Igor Tandetnik 


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



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

Reply via email to