Django Book 翻译
菜单>:
TOC
返回
原文:
Unfortunately, you cant use bind parameters everywhere in SQL; theyre not allowed as identifiers (i.e., table or column names). Thus, if you need to, say, dynamically construct a list of tables from a ``POST`` variable, youll need to escape that name in your code. Django provides a function, ``django.db.backend.quote_name`` , which will escape the identifier according to the current databases quoting scheme.
翻译:
不幸的是,您并不是在SQL中能够处处都使用绑定参数,绑定参数不能够作为标识符(如表或列名等)。因此,如果您需要这样做--我是说--动态构建 ``POST`` 变量中的数据库表的列表的话,您需要在您的代码中来对这些数据库表的名字进行转义。Django提供了一个函数, ``django.db.backend.quote_name`` ,这个函数能够根据当前数据库引用结构对这些标识符进行转义。
备注:
译者: