def log_to_db(): 'Creates a db in memory with a table to save flights information' file = get_db_path() check_db_exists(file) cursor = get_cursor(file) current = "'" + environ['PWD'] + "'" query = '''INSERT OR IGNORE INTO dircounts(path,count, time) VALUES (%s,1, DATETIME('NOW')); UPDATE dircounts SET count = count + 1, time = DATETIME('NOW') WHERE path like %s;''' % (current, current) cursor.executescript(query)
def directory(): file = get_db_path() check_db_exists(file) cursor = get_cursor(file) print_paths(cursor, '''SELECT path FROM dircounts ORDER BY count DESC LIMIT 7''')
def damp_db(): file = get_db_path() check_db_exists(file) cursor = get_cursor(file) cursor.execute('UPDATE dircounts SET count = count / 2')