John Elrick wrote:
> Angus March wrote:
>   
>> John Elrick wrote:
>>   
>>     
>>> 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 don't see that anywhere on the page. An example might have made a
>> difference.
>>   
>>     
>
> "The second argument is the index of the SQL parameter to be set. The 
> leftmost SQL parameter has an index of 1. When the same named SQL 
> parameter is used more than once, second and subsequent occurrences have 
> the same index as the first occurrence. The index for named parameters 
> can be looked up using the sqlite3_bind_parameter_index() API if 
> desired. The index for "?NNN" parameters is the value of NNN. The NNN 
> value must be between 1 and the sqlite3_limit() parameter 
> SQLITE_LIMIT_VARIABLE_NUMBER (default value: 999)."
>   
    I read that, and it didn't make any sense to me. At that point, I
knew I'd be turning to the mailing-list sooner or later.
>
> Although quotes can be used, they are not needed when the table and 
> field names contain all valid characters.   I simply saw no value in 
> adding them, and they did seem to unnecessarily complicate the text.
>   
    It also says on http://www.sqlite.org/lang_keywords.html that in
case you use a name that one day becomes a keyword you should always use
quotes.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to