diff options
| author | 2014-12-13 15:56:57 +0100 | |
|---|---|---|
| committer | 2014-12-13 15:56:57 +0100 | |
| commit | acc46fc3497a66a427b795b4a22c6e71d69185a1 (patch) | |
| tree | 2d315b838a76435fc456b972c99c28d1732b2f70 /pyload/database/StorageDatabase.py | |
| parent | Code fixes (diff) | |
| download | pyload-acc46fc3497a66a427b795b4a22c6e71d69185a1.tar.xz | |
Update
Diffstat (limited to 'pyload/database/StorageDatabase.py')
| -rw-r--r-- | pyload/database/StorageDatabase.py | 34 | 
1 files changed, 0 insertions, 34 deletions
| diff --git a/pyload/database/StorageDatabase.py b/pyload/database/StorageDatabase.py deleted file mode 100644 index 75e166d39..000000000 --- a/pyload/database/StorageDatabase.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: mkaay - -from pyload.database import style -from pyload.database import DatabaseBackend - -class StorageMethods(object): -    @style.queue -    def setStorage(db, identifier, key, value): -        db.c.execute("SELECT id FROM storage WHERE identifier=? AND key=?", (identifier, key)) -        if db.c.fetchone() is not None: -            db.c.execute("UPDATE storage SET value=? WHERE identifier=? AND key=?", (value, identifier, key)) -        else: -            db.c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", (identifier, key, value)) - -    @style.queue -    def getStorage(db, identifier, key=None): -        if key is not None: -            db.c.execute("SELECT value FROM storage WHERE identifier=? AND key=?", (identifier, key)) -            row = db.c.fetchone() -            if row is not None: -                return row[0] -        else: -            db.c.execute("SELECT key, value FROM storage WHERE identifier=?", (identifier,)) -            d = {} -            for row in db.c: -                d[row[0]] = row[1] -            return d - -    @style.queue -    def delStorage(db, identifier, key): -        db.c.execute("DELETE FROM storage WHERE identifier=? AND key=?", (identifier, key)) - -DatabaseBackend.registerSub(StorageMethods) | 
