Exemplo n.º 1
0
 def find(self, id):
     self.cursor.execute("""SELECT * FROM """+self.tablename+""" WHERE id = %s""", (id,))
     rs = self.cursor.fetchall()
     session = Session()
     if not rs:
         return None
     for row in rs:
         session.id = row[0]
         session.startDate = row[1] 
         session.lastUpdate = row[2] 
         session.downloaded = row[3] 
         session.uploaded = row[4] 
         session.source.id = row[5] 
         session.file.id = row[6] 
         session.address.id = row[7] 
         session.kind = row[8] 
     return session 
Exemplo n.º 2
0
    def findBySourceFileAddress(self, sourceId, fileId, addressId):
        query = "SELECT * FROM %s WHERE source_id = %s and file_id = %s and address_id = %s " % (self.tablename, sourceId, fileId, addressId)
	logging.debug(query)
	self.cursor.execute(query)
        rs = self.cursor.fetchall()
        if not rs:
            return None
        session = Session()
        for row in rs:
            session.id = row[0]
            session.startDate = row[1] 
            session.lastUpdate = row[2] 
            session.downloaded = row[3] 
            session.uploaded = row[4] 
            session.source.id = row[5] 
            session.file.id = row[6] 
            session.address.id = row[7] 
            session.kind = row[8] 
        return session