예제 #1
0
        public static void InsertTip(Tip tip)
        {
            string sqlStr = "INSERT INTO Tip(user_id, business_id, tipDate, text, numLikes) " +
                            "VALUES ('" + tip.UserID + "', '" + tip.BusinessID + "', current_timestamp, '" + tip.Text + "', " + tip.NumberOfLikes + ");";

            YelpDatabaseQueries.ExecuteNonQuery(sqlStr);
        }
예제 #2
0
        public static void InsertCheckin(Checkin checkin)
        {
            string sqlStr = "INSERT INTO Checkins(year, month, day, time, business_id) " +
                            "VALUES ('" + checkin.Year + "', '" + checkin.Month + "', '" + checkin.Day + "', '" + checkin.Time + "', '" + checkin.BusinessID + "');";

            YelpDatabaseQueries.ExecuteNonQuery(sqlStr);
        }
예제 #3
0
        public static void LikeTip(Tip tip)
        {
            string sqlStr = "UPDATE tip " +
                            $"SET numlikes = 1 + (SELECT numLikes FROM tip WHERE tip.user_id = '{tip.UserID}' AND tip.business_id = '{tip.BusinessID}' AND tip.tipdate = '{tip.TipDate}') " +
                            $"WHERE tip.user_id = '{tip.UserID}' AND tip.business_id = '{tip.BusinessID}' AND tip.tipdate = '{tip.TipDate}'";

            YelpDatabaseQueries.ExecuteNonQuery(sqlStr);
        }