c00w/bitHopper — Issue #520: Purge 0 Share Users
Author: itstooez
Created: 2011-11-18 03:44:07+00:00
State: open

sdogi asked me to write some code that can be incorporated into database.py to clear out all rows from all tables that have 0 shares. The code below should be able to be added just about anywhere. Just wanted the function is there, when and how it will be used will be decided later.

def purgeOldUsers():
sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
curs.execute(sql)

serverlist = []
for item in curs.fetchall():
serverlist.append(item[0])

for server in serverlist:
sql = "DELETE FROM " + str(server) + " WHERE shares='0'"
curs.execute(sql)