当前位置: 首页>>代码示例>>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;未经允许,请勿转载。