summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'database.py')
-rw-r--r--database.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/database.py b/database.py
index 5f14801..29b687a 100644
--- a/database.py
+++ b/database.py
@@ -21,6 +21,11 @@ class DatabaseConnection(object):
with closing(self.conn.cursor(MySQLdb.cursors.DictCursor)) as c:
c.execute("select * from `groups`")
return c.fetchall()
+
+ def get_files(self):
+ with closing(self.conn.cursor(MySQLdb.cursors.DictCursor)) as c:
+ c.execute("select `files`.* from `files` inner join `groups` on `files`.`group_id` = `groups`.`id` order by `groups`.`date` desc")
+ return c.fetchall()
def get_connection(user, passwd, db):
conn = MySQLdb.connect(user=user, passwd=passwd, db=db)