# -*- coding: utf-8 -*- from pyload.database import queue, async from pyload.database import DatabaseBackend class AccountMethods: @queue def loadAccounts(db): db.c.execute('SELECT plugin, loginname, activated, password, options FROM accounts;') return db.c.fetchall() @async def saveAccounts(db, data): # TODO: owner, shared db.c.executemany( 'INSERT INTO accounts(plugin, loginname, activated, password, options) VALUES(?,?,?,?,?)', data) @async def removeAccount(db, plugin, loginname): db.c.execute('DELETE FROM accounts WHERE plugin=? AND loginname=?', (plugin, loginname)) DatabaseBackend.registerSub(AccountMethods)