Ejemplo n.º 1
0
 def save(self):
     if self.host_id and self.path:
         if self.id:
             db.query('UPDATE `pages` SET `host_id`="'+db.escape_string(str(self.host_id))+'", `path`="'+db.escape_string(self.path)+'" WHERE `id`='+db.escape_string(str(self.id)))
             return True
         else:
             db.query('INSERT into `pages` (`host_id`,`path`) VALUES ("'+db.escape_string(str(self.host_id))+'","'+db.escape_string(self.path)+'")')
             self.id = db.insert_id()
             return True
     else:
         return False
Ejemplo n.º 2
0
 def save(self):
     if self.host:
         if self.id:
             db.query('UPDATE `hosts` SET `host`="'+db.escape_string(self.host)+'" WHERE `id`='+db.escape_string(str(self.id)))
             return True
         else:
             db.query('INSERT into `hosts` (`host`) VALUES ("'+db.escape_string(self.host)+'")')
             self.id = db.insert_id()
             return True
     else:
         return False
Ejemplo n.º 3
0
 def save(self):
     if self.page_id and self.status:
         if self.id:
             db.query('UPDATE `visits` SET `page_id`="'+db.escape_string(str(self.page_id))+'", `time`=UNIX_TIMESTAMP(), `status`="'+db.escape_string(str(self.status))+'" WHERE `id`='+db.escape_string(str(self.id)))
             return True
         else:
             db.query('INSERT into `visits` (`page_id`,`time`,`status`) VALUES ("'+db.escape_string(str(self.page_id))+'",UNIX_TIMESTAMP(),"'+db.escape_string(str(self.status))+'")')
             self.id = db.insert_id()
             return True
     else:
         return False
Ejemplo n.º 4
0
 def save(self):
     if self.visit_id and self.page_id:
         if self.id:
             db.query(
                 'UPDATE `cache` SET `visit_id`="'
                 + db.escape_string(str(self.visit_id))
                 + '", `page_id`="'
                 + db.escape_string(str(self.page_id))
                 + '", `encoding`="'
                 + db.escape_string(self.encoding)
                 + '", `doctype`="'
                 + db.escape_string(self.doctype)
                 + '", `validity`="'
                 + db.escape_string(str(self.validity))
                 + '", `headers`="'
                 + db.escape_string(str(self.headers))
                 + '", `content`="'
                 + db.escape_string(self.content)
                 + '" WHERE `id`='
                 + db.escape_string(str(self.id))
             )
             return True
         else:
             db.query(
                 'INSERT into `cache` (`visit_id`,`page_id`,`encoding`,`doctype`,`validity`,`content`,`headers`) VALUES ("'
                 + db.escape_string(str(self.visit_id))
                 + '","'
                 + db.escape_string(str(self.page_id))
                 + '","'
                 + db.escape_string(self.encoding)
                 + '","'
                 + db.escape_string(self.doctype)
                 + '","'
                 + db.escape_string(str(self.validity))
                 + '","'
                 + db.escape_string(self.content)
                 + '","'
                 + db.escape_string(str(self.headers))
                 + '")'
             )
             self.id = db.insert_id()
             return True
     else:
         return False