Python sqlite3.PrepareProtocol() Examples

The following are 24 code examples of sqlite3.PrepareProtocol(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlite3 , or try the search function .
Example #1
Source File: types.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #2
Source File: types.py    From android_universal with MIT License 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #3
Source File: types.py    From android_universal with MIT License 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #4
Source File: types.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #5
Source File: types.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #6
Source File: extensions.py    From pyrqlite with MIT License 5 votes vote down vote up
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 
Example #7
Source File: extensions.py    From pyrqlite with MIT License 5 votes vote down vote up
def register_adapter(type_, function):
    adapters[(type_, sqlite3.PrepareProtocol)] = function 
Example #8
Source File: types.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #9
Source File: types.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #10
Source File: types.py    From datafari with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #11
Source File: types.py    From datafari with Apache License 2.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #12
Source File: types.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #13
Source File: types.py    From vsphere-storage-for-docker with Apache License 2.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #14
Source File: types.py    From Imogen with MIT License 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #15
Source File: types.py    From Imogen with MIT License 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #16
Source File: types.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #17
Source File: types.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #18
Source File: types.py    From oss-ftp with MIT License 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #19
Source File: types.py    From oss-ftp with MIT License 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #20
Source File: types.py    From BinderFilter with MIT License 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #21
Source File: types.py    From BinderFilter with MIT License 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #22
Source File: types.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close() 
Example #23
Source File: types.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def __conform__(self, protocol):
            if protocol is sqlite.PrepareProtocol:
                return self.val
            else:
                return None 
Example #24
Source File: types.py    From vsphere-storage-for-docker with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        del sqlite.adapters[(int, sqlite.PrepareProtocol)]
        self.cur.close()
        self.con.close()