當前位置: 首頁>>代碼示例>>Python>>正文


Python sqlite3.PrepareProtocol方法代碼示例

本文整理匯總了Python中sqlite3.PrepareProtocol方法的典型用法代碼示例。如果您正苦於以下問題:Python sqlite3.PrepareProtocol方法的具體用法?Python sqlite3.PrepareProtocol怎麽用?Python sqlite3.PrepareProtocol使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sqlite3的用法示例。


在下文中一共展示了sqlite3.PrepareProtocol方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __conform__

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import PrepareProtocol [as 別名]
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
開發者ID:vmware-archive,項目名稱:vsphere-storage-for-docker,代碼行數:7,代碼來源:types.py

示例2: tearDown

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import PrepareProtocol [as 別名]
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
開發者ID:vmware-archive,項目名稱:vsphere-storage-for-docker,代碼行數:6,代碼來源:types.py

示例3: register_adapter

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import PrepareProtocol [as 別名]
def register_adapter(type_, function):
    adapters[(type_, sqlite3.PrepareProtocol)] = function 
開發者ID:rqlite,項目名稱:pyrqlite,代碼行數:4,代碼來源:extensions.py

示例4: _adapt_from_python

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import PrepareProtocol [as 別名]
def _adapt_from_python(value):
    if not isinstance(value, basestring):
        adapter_key = (type(value), sqlite3.PrepareProtocol)
        adapter = adapters.get(adapter_key)
        try:
            if adapter is None:
                # Fall back to _default_adapters, so that ObjectAdaptationTests
                # teardown will correctly restore the default state.
                adapter = _default_adapters[adapter_key]
        except KeyError as e:
            # No adapter registered. Let the object adapt itself via PEP-246.
            # It has been rejected by the BDFL, but is still implemented
            # on stdlib sqlite3 module even on Python 3 !!
            if hasattr(value, '__adapt__'):
                adapted = value.__adapt__(sqlite3.PrepareProtocol)
            elif hasattr(value, '__conform__'):
                adapted = value.__conform__(sqlite3.PrepareProtocol)
            else:
                raise InterfaceError(e)
        else:
            adapted = adapter(value)
    else:
        adapted = value

    # The adapter could had returned a string
    if isinstance(adapted, (bytes, unicode)):
        adapted = _escape_string(adapted)
    elif adapted is None:
        adapted = 'NULL'
    else:
        adapted = str(adapted)

    return adapted 
開發者ID:rqlite,項目名稱:pyrqlite,代碼行數:35,代碼來源:extensions.py


注:本文中的sqlite3.PrepareProtocol方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。