コード例 #1
0
ファイル: proptable.py プロジェクト: walakymas/senechalweb
 def set(self, key, value):
     BaseTableHandler.execute(
         'INSERT INTO properties (modified, key, value) VALUES(now(),%(key)s,%(value)s)'
         ' ON CONFLICT (key) DO UPDATE SET value=%(value)s', {
             'key': key,
             'value': value
         })
コード例 #2
0
 def set(self, lord, year, value):
     BaseTableHandler.execute(
         'INSERT INTO marks (modified, lord, year, spec) VALUES(now(),%(lord)s,%(year)s,%(spec)s)'
         ' ON CONFLICT (lord, year, spec) DO UPDATE SET spec=%(spec)s', {
             'lord': lord,
             'year': year,
             'spec': value
         })
コード例 #3
0
 def set_json(self, id, data):
     j = json.loads(data)
     BaseTableHandler.execute(
         "UPDATE characters SET modified=now(), data=%(data)s, name=%(name)s WHERE id=%(id)s",
         {
             'id': id,
             'name': j['name'],
             'data': data
         })
コード例 #4
0
 def add(self, data):
     j = json.loads(data)
     BaseTableHandler.execute(
         "INSERT INTO characters (created, modified, data, name) VALUES (now(), now(), %(data)s, %(name)s)",
         {
             'name': j['name'],
             'data': data
         },
         commit=True)
コード例 #5
0
ファイル: lordtable.py プロジェクト: walakymas/senechalweb
 def set(self, lord, year, key, value):
     BaseTableHandler.execute(
         'INSERT INTO lord (modified, lord, year, key, value) VALUES(now(),'
         ' %(lord)s, %(year)s, %(key)s, %(value)s)'
         ' ON CONFLICT (lord, year, key) DO UPDATE SET value=%(value)s', {
             'lord': lord,
             'year': year,
             'key': key,
             'value': value
         })
コード例 #6
0
 def list(self, lord=-1, year=-1):
     return BaseTableHandler.execute(
         'SELECT * FROM marks WHERE (-1=%(lord)s::bigint OR lord=%(lord)s::bigint) AND (-1=%(year)s OR year=%(year)s) ORDER BY lord, year, spec',
         {
             'lord': lord,
             'year': year
         },
         fetch='all')
コード例 #7
0
ファイル: proptable.py プロジェクト: walakymas/senechalweb
 def remove(self, key):
     BaseTableHandler.execute("DELETE FROM properties WHERE key=%s",
                              param=[key],
                              commit=True)
コード例 #8
0
ファイル: proptable.py プロジェクト: walakymas/senechalweb
 def get(self, key):
     return BaseTableHandler.execute(
         "SELECT * FROM properties WHERE key=%s", param=[key])
コード例 #9
0
 def list(self):
     return BaseTableHandler.execute(
         'SELECT * FROM characters ORDER BY name', fetch='all')
コード例 #10
0
ファイル: lordtable.py プロジェクト: walakymas/senechalweb
 def get_by_value(self, year, key, value):
     return BaseTableHandler.execute(
         "SELECT * FROM lord WHERE year=%s AND key = %s AND value=%s",
         param=[year, key, value])
コード例 #11
0
 def get_by_id(self, mid):
     return BaseTableHandler.execute(
         "SELECT * FROM characters WHERE id = %s", param=[mid], fetch='one')
コード例 #12
0
 def get_pcs(self):
     return BaseTableHandler.execute(
         "SELECT * FROM characters WHERE memberid IS NOT NULL", fetch='all')
コード例 #13
0
 def update(self, id, description, glory, year):
     return BaseTableHandler.execute('UPDATE events SET modified=now(), description=%s, glory=%s, year=%s WHERE id=%s',
                                     [description, glory, year, id], commit=True)
コード例 #14
0
 def glory(self, lord=0):
     return int(BaseTableHandler.execute('SELECT sum(glory) FROM events WHERE lord=%s::bigint', [lord], fetch='one')[0])
コード例 #15
0
ファイル: lordtable.py プロジェクト: walakymas/senechalweb
 def get(self, lord, year, key):
     return BaseTableHandler.execute(
         "SELECT * FROM lord WHERE lord=%s, year=%s, key = %s",
         param=[lord, year, key])
コード例 #16
0
 def remove(self, id):
     return BaseTableHandler.execute('DELETE FROM events WHERE id=%s', [id], commit=True)
コード例 #17
0
 def get(self, lord, year):
     return BaseTableHandler.execute(
         "SELECT * FROM marks WHERE lord=%s, year=%s", [lord, year],
         fetch='all')
コード例 #18
0
 def remove(self, key):
     BaseTableHandler.execute("DELETE FROM marks WHERE id=%s", [int(key)])
コード例 #19
0
 def insert(self, lord, description, glory, year=-1):
     return BaseTableHandler.execute('INSERT INTO events (created, modified, year, lord, description, glory) '
                                     'VALUES(now(), now(),%s,%s,%s,%s);',
         [(self.year(), year)[year > 0], lord, description, glory], commit=True)
コード例 #20
0
ファイル: proptable.py プロジェクト: walakymas/senechalweb
 def list(self):
     return BaseTableHandler.execute(
         'SELECT * FROM properties ORDER BY key', fetch='all')
コード例 #21
0
 def get_by_name(self, name):
     return BaseTableHandler.execute(
         f"SELECT * FROM characters WHERE name ILIKE '%{name}%'",
         fetch='one')
コード例 #22
0
ファイル: lordtable.py プロジェクト: walakymas/senechalweb
 def remove(self, lord, year, key):
     BaseTableHandler.execute(
         "DELETE FROM properties WHERE lord=%s, year=%s, key=%s",
         param=[lord, year, key],
         commit=True)
コード例 #23
0
 def get(self, id):
     return BaseTableHandler.execute('SELECT * FROM events WHERE id=%s', [id], commit=True, fetch='one')