def get_record_with_id(table, record_id): where_clause = '''WHERE %s=%s''' % (record.KEY_RECORD_ID, record_id) limit_clause = '''LIMIT 1''' data = record.query(table, where_clause, limit_clause = limit_clause) if data == None or len(data) == 0: return None return record.generate(data)
def get_record_with_status(table, status): where_clause = '''WHERE %s=%s''' % (record.KEY_STATUS, status) order_clause = '''ORDER BY RAND()''' limit_clause = '''LIMIT 1''' data = record.query(table, where_clause, order_clause, limit_clause) print data if data == None or len(data) == 0: return None return record.generate(data[0])