diff options
author | Antanas Uršulis <antanas.ursulis@gmail.com> | 2013-08-02 10:12:25 +0300 |
---|---|---|
committer | Antanas Uršulis <antanas.ursulis@gmail.com> | 2013-08-02 10:12:25 +0300 |
commit | 5c567070fc3a18ae08c7d4b5ffa9af5ae3a72e5e (patch) | |
tree | c54748a73d340a7f6e2ee25b662ce376fc132cb7 /database.py | |
parent | Group list view (diff) | |
download | log-analysis-5c567070fc3a18ae08c7d4b5ffa9af5ae3a72e5e.tar.gz log-analysis-5c567070fc3a18ae08c7d4b5ffa9af5ae3a72e5e.tar.bz2 log-analysis-5c567070fc3a18ae08c7d4b5ffa9af5ae3a72e5e.zip |
TODO: it should provide a link to file, instead of printing the path.
Diffstat (limited to 'database.py')
-rw-r--r-- | database.py | 5 |
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) |