예제 #1
0
        public static void Create(string uuid, string ip)
        {
            // IPエラー
            var ipCount = Convert.ToInt32(MySqlite.GetOne(
                                              "select count(1) from users " +
                                              "where ip = ? ",
                                              new object[] { ip }
                                              ));

            if (ipCount >= 1)
            {
                throw new Exception();
            }

            MySqlite.Execute(
                "insert into users " +
                "(uuid, ip, created_at) values " +
                "(?, ?, ?) ",
                new object[] { uuid, ip, Utility.GetDatetime() }
                );
            // 匿名ネームに変える
            int id = MySqlite.LastInsertedId();

            MySqlite.Execute(
                "update users " +
                "set name = ? " +
                "where id = ? ",
                new object[] { "匿名" + id.ToString(), id }
                );
        }
예제 #2
0
 public static bool IsExist(string title, string artist)
 {
     return(Convert.ToInt32(MySqlite.GetOne(
                                "select count(1) from subjects " +
                                "where title = ? and artist = ? ",
                                new object[] { title, artist }
                                )) >= 1);
 }
예제 #3
0
 private static string Get(string key)
 {
     return(MySqlite.GetOne(
                "select value from infos " +
                "where key = ? ",
                new object[] { key }
                ));
 }