mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
PyPy patch for testing module
This commit is contained in:
@@ -33,6 +33,7 @@ class HashDB(object):
|
||||
self.filepath = filepath
|
||||
self._write_cache = {}
|
||||
self._cache_lock = threading.Lock()
|
||||
self._connections = []
|
||||
|
||||
def _get_cursor(self):
|
||||
threadData = getCurrentThreadData()
|
||||
@@ -40,6 +41,7 @@ class HashDB(object):
|
||||
if threadData.hashDBCursor is None:
|
||||
try:
|
||||
connection = sqlite3.connect(self.filepath, timeout=3, isolation_level=None)
|
||||
self._connections.append(connection)
|
||||
threadData.hashDBCursor = connection.cursor()
|
||||
threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)")
|
||||
connection.commit()
|
||||
@@ -66,6 +68,14 @@ class HashDB(object):
|
||||
except:
|
||||
pass
|
||||
|
||||
def closeAll(self):
|
||||
for connection in self._connections:
|
||||
try:
|
||||
connection.commit()
|
||||
connection.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def hashKey(key):
|
||||
key = getBytes(key if isinstance(key, six.text_type) else repr(key), errors="xmlcharrefreplace")
|
||||
|
||||
Reference in New Issue
Block a user