Example #1
0
    def query_perfectly_matched(self, pair):
        key = MySQLdb.escape_string(pair.keys()[0])
        value = MySQLdb.escape_string(pair[key])
        sql = 'select isbn, price, title, author, press, description, cover ' \
              'from book_info ' \
              'where %s="%s"' %(key, value)
        self.cursor.execute(sql)
        result_list = self.cursor.fetchall()
        bookpo_list = []
        for result in result_list:
            bookpo = BookPO()
            bookpo.set_all(result)
            bookpo_list.append(bookpo)

        return bookpo_list