pysqlite: Placeholder substitution for column or table names?

后端 未结 2 1799
遇见更好的自我
遇见更好的自我 2020-11-29 07:25

Using pysqlite I am making a procedure to do something with some data. The same kind of operation is done on similar fields in multiple tables and columns, so I thought I co

2条回答
  •  无人及你
    2020-11-29 08:07

    As @unutbu answered, there is no way to use placeholders for table/column names. My suggestion to do what you are doing now, but to also quote the table names to protect yourself from a table or column that might have an odd name.

    What does the SQL Standard say about usage of backtick(`)? already explains this to some extent, and in spite of the opinion in that answer, I would say that in your case, quoting is a good idea.

提交回复
热议问题