当前位置: 首页>>代码示例>>Python>>正文


Python constants.CURSOR属性代码示例

本文整理汇总了Python中django.db.models.sql.constants.CURSOR属性的典型用法代码示例。如果您正苦于以下问题:Python constants.CURSOR属性的具体用法?Python constants.CURSOR怎么用?Python constants.CURSOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在django.db.models.sql.constants的用法示例。


在下文中一共展示了constants.CURSOR属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def update(self, **kwargs):
        """
        Update all elements in the current QuerySet, setting all the given
        fields to the appropriate values.
        """
        assert self.query.can_filter(), \
            "Cannot update a query once a slice has been taken."
        self._for_write = True
        query = self.query.chain(sql.UpdateQuery)
        query.add_update_values(kwargs)
        # Clear any annotations so that they won't be present in subqueries.
        query._annotations = None
        with transaction.atomic(using=self.db, savepoint=False):
            rows = query.get_compiler(self.db).execute_sql(CURSOR)
        self._result_cache = None
        return rows 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:18,代码来源:query.py

示例2: update

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def update(self, **kwargs):
        """
        Updates all elements in the current QuerySet, setting all the given
        fields to the appropriate values.
        """
        assert self.query.can_filter(), \
            "Cannot update a query once a slice has been taken."
        self._for_write = True
        query = self.query.clone(sql.UpdateQuery)
        query.add_update_values(kwargs)
        # Clear any annotations so that they won't be present in subqueries.
        query._annotations = None
        with transaction.atomic(using=self.db, savepoint=False):
            rows = query.get_compiler(self.db).execute_sql(CURSOR)
        self._result_cache = None
        return rows 
开发者ID:Yeah-Kun,项目名称:python,代码行数:18,代码来源:query.py

示例3: update

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def update(self, **kwargs):
        """
        Updates all elements in the current QuerySet, setting all the given
        fields to the appropriate values.
        """
        assert self.query.can_filter(), \
            "Cannot update a query once a slice has been taken."
        self._for_write = True
        query = self.query.clone(sql.UpdateQuery)
        query.add_update_values(kwargs)
        with transaction.atomic(using=self.db, savepoint=False):
            rows = query.get_compiler(self.db).execute_sql(CURSOR)
        self._result_cache = None
        return rows 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:16,代码来源:query.py

示例4: _update

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def _update(self, values):
        """
        A version of update that accepts field objects instead of field names.
        Used primarily for model saving and not intended for use by general
        code (it requires too much poking around at model internals to be
        useful at that level).
        """
        assert self.query.can_filter(), \
            "Cannot update a query once a slice has been taken."
        query = self.query.clone(sql.UpdateQuery)
        query.add_update_fields(values)
        self._result_cache = None
        return query.get_compiler(self.db).execute_sql(CURSOR) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:15,代码来源:query.py

示例5: _update

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def _update(self, values):
        """
        A version of update() that accepts field objects instead of field names.
        Used primarily for model saving and not intended for use by general
        code (it requires too much poking around at model internals to be
        useful at that level).
        """
        assert self.query.can_filter(), \
            "Cannot update a query once a slice has been taken."
        query = self.query.chain(sql.UpdateQuery)
        query.add_update_fields(values)
        self._result_cache = None
        return query.get_compiler(self.db).execute_sql(CURSOR) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:15,代码来源:query.py

示例6: _update

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def _update(self, values):
        """
        A version of update() that accepts field objects instead of field names.
        Used primarily for model saving and not intended for use by general
        code (it requires too much poking around at model internals to be
        useful at that level).
        """
        assert self.query.can_filter(), \
            "Cannot update a query once a slice has been taken."
        query = self.query.chain(sql.UpdateQuery)
        query.add_update_fields(values)
        # Clear any annotations so that they won't be present in subqueries.
        query._annotations = None
        self._result_cache = None
        return query.get_compiler(self.db).execute_sql(CURSOR) 
开发者ID:PacktPublishing,项目名称:Hands-On-Application-Development-with-PyCharm,代码行数:17,代码来源:query.py

示例7: test_query_encoding

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def test_query_encoding(self):
        """
        last_executed_query() returns an Unicode string
        """
        data = RawData.objects.filter(raw_data=b'\x00\x46  \xFE').extra(select={'föö': 1})
        sql, params = data.query.sql_with_params()
        cursor = data.query.get_compiler('default').execute_sql(CURSOR)
        last_sql = cursor.db.ops.last_executed_query(cursor, sql, params)
        self.assertIsInstance(last_sql, six.text_type) 
开发者ID:denisenkom,项目名称:django-sqlserver,代码行数:11,代码来源:tests.py

示例8: test_query_encoding

# 需要导入模块: from django.db.models.sql import constants [as 别名]
# 或者: from django.db.models.sql.constants import CURSOR [as 别名]
def test_query_encoding(self):
        """last_executed_query() returns a string."""
        data = RawData.objects.filter(raw_data=b'\x00\x46  \xFE').extra(select={'föö': 1})
        sql, params = data.query.sql_with_params()
        cursor = data.query.get_compiler('default').execute_sql(CURSOR)
        last_sql = cursor.db.ops.last_executed_query(cursor, sql, params)
        self.assertIsInstance(last_sql, str) 
开发者ID:nesdis,项目名称:djongo,代码行数:9,代码来源:tests.py


注:本文中的django.db.models.sql.constants.CURSOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。