On 1 April 2012 21:23, ap <a...@solarrain.com> wrote:
>
> http://sqlite.org/c3ref/bind_blob.html
>
> Brackets are recommended for attribute names in some cases, it seems the
> binding for :VVV does not permit :[VVV]. Is this the case?

Square brackets are a quoting mechanism for identifiers supported for
compatibility with MS Access and SQL Server.
(http://www.sqlite.org/lang_keywords.html)

>
> I prefer the dictionary binding if possible. Normally no issues, however
> when I introduce brackets there may be an issue. Is this the appropriate
> syntax?  ([c1],[c2]) VALUES ( :[c1], :[c2] )

I don't think so. The column names are c1 and c2 - the square brackets
are a quoting mechanism, not part of the name.
Try  ([c1],[c2]) VALUES ( :c1, :c2 )

>
>>>> recdct
> {'[c1]': 1, '[c2]': 2}
>
>>>> cur.execute("""INSERT INTO merge ([c1],[c2]) VALUES ( :[c1], :[c2]
>>>> )""",recdct)
> Traceback (most recent call last):
>  File "<pyshell#91>", line 1, in <module>
>    cur.execute("""INSERT INTO merge ([c1],[c2]) VALUES ( :[c1], :
> [c2] )""",recdct)
> OperationalError: unrecognized token: ":"
>>>>
>

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

Reply via email to