Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dbphoto.py
diff options
context:
space:
mode:
Diffstat (limited to 'dbphoto.py')
-rw-r--r--dbphoto.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/dbphoto.py b/dbphoto.py
index f1c7190..180ae48 100644
--- a/dbphoto.py
+++ b/dbphoto.py
@@ -119,6 +119,11 @@ class DbAccess():
cursor.execute('select * from groups where category = ?',('albums',))
return cursor.fetchall()
+ def get_albums_containing(self,jobject_id):
+ cursor = self.connection().cursor()
+ cursor.execute('select * from groups where jobject_id = ?',(jobject_id,))
+ return cursor.fetchall()
+
def get_album_thumbnails(self,album_id,is_journal=False):
if is_journal: #is_journal: #want most recent first, need left join because picture may not exist yet
#sql = """select groups.*, data_cache.picture.* from groups left join data_cache.picture \
@@ -416,6 +421,25 @@ values (?,?,?,?,?,?,?,?)""",(jobject_id,w,h,x_thumb,y_thumb,thumb_binary,transfo
cursor.execute('rollback transaction')
_logger.error('error deleting all references for object:%s. Error: ;%s'%(jobject_id,e,))
+ def set_config(self,name,value):
+ cursor = self.connection().cursor()
+ cursor.execute('select * from config where name = ?',(name,))
+ rows = cursor.fetchall()
+ if len(rows)>0:
+ cursor.execute("update config set value = ? where id = ?",(album_id,rows[0]['id']))
+ else:
+ cursor.execute("insert into config (name,value) values (?,?)",(name,value,))
+ self.con.commit()
+
+ def get_config(self,name):
+ cursor = self.connection().cursor()
+ cursor.execute('select * from config where name = ?',(name,))
+ rows = cursor.fetchall()
+ if len(rows)>0:
+ return rows[0]['value']
+ else:
+ return ''
+
def table_exists(self,table):
try:
sql = 'select * from %s'%table