示例#1
0
    def save(self):
        if self._post_id:
            self.update(self)
        else:
            try:
                insert = InsertBuilder()
                insert.setStatement('insert into posts (user_id, post, lat, lng)')
                insert.setValues('values ("1", "' + self._post + '" , "44.34567", "-66.78945")')
                self._db.execute(insert);
            except:
                print "Could not insert record"

            self.notify()
示例#2
0
 def save(self):
     
     if self._comment_id:
         self.update(self)
     else:
         try:
             insert = InsertBuilder()
             insert.setStatement('insert into comments (user_id, post_id, comment)')
             insert.setValues('values ("' + self._user_id + '", "' + self._post_id + '" , "' + self._comment +'")')
             self._db.execute(insert);
         except:
             print "Could not insert record"
             
     self.notify()