當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。