mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-134004: Added the reorganize() methods to dbm.sqlite, dbm.dumb and shelve (GH-134028)
They are similar to the same named method in dbm.gnu.
This commit is contained in:
parent
b595237166
commit
f806463e16
9 changed files with 172 additions and 6 deletions
|
@ -15,6 +15,7 @@ LOOKUP_KEY = "SELECT value FROM Dict WHERE key = CAST(? AS BLOB)"
|
|||
STORE_KV = "REPLACE INTO Dict (key, value) VALUES (CAST(? AS BLOB), CAST(? AS BLOB))"
|
||||
DELETE_KEY = "DELETE FROM Dict WHERE key = CAST(? AS BLOB)"
|
||||
ITER_KEYS = "SELECT key FROM Dict"
|
||||
REORGANIZE = "VACUUM"
|
||||
|
||||
|
||||
class error(OSError):
|
||||
|
@ -122,6 +123,9 @@ class _Database(MutableMapping):
|
|||
def __exit__(self, *args):
|
||||
self.close()
|
||||
|
||||
def reorganize(self):
|
||||
self._execute(REORGANIZE)
|
||||
|
||||
|
||||
def open(filename, /, flag="r", mode=0o666):
|
||||
"""Open a dbm.sqlite3 database and return the dbm object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue