Angus March wrote:
> I'm trying to make a prepared statement and bind parameters to it, but
> the documentation is very confusing. This is the statement I'm trying to
> prepare:
> UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE "ItemID"=?NNN
> Where IVAndKey is a BLOB and ItemID is an INTEGER and the primary key
> for the table. I'm told that there is a syntax error near "NNN".
>   

The page (http://sqlite.org/c3ref/bind_blob.html) reads:

"In the SQL strings input to sqlite3_prepare_v2() and its variants, 
literals may be replaced by a parameter in one of these forms:

    * ?
    * ?NNN
    * :VVV
    * @VVV
    * $VVV "

The documentation for NNN is three sentences below this and states that 
the NNN refers to a number such as:

?1 ?2

I'm also unsure why you've added single and double quotes.  Maybe:

UPDATE KEYS SET IVAndKey=? WHERE ItemID = ?

and then use the positional bindings

sqlite3_bind_int(m_insert, 2, idItem);
sqlite3_bind_blob(m_insert, 1, p, DATA_KEY_RECORD_LENGTH, FreeBlob);

Assuming m_insert is your statement.

HTH

John Elrick
Fenestra Technologies

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to