Пример #1
0
 def add(cls, uid, name, type):
     try:
         id = store.execute("insert into user (uid, name, type) values "
                            "(%s, %s, %s)", (uid, name, type))
         store.commit()
     except IntegrityError:
         store.rollback()
         return
     return cls.get(id)
Пример #2
0
 def add(cls, title, content, author_uid):
     try:
         id = store.execute(
             "insert into card (title, content, author_uid, creation_time) " "values(%s, %s, %s, null)",
             (title, content, author_uid),
         )
         store.commit()
     except IntegrityError:
         store.rollback()
         return
     return cls.get(id)
Пример #3
0
 def delete(self):
     store.execute("delete from card where id=%s", self.id)
     store.commit()
Пример #4
0
 def update(self, title, content):
     store.execute("update card set title=%s, content=%s where id=%s", (title, content, self.id))
     store.commit()
     self.title = title
     self.content = content
Пример #5
0
 def delete(self):
     store.execute('delete from user where id=%s', self.id)
     store.commit()