On Jan 10, 2012, at 5:02 PM, Darren Duncan wrote:
> Steven Michalske wrote:
>> On Tue, Jan 10, 2012 at 3:19 PM, Darren Duncan <[email protected]>
>> wrote:
>>> Steven Michalske wrote:
>>>> I would like to use the :nnn named parameters but have spaces in the
>>>> named parameters.
>>>>
>>>> It seems that ":nnn nnn", :"nn nn", or :nn\ nn are all not recognized.
>>>>
>>>> Is there a way to use spaces in named parameters?
>>>
>>> I would expect :<identifier> to be the correct format for a named parameter,
>>> meaning :foo or :"bar" as the case may be. So, you should be able to write
>>>
>>> :"nn nn"
>>>
>>> ... and if you can't, then the DBMS should be fixed so that you can do that.
>>> The other 2 options you gave should not be supported.
>> The python sqlite driver calls functions for parameter substitution
>> from the sqlite3 c library. There is no manipulation of the string
>> before it is passed into the sqlite parser.
>> I could not find documentation on the requirements for the :nnn form
>> of parameter substitution. Perhaps a bug is in order to improve the
>> documentation. Perhaps include a regex of the acceptable
>> identifiers.
>> Unfortunately the format :"foo bar" is not accepted as a parameter by
>> sqlite3.
>
> Just to be clear, the :"foo bar" is what you write in the SQL having the
> parameter, for example, 'select * from abc where def = :"foo bar"'. And then
> in the SQLite parameter binding call you just use 'foo bar' (because that is
> the actual parameter name) as the parameter name argument. -- Darren Duncan
The following would be a psudo code
c.execute('''insert col into the_table values(:"foo bar", :param2)''', {"foo
bar":"value_to_insert", "param2":3.4})
This is what would not work.
Steve
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users