Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. def findAll(self,order='dataInserimento',type='asc'):
  2.         logging.debug("Chiamato find all")
  3.         sql = """select id,nickname,email,messaggio,dataInserimento
  4.                    from dedica order by %s %s""" % (order,type)
  5.         conn = MySQLdb.connect(host=self.__host__, user=self.__user__, passwd=self.__passwd__, db=self.__db__)
  6.         rows=None
  7.         cursor = conn.cursor()
  8.         try:
  9.             cursor.execute(sql)
  10.             rows = cursor.fetchall()
  11.             cursor.close()
  12.             conn.commit()
  13.         except Exception as e:            
  14.             conn.rollback()
  15.             logging.error("Unexpected error:"+ e)
  16.             logging.debug("rollback")
  17.         conn.close()
  18.         return self.__rowsToDediche__(rows)