Python sqlite3.InterfaceError() Examples
The following are 30
code examples of sqlite3.InterfaceError().
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: main0.py From PGO-mapscan-opt with GNU General Public License v3.0 | 6 votes |
def do_full_login(account): lock_network.acquire() time.sleep(locktime) lock_network.release() if account['type'] == 'ptc': login_ptc(account) elif account['type'] == 'google': login_google(account) new_session(account) else: lprint('[{}] Error: Login type should be either ptc or google.'.format(account['num'])) sys.exit() cursor_accs = db_accs.cursor() while True: try: cursor_accs.execute("INSERT OR REPLACE INTO accounts VALUES(?,?,?,?,?,?,?)", [account['user'], account['access_token'], account['access_expire_timestamp'], account['api_url'], 0, '0', '0']) db_accs.commit() return except sqlite3.OperationalError as e: lprint('[-] Sqlite operational error: {}, account: {} Retrying...'.format(e, account['user'])) except sqlite3.InterfaceError as e: lprint('[-] Sqlite interface error: {}, account: {} Retrying...'.format(e, account['user']))
Example #2
Source File: regression.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def CheckCursorRegistration(self): """ Verifies that subclassed cursor classes are correctly registered with the connection object, too. (fetch-across-rollback problem) """ class Connection(sqlite.Connection): def cursor(self): return Cursor(self) class Cursor(sqlite.Cursor): def __init__(self, con): sqlite.Cursor.__init__(self, con) con = Connection(":memory:") cur = con.cursor() cur.execute("create table foo(x)") cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() with self.assertRaises(sqlite.InterfaceError): cur.fetchall()
Example #3
Source File: transactions.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError as e: pass except: self.fail("InterfaceError should have been raised")
Example #4
Source File: regression.py From odoo13-x64 with GNU General Public License v3.0 | 6 votes |
def CheckCursorRegistration(self): """ Verifies that subclassed cursor classes are correctly registered with the connection object, too. (fetch-across-rollback problem) """ class Connection(sqlite.Connection): def cursor(self): return Cursor(self) class Cursor(sqlite.Cursor): def __init__(self, con): sqlite.Cursor.__init__(self, con) con = Connection(":memory:") cur = con.cursor() cur.execute("create table foo(x)") cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() with self.assertRaises(sqlite.InterfaceError): cur.fetchall()
Example #5
Source File: regression.py From Imogen with MIT License | 6 votes |
def CheckCursorRegistration(self): """ Verifies that subclassed cursor classes are correctly registered with the connection object, too. (fetch-across-rollback problem) """ class Connection(sqlite.Connection): def cursor(self): return Cursor(self) class Cursor(sqlite.Cursor): def __init__(self, con): sqlite.Cursor.__init__(self, con) con = Connection(":memory:") cur = con.cursor() cur.execute("create table foo(x)") cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() with self.assertRaises(sqlite.InterfaceError): cur.fetchall()
Example #6
Source File: transactions.py From oss-ftp with MIT License | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError, e: pass
Example #7
Source File: transactions.py From ironpython3 with Apache License 2.0 | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError as e: pass except: self.fail("InterfaceError should have been raised")
Example #8
Source File: transactions.py From BinderFilter with MIT License | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError, e: pass
Example #9
Source File: transactions.py From vsphere-storage-for-docker with Apache License 2.0 | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError, e: pass
Example #10
Source File: test_database.py From lbry-sdk with MIT License | 6 votes |
def test_binding_param_0_error(self): # test real param 0 binding errors for supported_type in [str, int, bytes]: await self.loop.run_in_executor( self.executor, self.db.executemany, "insert into test2 values (?, NULL)", [(supported_type(1), ), (supported_type(2), )] ) await self.loop.run_in_executor( self.executor, self.db.execute, "delete from test2 where id in (1, 2)" ) for unsupported_type in [lambda x: (x, ), lambda x: [x], lambda x: {x}]: try: await self.loop.run_in_executor( self.executor, self.db.executemany, "insert into test2 (id, val) values (?, NULL)", [(unsupported_type(1), ), (unsupported_type(2), )] ) self.assertTrue(False) except sqlite3.InterfaceError as err: self.assertEqual(str(err), "Error binding parameter 0 - probably unsupported type.")
Example #11
Source File: transactions.py From ironpython2 with Apache License 2.0 | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError, e: pass
Example #12
Source File: transactions.py From datafari with Apache License 2.0 | 6 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() try: cur.fetchall() self.fail("InterfaceError should have been raised") except sqlite.InterfaceError, e: pass
Example #13
Source File: regression.py From android_universal with MIT License | 6 votes |
def CheckCursorRegistration(self): """ Verifies that subclassed cursor classes are correctly registered with the connection object, too. (fetch-across-rollback problem) """ class Connection(sqlite.Connection): def cursor(self): return Cursor(self) class Cursor(sqlite.Cursor): def __init__(self, con): sqlite.Cursor.__init__(self, con) con = Connection(":memory:") cur = con.cursor() cur.execute("create table foo(x)") cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() with self.assertRaises(sqlite.InterfaceError): cur.fetchall()
Example #14
Source File: userfunction_tests.py From conary with Apache License 2.0 | 5 votes |
def tearDown(self): try: self.cnx.close() self.removefile() except AttributeError: pass except sqlite.InterfaceError: pass
Example #15
Source File: type_tests.py From conary with Apache License 2.0 | 5 votes |
def tearDown(self): try: self.cnx.close() self.removefile() except AttributeError: pass except sqlite.InterfaceError: pass
Example #16
Source File: types.py From android_universal with MIT License | 5 votes |
def CheckUnsupportedSeq(self): class Bar: pass val = Bar() with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (?)", (val,))
Example #17
Source File: type_tests.py From conary with Apache License 2.0 | 5 votes |
def tearDown(self): try: self.cnx.close() self.removefile() except AttributeError: pass except sqlite.InterfaceError: pass
Example #18
Source File: type_tests.py From conary with Apache License 2.0 | 5 votes |
def tearDown(self): try: self.cnx.close() self.removefile() except AttributeError: pass except sqlite.InterfaceError: pass
Example #19
Source File: dbapi.py From android_universal with MIT License | 5 votes |
def CheckExceptions(self): # Optional DB-API extension. self.assertEqual(self.cx.Warning, sqlite.Warning) self.assertEqual(self.cx.Error, sqlite.Error) self.assertEqual(self.cx.InterfaceError, sqlite.InterfaceError) self.assertEqual(self.cx.DatabaseError, sqlite.DatabaseError) self.assertEqual(self.cx.DataError, sqlite.DataError) self.assertEqual(self.cx.OperationalError, sqlite.OperationalError) self.assertEqual(self.cx.IntegrityError, sqlite.IntegrityError) self.assertEqual(self.cx.InternalError, sqlite.InternalError) self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError) self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)
Example #20
Source File: transactions.py From android_universal with MIT License | 5 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() with self.assertRaises(sqlite.InterfaceError): cur.fetchall()
Example #21
Source File: types.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def CheckUnsupportedSeq(self): class Bar: pass val = Bar() with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (?)", (val,))
Example #22
Source File: dbapi.py From datafari with Apache License 2.0 | 5 votes |
def CheckExceptions(self): # Optional DB-API extension. self.assertEqual(self.cx.Warning, sqlite.Warning) self.assertEqual(self.cx.Error, sqlite.Error) self.assertEqual(self.cx.InterfaceError, sqlite.InterfaceError) self.assertEqual(self.cx.DatabaseError, sqlite.DatabaseError) self.assertEqual(self.cx.DataError, sqlite.DataError) self.assertEqual(self.cx.OperationalError, sqlite.OperationalError) self.assertEqual(self.cx.IntegrityError, sqlite.IntegrityError) self.assertEqual(self.cx.InternalError, sqlite.InternalError) self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError) self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)
Example #23
Source File: dbapi.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def CheckExceptions(self): # Optional DB-API extension. self.assertEqual(self.cx.Warning, sqlite.Warning) self.assertEqual(self.cx.Error, sqlite.Error) self.assertEqual(self.cx.InterfaceError, sqlite.InterfaceError) self.assertEqual(self.cx.DatabaseError, sqlite.DatabaseError) self.assertEqual(self.cx.DataError, sqlite.DataError) self.assertEqual(self.cx.OperationalError, sqlite.OperationalError) self.assertEqual(self.cx.IntegrityError, sqlite.IntegrityError) self.assertEqual(self.cx.InternalError, sqlite.InternalError) self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError) self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)
Example #24
Source File: dbapi.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def CheckInterfaceError(self): self.assertTrue(issubclass(sqlite.InterfaceError, sqlite.Error), "InterfaceError is not a subclass of Error")
Example #25
Source File: transactions.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def CheckRollbackCursorConsistency(self): """ Checks if cursors on the connection are set into a "reset" state when a rollback is done on the connection. """ con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(x)") cur.execute("insert into test(x) values (5)") cur.execute("select 1 union select 2 union select 3") con.rollback() with self.assertRaises(sqlite.InterfaceError): cur.fetchall()
Example #26
Source File: main0.py From PGO-mapscan-opt with GNU General Public License v3.0 | 5 votes |
def set_api_endpoint(location, account): account['auth_ticket'] = None get_profile(53, location, account) cursor_accs = db_accs.cursor() while True: try: cursor_accs.execute("INSERT OR REPLACE INTO accounts VALUES(?,?,?,?,?,?,?)", [account['user'], account['access_token'], account['access_expire_timestamp'], account['api_url'], account['auth_ticket']['expire_timestamp_ms'], account['auth_ticket']['start'], account['auth_ticket']['end']]) db_accs.commit() return except sqlite3.OperationalError as e: lprint('[-] Sqlite operational error: {}, account: {} Retrying...'.format(e, account['user'])) except sqlite3.InterfaceError as e: lprint('[-] Sqlite interface error: {}, account: {} Retrying...'.format(e, account['user']))
Example #27
Source File: main0.py From PGO-mapscan-opt with GNU General Public License v3.0 | 5 votes |
def do_login(account): lprint('[{}] Login for {} account: {}'.format(account['num'], account['type'], account['user'])) timenow = get_time() cursor_accs = db_accs.cursor() db_repeat = True while db_repeat: try: acc_saved = cursor_accs.execute("SELECT access_token,access_expire_timestamp,api_url,auth_ticket__expire_timestamp_ms,auth_ticket__start,auth_ticket__end from accounts WHERE user = ?",[account['user']]).fetchone() db_repeat = False except sqlite3.OperationalError as e: lprint('[-] Sqlite operational error: {}, account: {} Retrying...'.format(e, account['user'])) except sqlite3.InterfaceError as e: lprint('[-] Sqlite interface error: {}, account: {} Retrying...'.format(e, account['user'])) if acc_saved is not None and timenow < acc_saved[1]: new_session(account) account['access_expire_timestamp'] = acc_saved[1] account['access_token'] = acc_saved[0] lprint('[{}] Reused RPC Session Token: {}'.format(account['num'], account['access_token'])) else: do_full_login(account) lprint('[{}] New RPC Session Token: {}'.format(account['num'], account['access_token'])) acc_saved = None location = LAT_C, LNG_C if acc_saved is not None and timenow < acc_saved[3]: account['api_url'] = acc_saved[2] account['auth_ticket'] = {'expire_timestamp_ms': acc_saved[3], 'start': acc_saved[4], 'end': acc_saved[5]} lprint('[{}] Reused API endpoint: {}'.format(account['num'], account['api_url'])) else: set_api_endpoint(location, account) lprint('[{}] New API endpoint: {}'.format(account['num'], account['api_url'])) if acc_tos: accept_tos(location, account) account['captcha_needed'] = False
Example #28
Source File: types.py From datafari with Apache License 2.0 | 5 votes |
def CheckUnsupportedSeq(self): class Bar: pass val = Bar() try: self.cur.execute("insert into test(f) values (?)", (val,)) self.fail("should have raised an InterfaceError") except sqlite.InterfaceError: pass except: self.fail("should have raised an InterfaceError")
Example #29
Source File: regression.py From datafari with Apache License 2.0 | 5 votes |
def CheckCursorRegistration(self): """ Verifies that subclassed cursor classes are correctly registered with the connection object, too. (fetch-across-rollback problem) """ class Connection(sqlite.Connection): def cursor(self): return Cursor(self) class Cursor(sqlite.Cursor): def __init__(self, con): sqlite.Cursor.__init__(self, con) con = Connection(":memory:") cur = con.cursor() cur.execute("create table foo(x)") cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() try: cur.fetchall() self.fail("should have raised InterfaceError") except sqlite.InterfaceError: pass except: self.fail("should have raised InterfaceError")
Example #30
Source File: types.py From ironpython3 with Apache License 2.0 | 5 votes |
def CheckUnsupportedSeq(self): class Bar: pass val = Bar() try: self.cur.execute("insert into test(f) values (?)", (val,)) self.fail("should have raised an InterfaceError") except sqlite.InterfaceError: pass except: self.fail("should have raised an InterfaceError")