mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Speed optimization of HashDB
This commit is contained in:
parent
2172aea6e4
commit
a4c1afafee
3 changed files with 12 additions and 5 deletions
|
|
@ -45,6 +45,9 @@ class HashDB(object):
|
|||
if threadData.hashDBCursor is None:
|
||||
try:
|
||||
connection = sqlite3.connect(self.filepath, timeout=10, isolation_level=None, check_same_thread=False)
|
||||
connection.execute("PRAGMA journal_mode=WAL")
|
||||
connection.execute("PRAGMA synchronous=NORMAL")
|
||||
connection.execute("PRAGMA busy_timeout=10000")
|
||||
self._connections.append(connection)
|
||||
threadData.hashDBCursor = connection.cursor()
|
||||
threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)")
|
||||
|
|
@ -66,7 +69,9 @@ class HashDB(object):
|
|||
threadData = getCurrentThreadData()
|
||||
try:
|
||||
if threadData.hashDBCursor:
|
||||
threadData.hashDBCursor.connection.commit()
|
||||
if self._write_cache:
|
||||
self.flush()
|
||||
|
||||
threadData.hashDBCursor.close()
|
||||
threadData.hashDBCursor.connection.close()
|
||||
threadData.hashDBCursor = None
|
||||
|
|
@ -74,9 +79,11 @@ class HashDB(object):
|
|||
pass
|
||||
|
||||
def closeAll(self):
|
||||
if self._write_cache:
|
||||
self.flush()
|
||||
|
||||
for connection in self._connections:
|
||||
try:
|
||||
connection.commit()
|
||||
connection.close()
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue