示例#1
0
def select_menu_entry():
    conn=mysql.connect()
    cursor=conn.cursor()
    try:
        
        return jsonify(cursor.execute("select * from Restaurant_Menu").fetchall())
    except Exception, e:
        print "select failed"+"str(e)"
示例#2
0
def insert_menu_entry(mid,dish,price,desciption):
    conn=mysql.connect()
    cursor=conn.cursor()
    try:
        cursor.execute("""insert into Restaurant_Menu(RM_REid,RM_dish,RM_price,RM_description) values (%s,%s,%s,%s)""",(mid,dish,price,desciption))
        conn.commit()
        return 1
    except Exception, e:
        print "insert failed"+"str(e)"
        return 0
示例#3
0
def insert_restaurant_entry(name,address,phone,rating,desciption):
    conn=mysql.connect()
    cursor=conn.cursor()
    try:
        cursor.execute("""insert into Restaurant_Entry(RE_name,RE_address,RE_phoneNumber,RE_rating,RE_description) values (%s,%s,%s,%s,%s)""",(name,address,phone,rating,desciption))
        conn.commit()
        return 1
    except Exception, e:
        print "insert failed"+"str(e)"
        return 0