Mercurial > libervia-backend
comparison sat/memory/sqlite.py @ 3535:67aebefb44fc
core (memory/sqlite): return 0 instead of None when user has no file yet
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 06 May 2021 21:39:08 +0200 |
parents | 30779935c0aa |
children | 31cbcdd096a2 |
comparison
equal
deleted
inserted
replaced
3534:1658472abd77 | 3535:67aebefb44fc |
---|---|
991 query = "SELECT SUM(size) FROM files WHERE owner=? AND type='file' AND profile_id=?" | 991 query = "SELECT SUM(size) FROM files WHERE owner=? AND type='file' AND profile_id=?" |
992 ret = await self.dbpool.runQuery( | 992 ret = await self.dbpool.runQuery( |
993 query, | 993 query, |
994 (owner.userhost(), self.profiles[client.profile]) | 994 (owner.userhost(), self.profiles[client.profile]) |
995 ) | 995 ) |
996 return ret[0][0] | 996 return ret[0][0] or 0 |
997 | 997 |
998 def _fileUpdate(self, cursor, file_id, column, update_cb): | 998 def _fileUpdate(self, cursor, file_id, column, update_cb): |
999 query = 'SELECT {column} FROM files where id=?'.format(column=column) | 999 query = 'SELECT {column} FROM files where id=?'.format(column=column) |
1000 for i in range(5): | 1000 for i in range(5): |
1001 cursor.execute(query, [file_id]) | 1001 cursor.execute(query, [file_id]) |