示例#1
0
        public string[] GetGameLibrary(int loginID)
        {
            SQL_Handler handler = new SQL_Handler();

            handler.SQLConnect("default", 0, "default", "default", "default");
            return(handler.SQLQuery("SELECT  WHERE id=" + loginID));
        }
示例#2
0
文件: User.cs 项目: OrionPl/TGRS
        private void CreateLibrary(int id)
        {
            SQL_Handler handler = new SQL_Handler();

            handler.SQLConnect("default", 0, "default", "default", "libraries");
            handler.SQLQuery("CREATE TABLE " + id + " (`gameId` INT NOT NULL, `hoursInGame` VARCHAR(20) NOT NULL, PRIMARY KEY(`gameId`, `hoursInGame`));");
        }
示例#3
0
文件: User.cs 项目: OrionPl/TGRS
        public void CreateUser(string username, string password)
        {
            SQL_Handler handler = new SQL_Handler();

            handler.SQLConnect("default", 0, "default", "default", "users");
            int newUserId = int.Parse(handler.SQLQuery("SELECT MAX(id) FROM users")[0]) + 1;

            handler.SQLQuery("INSERT INTO users (id, username, password) VALUES (" + newUserId + ", " + username + ", " + password + ")");
            CreateLibrary(newUserId);
        }
示例#4
0
        public Game getGame(int gameId)
        {
            SQL_Handler handler = new SQL_Handler();

            handler.SQLConnect("default", 0, "default", "default", "games");
            string[] gameInfo = handler.SQLQuery("SELECT * FROM games WHERE gameId=" + gameId);
            Game     game     = new Game(int.Parse(gameInfo[0]), gameInfo[1], gameInfo[2], gameInfo[3]);

            return(game);
        }